├── .ci ├── Dockerfile ├── build_wheels_osx.sh ├── coverage.sh ├── deploy_pypi.sh ├── download_and_run_doqcs.sh ├── run_pylint.sh ├── travis_build_linux.sh ├── travis_build_osx.sh ├── travis_prepare_linux.sh └── travis_prepare_osx.sh ├── .clang-format ├── .github ├── main.workflow └── workflows │ ├── package.yml │ └── pymoose.yml ├── .gitignore ├── .gitlab-ci.yml ├── .pre-commit-config.yaml ├── .travis.yml ├── AUTHORS ├── AppleM1Build.md ├── CHANGELOG.md ├── CONTRIBUTING.md ├── INSTALL.md ├── LICENSE ├── MANIFEST.in ├── README.md ├── UbuntuBuild.md ├── WSLGuide.md ├── WindowsBuild.md ├── basecode ├── Cinfo.cpp ├── Cinfo.h ├── Conv.h ├── DataElement.cpp ├── DataElement.h ├── DestFinfo.cpp ├── DestFinfo.h ├── Dinfo.h ├── Element.cpp ├── Element.h ├── ElementValueFinfo.h ├── EpFunc.cpp ├── EpFunc.h ├── Eref.cpp ├── Eref.h ├── FieldElement.cpp ├── FieldElement.h ├── FieldElementFinfo.cpp ├── FieldElementFinfo.h ├── Finfo.cpp ├── Finfo.h ├── FuncOrder.h ├── GlobalDataElement.cpp ├── GlobalDataElement.h ├── HopFunc.cpp ├── HopFunc.h ├── Id.cpp ├── Id.h ├── LocalDataElement.cpp ├── LocalDataElement.h ├── LookupElementValueFinfo.h ├── LookupValueFinfo.h ├── MsgDigest.h ├── MsgElement.h ├── MsgFuncBinding.h ├── ObjId.cpp ├── ObjId.h ├── OpFunc.h ├── OpFuncBase.cpp ├── OpFuncBase.h ├── PrepackedBuffer.cpp ├── PrepackedBuffer.h ├── ProcInfo.h ├── ProcOpFunc.h ├── SetGet.cpp ├── SetGet.h ├── SharedFinfo.cpp ├── SharedFinfo.h ├── SparseMatrix.cpp ├── SparseMatrix.h ├── SrcFinfo.cpp ├── SrcFinfo.h ├── ValueFinfo.cpp ├── ValueFinfo.h ├── doubleEq.cpp ├── doubleEq.h ├── global.cpp ├── global.h ├── header.h ├── main.cpp ├── meson.build ├── testAsync.cpp └── testGlobals.cpp ├── biophysics ├── CaConc.cpp ├── CaConc.h ├── CaConcBase.cpp ├── CaConcBase.h ├── ChanBase.cpp ├── ChanBase.h ├── ChanCommon.cpp ├── ChanCommon.h ├── Compartment.cpp ├── Compartment.h ├── CompartmentBase.cpp ├── CompartmentBase.h ├── CompartmentDataHolder.cpp ├── CompartmentDataHolder.h ├── DifBuffer.cpp ├── DifBuffer.h ├── DifBufferBase.cpp ├── DifBufferBase.h ├── DifShell.cpp ├── DifShell.h ├── DifShellBase.cpp ├── DifShellBase.h ├── GapJunction.cpp ├── GapJunction.h ├── HHChannel.cpp ├── HHChannel.h ├── HHChannel2D.cpp ├── HHChannel2D.h ├── HHChannelBase.cpp ├── HHChannelBase.h ├── HHChannelF.cpp ├── HHChannelF.h ├── HHGate.cpp ├── HHGate.h ├── HHGate2D.cpp ├── HHGate2D.h ├── HHGateBase.cpp ├── HHGateBase.h ├── HHGateF.cpp ├── HHGateF.h ├── IntFire.cpp ├── IntFire.h ├── IzhikevichNrn.cpp ├── IzhikevichNrn.h ├── Leakage.cpp ├── Leakage.h ├── MMPump.cpp ├── MMPump.h ├── MarkovChannel.cpp ├── MarkovChannel.h ├── MarkovOdeSolver.cpp ├── MarkovOdeSolver.h ├── MarkovRateTable.cpp ├── MarkovRateTable.h ├── MarkovSolver.cpp ├── MarkovSolver.h ├── MarkovSolverBase.cpp ├── MarkovSolverBase.h ├── MatrixOps.cpp ├── MatrixOps.h ├── MgBlock.cpp ├── MgBlock.h ├── NMDAChan.cpp ├── NMDAChan.h ├── Nernst.cpp ├── Nernst.h ├── Neuron.cpp ├── Neuron.h ├── RandSpike.cpp ├── RandSpike.h ├── ReadCell.cpp ├── ReadCell.h ├── ReadSwc.cpp ├── ReadSwc.h ├── SpikeGen.cpp ├── SpikeGen.h ├── SpikeRingBuffer.cpp ├── SpikeRingBuffer.h ├── Spine.cpp ├── Spine.h ├── SwcSegment.cpp ├── SwcSegment.h ├── SymCompartment.cpp ├── SymCompartment.h ├── SynChan.cpp ├── SynChan.h ├── VClamp.cpp ├── VClamp.h ├── VectorTable.cpp ├── VectorTable.h ├── meson.build └── testBiophysics.cpp ├── builtins ├── Arith.cpp ├── Arith.h ├── Function.cpp ├── Function.h ├── Group.cpp ├── Group.h ├── HDF5DataWriter.cpp ├── HDF5DataWriter.h ├── HDF5WriterBase.cpp ├── HDF5WriterBase.h ├── InputVariable.cpp ├── InputVariable.h ├── Interpol.cpp ├── Interpol.h ├── Interpol2D.cpp ├── Interpol2D.h ├── MooseParser.cpp ├── MooseParser.h ├── MooseSocketInfo.h ├── Mstring.cpp ├── Mstring.h ├── NSDFWriter.cpp ├── NSDFWriter.h ├── NSDFWriter2.cpp ├── NSDFWriter2.h ├── SocketStreamer.cpp ├── SocketStreamer.h ├── SpikeStats.cpp ├── SpikeStats.h ├── Stats.cpp ├── Stats.h ├── StimulusTable.cpp ├── StimulusTable.h ├── Streamer.cpp ├── Streamer.h ├── StreamerBase.cpp ├── StreamerBase.h ├── Table.cpp ├── Table.h ├── TableBase.cpp ├── TableBase.h ├── TimeTable.cpp ├── TimeTable.h ├── Variable.cpp ├── Variable.h ├── meson.build ├── testBuiltins.cpp └── testNSDF.cpp ├── cmake ├── FindLIBSBML.cmake ├── FindLibXML2.cmake ├── FindPyQt.py ├── FindPyQt4.cmake ├── FindReadline.cmake ├── FindSIP.cmake ├── FindSIP.py ├── FindSphinx.cmake ├── FindTermcap.cmake ├── GetGitRevisionDescription.cmake ├── GetGitRevisionDescription.cmake.in ├── GetRevision.cmake ├── Pinfo.plist └── SIPMacros.cmake ├── cmake_moose_cpack.cmake ├── cmake_uninstall.cmake.in ├── devel ├── Doxyfile.in ├── _conftest.py ├── docker │ ├── centos │ │ ├── Dockerfile │ │ └── Makefile │ ├── opensuse │ │ ├── Dockerfile │ │ └── Makefile │ ├── travis │ │ ├── Dockerfile │ │ └── Makefile │ └── wheel │ │ ├── Dockerfile │ │ ├── Makefile │ │ ├── README.md │ │ ├── build_wheels.sh │ │ └── test_and_upload.sh ├── fixme │ ├── testDisabled_socket_streamer_tcp.py │ ├── test_81_synTrigCICR.py │ ├── test_82_multiscale_gluR_phosph_3compt.py │ ├── test_docs.py │ ├── test_function_namedvars.py │ ├── test_long_sbml+exp+parser+multithreaded.py │ ├── test_socket_streamer_multitab.py │ ├── test_socket_streamer_uds.py │ └── test_wrapper.py └── issues │ ├── hsolve │ ├── README │ ├── compare_moose_nrn.py │ ├── h10.CNG.hoc │ ├── h10.CNG.moose.py │ ├── h10.CNG.swc │ └── run_h10.CNG.hoc │ ├── issue_124.py │ ├── issue_239.py │ ├── issue_34.py │ ├── issue_45.py │ ├── issue_47.py │ └── issue_93.py ├── device ├── DiffAmp.cpp ├── DiffAmp.h ├── PIDController.cpp ├── PIDController.h ├── PulseGen.cpp ├── PulseGen.h ├── RC.cpp ├── RC.h └── meson.build ├── diffusion ├── ConcChanInfo.h ├── DiffJunction.h ├── DiffPoolVec.cpp ├── DiffPoolVec.h ├── Dsolve.cpp ├── Dsolve.h ├── FastMatrixElim.cpp ├── FastMatrixElim.h ├── meson.build ├── standaloneTestFastElim.cpp └── testDiffusion.cpp ├── examples ├── Ex.cpp ├── Ex.h ├── Example.cpp ├── Example.h └── meson.build ├── external ├── README ├── boost-numeric-bindings │ ├── .gitignore │ ├── LICENSE_1_0.txt │ └── boost │ │ └── numeric │ │ └── bindings │ │ ├── amos │ │ ├── amos.h │ │ ├── amos.hpp │ │ ├── amos_names.h │ │ └── amos_overloads.hpp │ │ ├── atlas │ │ ├── cblas.hpp │ │ ├── cblas1.hpp │ │ ├── cblas1_overloads.hpp │ │ ├── cblas2.hpp │ │ ├── cblas2_overloads.hpp │ │ ├── cblas3.hpp │ │ ├── cblas3_overloads.hpp │ │ ├── cblas_enum.hpp │ │ ├── cblas_inc.hpp │ │ ├── clapack.hpp │ │ ├── clapack_inc.hpp │ │ └── clapack_overloads.hpp │ │ ├── blas │ │ ├── blas.h │ │ ├── blas.hpp │ │ ├── blas1.hpp │ │ ├── blas1_overloads.hpp │ │ ├── blas2.hpp │ │ ├── blas2_overloads.hpp │ │ ├── blas3.hpp │ │ ├── blas3_overloads.hpp │ │ └── blas_names.h │ │ ├── lapack │ │ ├── gbsv.hpp │ │ ├── gees.hpp │ │ ├── geev.hpp │ │ ├── gels.hpp │ │ ├── gelsd.hpp │ │ ├── gelss.hpp │ │ ├── geqrf.hpp │ │ ├── gesdd.hpp │ │ ├── gesv.hpp │ │ ├── gesvd.hpp │ │ ├── hbev.hpp │ │ ├── hbevx.hpp │ │ ├── heev.hpp │ │ ├── heevd.hpp │ │ ├── heevx.hpp │ │ ├── hegv.hpp │ │ ├── hesv.hpp │ │ ├── hpsv.hpp │ │ ├── hseqr.hpp │ │ ├── ilaenv.hpp │ │ ├── lapack.h │ │ ├── lapack.hpp │ │ ├── lapack_names.h │ │ ├── orgqr.hpp │ │ ├── ormqr.hpp │ │ ├── posv.hpp │ │ ├── ppsv.hpp │ │ ├── ptsv.hpp │ │ ├── spsv.hpp │ │ ├── steqr.hpp │ │ ├── syev.hpp │ │ ├── syevd.hpp │ │ ├── syevx.hpp │ │ ├── sygv.hpp │ │ ├── sysv.hpp │ │ ├── sytrd.hpp │ │ ├── trevc.hpp │ │ ├── trexc.hpp │ │ └── workspace.hpp │ │ ├── mumps │ │ ├── 4.6.4 │ │ │ ├── cmumps_c.hpp │ │ │ ├── dmumps_c.hpp │ │ │ ├── smumps_c.hpp │ │ │ └── zmumps_c.hpp │ │ ├── mumps_driver.hpp │ │ ├── mumps_driver_4_6_4.hpp │ │ └── mumps_driver_4_8_0.hpp │ │ ├── traits │ │ ├── algorithm.hpp │ │ ├── boost_array.hpp │ │ ├── c_array.hpp │ │ ├── c_array2.hpp │ │ ├── config.hpp │ │ ├── dense_traits.hpp │ │ ├── detail │ │ │ ├── array.hpp │ │ │ ├── array_impl.hpp │ │ │ ├── dense_ordering.hpp │ │ │ ├── generate_const.hpp │ │ │ ├── symm_herm_traits.hpp │ │ │ ├── ublas_ordering.hpp │ │ │ ├── ublas_uplo.hpp │ │ │ └── utils.hpp │ │ ├── fortran.h │ │ ├── matrix_raw.hpp │ │ ├── matrix_traits.hpp │ │ ├── sparse_traits.hpp │ │ ├── std_valarray.hpp │ │ ├── std_valarray2.hpp │ │ ├── std_vector.hpp │ │ ├── std_vector2.hpp │ │ ├── symm_herm_raw.hpp │ │ ├── tnt.hpp │ │ ├── traits.hpp │ │ ├── transpose.hpp │ │ ├── type.h │ │ ├── type.hpp │ │ ├── type_traits.hpp │ │ ├── ublas_banded.hpp │ │ ├── ublas_hermitian.hpp │ │ ├── ublas_matrix.hpp │ │ ├── ublas_sparse.hpp │ │ ├── ublas_symmetric.hpp │ │ ├── ublas_vector.hpp │ │ ├── ublas_vector2.hpp │ │ ├── vector_raw.hpp │ │ └── vector_traits.hpp │ │ └── umfpack │ │ ├── umfpack.hpp │ │ ├── umfpack_inc.hpp │ │ └── umfpack_overloads.hpp ├── exprtk │ └── exprtk.hpp ├── fmt │ ├── include │ │ └── fmt │ │ │ ├── chrono.h │ │ │ ├── color.h │ │ │ ├── compile.h │ │ │ ├── core.h │ │ │ ├── format-inl.h │ │ │ ├── format.h │ │ │ ├── locale.h │ │ │ ├── os.h │ │ │ ├── ostream.h │ │ │ ├── posix.h │ │ │ ├── printf.h │ │ │ └── ranges.h │ ├── meson.build │ └── src │ │ ├── format.cc │ │ └── os.cc ├── getopt │ ├── getopt.c │ ├── getopt.h │ ├── meson.build │ └── unistd.h ├── libsoda │ ├── LICENSE │ ├── LSODA.cpp │ ├── LSODA.h │ ├── README.md │ ├── benchmark_LSODA.cpp │ ├── helper.h │ ├── meson.build │ ├── run_benchmark.sh │ └── test_LSODA.cpp └── tinyexpr │ ├── .travis.yml │ ├── CONTRIBUTING │ ├── LICENSE │ ├── README.md │ ├── benchmark.c │ ├── doc │ ├── e1.dot │ ├── e1.png │ ├── e2.dot │ └── e2.png │ ├── example.c │ ├── example2.c │ ├── example3.c │ ├── minctest.h │ ├── test.c │ ├── tinyexpr.c │ └── tinyexpr.h ├── hsolve ├── CTestTestfile.cmake ├── Cell.cpp ├── Cell.h ├── HSolve.cpp ├── HSolve.h ├── HSolveActive.cpp ├── HSolveActive.h ├── HSolveActiveSetup.cpp ├── HSolveInterface.cpp ├── HSolvePassive.cpp ├── HSolvePassive.h ├── HSolveStruct.cpp ├── HSolveStruct.h ├── HSolveUtils.cpp ├── HSolveUtils.h ├── HinesMatrix.cpp ├── HinesMatrix.h ├── README.txt ├── RateLookup.cpp ├── RateLookup.h ├── TestHSolve.h ├── ZombieCaConc.cpp ├── ZombieCaConc.h ├── ZombieCompartment.cpp ├── ZombieCompartment.h ├── ZombieHHChannel.cpp ├── ZombieHHChannel.h ├── meson.build └── testHSolve.cpp ├── intfire ├── AdExIF.cpp ├── AdExIF.h ├── AdThreshIF.cpp ├── AdThreshIF.h ├── ExIF.cpp ├── ExIF.h ├── IntFireBase.cpp ├── IntFireBase.h ├── IzhIF.cpp ├── IzhIF.h ├── LIF.cpp ├── LIF.h ├── QIF.cpp ├── QIF.h ├── meson.build └── testIntFire.cpp ├── kinetics ├── ConcChan.cpp ├── ConcChan.h ├── Enz.cpp ├── Enz.h ├── EnzBase.cpp ├── EnzBase.h ├── MMenz.cpp ├── MMenz.h ├── PoolBase.cpp ├── PoolBase.h ├── Reac.cpp ├── Reac.h ├── ReadCspace.cpp ├── ReadCspace.h ├── ReadKkit.cpp ├── ReadKkit.h ├── Species.cpp ├── Species.h ├── WriteKkit.cpp ├── lookupVolumeFromMesh.cpp ├── lookupVolumeFromMesh.h ├── meson.build └── testKinetics.cpp ├── ksolve ├── BoostSys.cpp ├── BoostSys.h ├── FuncRateTerm.h ├── FuncTerm.cpp ├── FuncTerm.h ├── Gsolve.cpp ├── Gsolve.h ├── GssaSystem.h ├── GssaVoxelPools.cpp ├── GssaVoxelPools.h ├── KinSparseMatrix.cpp ├── KinSparseMatrix.h ├── Ksolve.cpp ├── Ksolve.h ├── KsolveBase.cpp ├── KsolveBase.h ├── NonlinearSystem.h ├── OdeSystem.h ├── RateTerm.cpp ├── RateTerm.h ├── SteadyStateBoost.cpp ├── SteadyStateBoost.h ├── SteadyStateGsl.cpp ├── SteadyStateGsl.h ├── Stoich.cpp ├── Stoich.h ├── VoxelPools.cpp ├── VoxelPools.h ├── VoxelPoolsBase.cpp ├── VoxelPoolsBase.h ├── XferInfo.h ├── helper.h ├── meson.build └── testKsolve.cpp ├── mesh ├── Boundary.cpp ├── Boundary.h ├── ChemCompt.cpp ├── ChemCompt.h ├── CubeMesh.cpp ├── CubeMesh.h ├── CylBase.cpp ├── CylBase.h ├── CylMesh.cpp ├── CylMesh.h ├── EndoMesh.cpp ├── EndoMesh.h ├── MeshCompt.cpp ├── MeshCompt.h ├── MeshEntry.cpp ├── MeshEntry.h ├── NeuroMesh.cpp ├── NeuroMesh.h ├── NeuroNode.cpp ├── NeuroNode.h ├── PresynMesh.cpp ├── PresynMesh.h ├── PsdMesh.cpp ├── PsdMesh.h ├── SpineEntry.cpp ├── SpineEntry.h ├── SpineMesh.cpp ├── SpineMesh.h ├── Stencil.cpp ├── Stencil.h ├── VoxelJunction.h ├── meson.build ├── origMakefile ├── testMesh.cpp └── testPresynMesh.py ├── meson.build ├── meson_options.txt ├── mpi ├── PostMaster.cpp ├── PostMaster.h ├── meson.build └── testMpi.cpp ├── msg ├── DiagonalMsg.cpp ├── DiagonalMsg.h ├── Msg.cpp ├── Msg.h ├── OneToAllMsg.cpp ├── OneToAllMsg.h ├── OneToOneDataIndexMsg.cpp ├── OneToOneDataIndexMsg.h ├── OneToOneMsg.cpp ├── OneToOneMsg.h ├── SingleMsg.cpp ├── SingleMsg.h ├── SparseMsg.cpp ├── SparseMsg.h ├── meson.build └── testMsg.cpp ├── pybind11 ├── Finfo.cpp ├── Finfo.h ├── MooseVec.cpp ├── MooseVec.h ├── PyRun.cpp ├── PyRun.h ├── helper.cpp ├── helper.h ├── meson.build ├── pymoose.cpp └── pymoose.h ├── pymoose ├── PyRun.cpp ├── PyRun.h ├── __init__.py ├── melement.cpp ├── mfield.cpp ├── moose.py ├── moosemodule.cpp ├── moosemodule.h ├── pymooseinit.cpp ├── test_moosemodule.cpp └── vec.cpp ├── pyproject.toml ├── python ├── moose │ ├── SBML │ │ ├── __init__.py │ │ ├── readSBML.py │ │ ├── validation.py │ │ └── writeSBML.py │ ├── __init__.py │ ├── chemMerge │ │ ├── __init__.py │ │ ├── merge.py │ │ └── mtypes.py │ ├── chemUtil │ │ ├── __init__.py │ │ ├── add_Delete_ChemicalSolver.py │ │ ├── chemConnectUtil.py │ │ ├── graphUtils.py │ │ └── rainbow2.pkl │ ├── constants.py │ ├── fixXreacs.py │ ├── genesis │ │ ├── __init__.py │ │ └── writeKkit.py │ ├── hdfutil.py │ ├── helper.py │ ├── methods_utils.py │ ├── model_utils.py │ ├── moose_constants.py │ ├── moose_legacy.py │ ├── network_utils.py │ ├── neuroml │ │ ├── ChannelML.py │ │ ├── MorphML.py │ │ ├── NetworkML.py │ │ ├── NeuroML.py │ │ ├── __init__.py │ │ └── utils.py │ ├── neuroml2 │ │ ├── README │ │ ├── __init__.py │ │ ├── hhfit.py │ │ ├── reader.py │ │ ├── run_cell.py │ │ ├── run_hhcell.py │ │ ├── schema │ │ │ └── NeuroMLCoreDimensions.xml │ │ ├── test_files │ │ │ ├── LEMS_hhCell.xml │ │ │ ├── LEMS_passiveCell.xml │ │ │ ├── NML2_FullCell.nml │ │ │ ├── NML2_SingleCompHHCell.nml │ │ │ ├── Purk2M9s.nml │ │ │ ├── SimpleIonChannel.xml │ │ │ └── passiveCell.nml │ │ ├── test_granule98.py │ │ ├── test_reader.py │ │ ├── test_reader2.py │ │ ├── test_reader3.py │ │ ├── test_reader4.py │ │ └── units.py │ ├── optimizer_interface.py │ ├── plot_utils.py │ ├── print_utils.py │ ├── recording.py │ ├── server.py │ ├── streamer_utils.py │ ├── tests.py │ └── utils.py └── rdesigneur │ ├── .gitignore │ ├── __init__.py │ ├── cells │ ├── 970529c.CNG.swc │ ├── CA1.morph.xml │ ├── DHC-neuron.CNG.swc │ ├── VHC-neuron.CNG.swc │ ├── barrionuevo_cell1zr.CNG.swc │ ├── ca1_minimal.p │ └── h10.CNG.swc │ ├── chans │ ├── CA1.morph.xml │ ├── Ca.xml │ ├── CaConc.xml │ ├── DoubExpSyn.xml │ ├── Generated.net.xml │ ├── Glu.xml │ ├── HChannel.xml │ ├── NMDA.xml │ ├── hd.xml │ ├── kad.xml │ ├── kap.xml │ ├── kdr.xml │ ├── na3.xml │ ├── nax.xml │ └── pas.xml │ ├── moogul.py │ ├── nsdfview.py │ ├── rdesigneur.py │ ├── rdesigneurProtos.py │ └── rmoogli.py ├── randnum ├── Definitions.h ├── Distributions.h ├── NormalDistribution.hpp ├── RNG.cpp ├── RNG.h ├── meson.build ├── randnum.cpp ├── randnum.h └── test_normal_dist.cpp ├── scheduling ├── Clock.cpp ├── Clock.h ├── meson.build ├── testScheduling.cpp └── testScheduling.h ├── shell ├── LoadModels.cpp ├── LoadModels.h ├── Neutral.cpp ├── Neutral.h ├── SaveModels.cpp ├── Shell.cpp ├── Shell.h ├── ShellCopy.cpp ├── ShellThreads.cpp ├── Wildcard.cpp ├── Wildcard.h ├── meson.build └── testShell.cpp ├── signeur ├── Adaptor.cpp ├── Adaptor.h ├── meson.build └── testSigNeur.cpp ├── synapse ├── GraupnerBrunel2012CaPlasticitySynHandler.cpp ├── GraupnerBrunel2012CaPlasticitySynHandler.h ├── RollingMatrix.cpp ├── RollingMatrix.h ├── STDPSynHandler.cpp ├── STDPSynHandler.h ├── STDPSynapse.cpp ├── STDPSynapse.h ├── SeqSynHandler.cpp ├── SeqSynHandler.h ├── SimpleSynHandler.cpp ├── SimpleSynHandler.h ├── SynEvent.h ├── SynHandlerBase.cpp ├── SynHandlerBase.h ├── Synapse.cpp ├── Synapse.h ├── meson.build └── testSynapse.cpp ├── tests ├── benchmarks │ ├── load_module.py │ └── micro_benchmark.sh ├── core │ ├── OSC_diff_vols.g │ ├── benchmark.py │ ├── chan_proto.py │ ├── ephys.py │ ├── models.py │ ├── param_chan.py │ ├── params.py │ ├── run_mumble.sh │ ├── soma.p │ ├── streamer.py │ ├── test_GraupnerBrunel2012_STDPfromCaPlasticity.py │ ├── test_Xchan1.py │ ├── test_Xdiff1.py │ ├── test_Xenz1.py │ ├── test_Xreacs2.py │ ├── test_Xreacs3.py │ ├── test_Xreacs4.py │ ├── test_Xreacs4a.py │ ├── test_Xreacs5.py │ ├── test_Xreacs5a.py │ ├── test_Xreacs6.py │ ├── test_Xreacs7.py │ ├── test_Xreacs8.py │ ├── test_accessing_existing_paths.py │ ├── test_api.py │ ├── test_connectionLists.py │ ├── test_cylinder_diffusion_gsolve+dsolve.py │ ├── test_difshells.py │ ├── test_doctests.py │ ├── test_dose_response.py │ ├── test_expr_parser.py │ ├── test_function.py │ ├── test_function_change_expr.py │ ├── test_function_chemsys.py │ ├── test_function_controls_reac_rate.py │ ├── test_function_example.py │ ├── test_gsolve_parallel.py │ ├── test_hhchan.py │ ├── test_hhchanf.py │ ├── test_hsolve_externalCalcium.py │ ├── test_kkit.py │ ├── test_ksolve.py │ ├── test_ksolve_parallel.py │ ├── test_metaclass.py │ ├── test_moose_attribs.py │ ├── test_moose_paths.py │ ├── test_negative_value_flag.py │ ├── test_pyrun.py │ ├── test_random_gen.sh │ ├── test_random_num.py │ ├── test_rdesigneur.py │ ├── test_rdesigneur_random_syn_input.py │ ├── test_steady_state_solver.py │ ├── test_streamer.py │ ├── test_suit1.py │ ├── test_switch_solvers.py │ ├── test_synapse.py │ ├── test_synchan.py │ ├── test_table_streaming_support.py │ └── test_vec.py ├── data │ ├── 00001-sbml-l3v1.xml │ ├── 19085.cspace │ ├── 85-LM-HiDe.CNG.swc │ ├── Anno_acc2.g │ ├── acc11.g │ ├── acc94.g │ ├── c_m.xml │ ├── h10.CNG.swc │ ├── kkit_objects_example.g │ ├── mkp1_feedback_effects_acc4.g │ ├── mkp1_feedback_effects_acc4.xml │ ├── prot_wt.xml │ └── reaction.g ├── profiling │ └── profile.py ├── pytest.ini ├── rdesigneur │ ├── Na_Chan_Migliore2018_.py │ ├── chem │ │ ├── CICRspineDend.g │ │ ├── CICRwithConcChan.g │ │ ├── chanPhosph3compt.g │ │ ├── chanPhosphByCaMKII.g │ │ ├── psd52.g │ │ └── psd53_old.g │ ├── test_1_minimalModel.py │ ├── test_20_currentPulse.py │ ├── test_21_vclamp.py │ ├── test_30_squid_currentPulse.py │ ├── test_32_squid_axon_propgn.py │ ├── test_41_ballAndStick.py │ ├── test_51_periodic_syn_input.py │ ├── test_6_chem_osc.py │ ├── test_72_CICR.py │ ├── test_74_travelling_osc.py │ ├── test_76_func_func_control_reac_rates.py │ └── test_rdes_with_func_proto.py ├── requirements.txt └── support │ ├── _neuroml │ ├── CA1.net.xml │ ├── CA1.py │ ├── CA1_hsolve.py │ ├── CA1inhomog.net.xml │ ├── CA1soma.net.xml │ ├── FvsI_CA1.py │ ├── README │ ├── __init__.py │ ├── cells_channels │ │ ├── CA1soma.morph.xml │ │ ├── Gran_KDr_98.xml │ │ ├── Gran_NaF_98.xml │ │ ├── Purkinje_KA.xml │ │ ├── README │ │ ├── hd.xml │ │ ├── hd_minus73.xml │ │ ├── kad.xml │ │ ├── kap.xml │ │ ├── kdr.xml │ │ ├── na3.xml │ │ ├── nax.xml │ │ └── pas.xml │ └── count.py │ ├── test_hhfit.py │ ├── test_kkit.py │ ├── test_neuroml.py │ ├── test_neuroml2.py │ ├── test_nsdf.py │ └── test_sbml.py └── utility ├── Annotator.cpp ├── Annotator.h ├── Vec.cpp ├── Vec.h ├── boost_ode.h ├── cnpy.cpp ├── cnpy.hpp ├── current_function.hpp ├── matrix_util.h ├── meson.build ├── numutil.cpp ├── numutil.h ├── print_function.hpp ├── setupenv.cpp ├── simple_assert.hpp ├── simple_logger.hpp ├── simple_test.hpp ├── strutil.cpp ├── strutil.h ├── test_cnpy.cpp ├── test_util.cpp ├── testing_macros.hpp ├── types.cpp ├── utility.cpp └── utility.h /.ci/Dockerfile: -------------------------------------------------------------------------------- 1 | # Run this script from top directory 2 | # docker build . --file .ci/Dockerfile --tag bhallalab/build-wheels:$(date +%s) 3 | FROM bhallalab/python-wheels:latest 4 | MAINTAINER Dilawar Singh 5 | WORKDIR /root 6 | COPY . /root/moose-core/ 7 | # RUN ./build_wheels.sh 8 | CMD [ "./build_wheels.sh" ] 9 | -------------------------------------------------------------------------------- /.ci/coverage.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | python3 -m trace --count \ 3 | --ignore-dir=/usr/lib64 \ 4 | --ignore-module=libsbml \ 5 | --ignore-module=numpy \ 6 | --ignore-module=neuroml \ 7 | "$@" 8 | 9 | -------------------------------------------------------------------------------- /.ci/deploy_pypi.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash - 2 | #=============================================================================== 3 | # 4 | # FILE: deploy_pypi.sh 5 | # 6 | # USAGE: ./deploy_pypi.sh 7 | # 8 | # DESCRIPTION: Build docker image and deploy on PyPI. 9 | # 10 | # OPTIONS: --- 11 | # REQUIREMENTS: --- 12 | # BUGS: --- 13 | # NOTES: --- 14 | # AUTHOR: Dilawar Singh (), dilawars@ncbs.res.in 15 | # ORGANIZATION: NCBS Bangalore 16 | # CREATED: Sunday 04 February 2018 11:46:32 IST 17 | # REVISION: --- 18 | #=============================================================================== 19 | set -o nounset # Treat unset variables as an error 20 | 21 | git clone https://github.com/BhallaLab/pymoose-wheels 22 | cd pymoose-wheels && docker build -t bhallalab/wheels . 23 | -------------------------------------------------------------------------------- /.ci/run_pylint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | python3 -m pip install pylint --user 4 | PYLINT="python3 -m pylint -E \ 5 | --disable=no-member --disable=no-name-in-module \ 6 | --disable=invalid-unary-operand-type \ 7 | --disable=import-error \ 8 | " 9 | function do_pylint() { 10 | echo "Checking $1" 11 | DIR=$(dirname $1) 12 | SNAME=$(basename $1) 13 | ( 14 | cd $DIR 15 | $PYLINT $@ $SNAME 16 | ) 17 | } 18 | 19 | FILES=$(find . -type f -name "*.py" | shuf) 20 | N=4 21 | i=0 22 | for f in $FILES; do 23 | #i=$((i+1)) 24 | #if [ $i -eq $N ]; then 25 | # i=0 26 | # wait; 27 | #fi 28 | # do_pylint "$f" 29 | echo "Checking $f" 30 | DIR=$(dirname $f) 31 | SNAME=$(basename $f) 32 | ( 33 | cd $DIR 34 | $PYLINT $@ $SNAME 35 | ) 36 | done 37 | -------------------------------------------------------------------------------- /.ci/travis_build_osx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash - 2 | #=============================================================================== 3 | # 4 | # FILE: travis_build_linux.sh 5 | # 6 | # USAGE: ./travis_build_linux.sh 7 | # 8 | # DESCRIPTION: Build on linux environment. 9 | # 10 | # OPTIONS: --- 11 | # REQUIREMENTS: --- 12 | # BUGS: --- 13 | # NOTES: --- 14 | # AUTHOR: Dilawar Singh (), dilawars@ncbs.res.in 15 | # ORGANIZATION: NCBS Bangalore 16 | # CREATED: 01/02/2017 10:11:46 AM 17 | # REVISION: --- 18 | #=============================================================================== 19 | 20 | set -o nounset # Treat unset variables as an error 21 | set -e 22 | 23 | BUILDDIR=_build_travis 24 | 25 | NPROC=$(nproc) 26 | ( 27 | # Make sure not to pick up python from /opt. 28 | PATH=/usr/local/bin:/usr/bin:$PATH 29 | 30 | PYTHON3=$(which python3) 31 | 32 | # Get pylint 33 | $PYTHON3 -m pip install pylint --user 34 | $PYTHON3 -m pip install python-libsbml --user 35 | $PYTHON3 -m pip install pyneuroml --user 36 | 37 | mkdir -p $BUILDDIR && cd $BUILDDIR \ 38 | && cmake -DPYTHON_EXECUTABLE=$PYTHON3 \ 39 | .. 40 | make pylint -j$NPROC 41 | make -j$NPROC && MOOSE_NUM_THREAD=$NPROC ctest --output-on-failure -j$NPROC 42 | 43 | cd .. # Now with boost. 44 | mkdir -p $BUILDDIR && cd $BUILDDIR \ 45 | && cmake -DWITH_BOOST_ODE=ON \ 46 | -DPYTHON_EXECUTABLE=`which python3` .. 47 | 48 | make -j$NPROC && MOOSE_NUM_THREAD=$NPROC ctest -j$NPROC --output-on-failure 49 | ) 50 | set +e 51 | -------------------------------------------------------------------------------- /.ci/travis_prepare_linux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash - 2 | # 3 | # DESCRIPTION: Prepare linux build environment on travis. 4 | # NOTES: Always run with sudo permission. 5 | # AUTHOR: Dilawar Singh (), dilawars@ncbs.res.in 6 | # ORGANIZATION: NCBS Bangalore 7 | # CREATED: 01/02/2017 10:10:02 AM 8 | 9 | set -e -x 10 | apt update 11 | apt-get install -qq libxml2-dev libbz2-dev 12 | apt-get install -qq make cmake 13 | apt-get install -qq python-numpy python-matplotlib python-networkx python-pip 14 | apt-get install -qq python3-numpy python3-matplotlib python3-networkx python3-pip 15 | apt-get install -qq python-tk python3-tk 16 | apt-get install -qq valgrind 17 | 18 | # Gsl 19 | apt-get install -qq libgsl0-dev || apt-get install -qq libgsl-dev 20 | 21 | # Boost related. 22 | apt-get install -qq liblapack-dev 23 | apt-get install -qq libboost-all-dev 24 | 25 | # Dependencies for NML2 26 | apt-get install -qq python-scipy python3-scipy 27 | apt-get install -qq python-lxml python3-lxml 28 | apt-get install -qq python-setuptools python3-setuptools 29 | 30 | # Install twine 31 | python3 -m pip install twine 32 | -------------------------------------------------------------------------------- /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | AccessModifierOffset: -4 3 | SortIncludes: false 4 | ConstructorInitializerIndentWidth: 4 5 | AlignEscapedNewlinesLeft: true 6 | AlignTrailingComments: true 7 | AllowAllParametersOfDeclarationOnNextLine: false 8 | AllowShortFunctionsOnASingleLine: false 9 | AllowShortIfStatementsOnASingleLine: false 10 | AllowShortLoopsOnASingleLine: false 11 | AlwaysBreakTemplateDeclarations: true 12 | AlwaysBreakBeforeMultilineStrings: true 13 | BreakBeforeBinaryOperators: false 14 | BreakBeforeTernaryOperators: true 15 | BreakConstructorInitializersBeforeComma: false 16 | BinPackParameters: true 17 | ColumnLimit: 80 18 | ConstructorInitializerAllOnOneLineOrOnePerLine: true 19 | DerivePointerBinding: true 20 | ExperimentalAutoDetectBinPacking: false 21 | IndentCaseLabels: true 22 | MaxEmptyLinesToKeep: 1 23 | NamespaceIndentation: None 24 | ObjCSpaceBeforeProtocolList: false 25 | PenaltyBreakBeforeFirstCallParameter: 1 26 | PenaltyBreakComment: 60 27 | PenaltyBreakString: 1000 28 | PenaltyBreakFirstLessLess: 120 29 | PenaltyExcessCharacter: 1000000 30 | PenaltyReturnTypeOnItsOwnLine: 200 31 | PointerBindsToType: true 32 | SpacesBeforeTrailingComments: 2 33 | Cpp11BracedListStyle: true 34 | IndentWidth: 4 35 | TabWidth: 4 36 | UseTab: Never 37 | BreakBeforeBraces: Stroustrup 38 | IndentFunctionDeclarationAfterType: true 39 | SpacesInParentheses: false 40 | SpacesInAngles: false 41 | SpaceInEmptyParentheses: false 42 | SpacesInCStyleCastParentheses: false 43 | SpaceAfterControlStatementKeyword: false 44 | SpaceBeforeAssignmentOperators: true 45 | ContinuationIndentWidth: 4 46 | Standard : C++11 47 | ... 48 | 49 | -------------------------------------------------------------------------------- /.github/main.workflow: -------------------------------------------------------------------------------- 1 | workflow "build pymoose" { 2 | resolves = "build" 3 | on = "push" 4 | } 5 | 6 | action "build" { 7 | uses = "./" 8 | args = "install" 9 | env = { 10 | CMAKE_GIT_REPO = "https://github.com/dilawar/moose-core", 11 | CMAKE_INSTALL_DEPS_SCRIPT = ".travis/travis_prepare_linux.sh", 12 | CMAKE_FLAGS = "-DCMAKE_INSTALL_PREFIX:PATH=/tmp/foo", 13 | CMAKE_BUILD_THREADS = "4" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | # This file is a template, and might need editing before it works on your project. 2 | # use the official gcc image, based on debian 3 | # can use verions as well, like gcc:5.2 4 | # see https://hub.docker.com/_/gcc/ 5 | image: gcc 6 | 7 | build: 8 | stage: build 9 | # instead of calling g++ directly you can also use some build toolkit like make 10 | # install the necessary build tools when needed 11 | before_script: 12 | - apt update && apt -y install cmake git libgsl-dev 13 | - apt -y install python3-numpy python3-matplotlib python3-pip python3-dev 14 | - apt -y install python-numpy python-matplotlib python-pip python-dev 15 | script: 16 | - python3 -m pip install setuptools pip --user --upgrade 17 | - python3 -m pip install python-libsbml --user --upgrade 18 | - python3 -m pip install pyneuroml --user --upgrade 19 | - python3 -m pip install sympy scipy --user --upgrade 20 | - python3 -m pip install pytest --user --upgrade 21 | - python3 setup.py build test 22 | - python3 setup.py install --user 23 | - python3 -c "import moose.tests; moose.tests.test()" 24 | 25 | except: 26 | - pybind11 27 | - devel 28 | 29 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/pre-commit/pre-commit-hooks 3 | sha: v1.2.1 4 | hooks: 5 | - id: check-added-large-files 6 | - id: check-ast 7 | - id: check-merge-conflict 8 | - id: check-case-conflict 9 | - id: check-docstring-first 10 | - id: debug-statements 11 | - id: fix-encoding-pragma 12 | - id: trailing-whitespace 13 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: cpp 2 | sudo: required 3 | 4 | matrix: 5 | include: 6 | - os: linux 7 | dist: bionic 8 | services: 9 | - xvfb 10 | - os: osx 11 | osx_image: 12 | - xcode11.3 13 | 14 | notifications: 15 | email: 16 | recipients: 17 | - bhalla@ncbs.res.in 18 | - dilawar.s.rajput@gmail.com 19 | - hrani@ncbs.res.in 20 | on_success: change 21 | on_failure: always 22 | 23 | addons: 24 | apt: 25 | update: true 26 | 27 | 28 | before_script: 29 | - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then nvm get head || true; fi 30 | - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./.ci/travis_prepare_osx.sh; fi 31 | - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo ./.ci/travis_prepare_linux.sh; fi 32 | 33 | script: 34 | - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./.ci/travis_build_osx.sh; fi 35 | - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./.ci/travis_build_linux.sh; fi 36 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | # Active developers 2 | 3 | Upinder S. Bhalla Primary Architect, rdesigneur 4 | HarshaRani. G.V MOOSE Website, SBML support, GUI 5 | Subhasis Ray Lead Developer, Python interface, Packaging, Maintenance 6 | 7 | # Past developers 8 | 9 | Dilawar Singh Multithreading, GSoC, Packaging, Maintenance, BOOST solvers 10 | Niraj Dudani Neuronal solver 11 | Aditya Gilra NeuroML support 12 | Aviral Goel Moogli 13 | 14 | # Contributors 15 | 16 | Padraid Gleeson NeuroML2 support 17 | Dharma Teja GPU parallelization using CUDA 18 | -------------------------------------------------------------------------------- /AppleM1Build.md: -------------------------------------------------------------------------------- 1 | # Building MOOSE on MacOS with Apple M1 CPU 2 | - Install homebrew: https://brew.sh/ 3 | - Set up required development environment 4 | - Install command line tools for XCode 5 | - Install build dependencies by running these commands in a terminal 6 | ``` 7 | brew install gsl 8 | ``` 9 | 10 | - Install anaconda/miniconda/micromamba/miniforge. For example, for micromamba, run 11 | ``` 12 | "${SHELL}" <(curl -L micro.mamba.pm/install.sh) 13 | ``` 14 | 15 | in command line 16 | - Update micromamba: `micromamba self-update` 17 | - Restart terminal and create an environment with necessary packages: 18 | 19 | ``` 20 | micromamba create -n moose numpy matplotlib vpython lxml meson ninja meson-python gsl setuptools pybind11[global] pkg-config -c conda-forge 21 | ``` 22 | - Activate the moose environment: `micromamba activate moose` 23 | - Install moose from github: `pip install git+https://github.com/BhallaLab/moose-core.git` 24 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | We use the `fork-and-pull` workflow for moose development. 2 | 3 | To contribute: 4 | 1. Fork this repo on github 5 | 2. Make the changes you want to contribute 6 | 3. Check that moose builds locally on your version 7 | 4. Check all tests pass `ctest --output-on-failure` passes all tests (TODO: cleanup/fix/update the tests) 8 | 5. Submit your changes via a pull-request. 9 | 10 | After this the repository admin will check your pull request and merge it to the main branch. 11 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include AUTHORS 2 | include CMakeLists.txt 3 | include CONTRIBUTING.md 4 | include INSTALL.md 5 | include LICENSE 6 | include MANIFEST.in 7 | include README.md 8 | include cmake_moose_cpack.cmake 9 | include cmake_uninstall.cmake.in 10 | recursive-include basecode * 11 | recursive-include benchmarks * 12 | recursive-include biophysics * 13 | recursive-include builtins * 14 | recursive-include cmake * 15 | recursive-include device * 16 | recursive-include diffusion * 17 | recursive-include dist * 18 | recursive-include examples * 19 | recursive-include external * 20 | recursive-include hsolve * 21 | recursive-include intfire * 22 | recursive-include kinetics * 23 | recursive-include ksolve * 24 | recursive-include mesh * 25 | recursive-include mpi * 26 | recursive-include msg * 27 | recursive-include pymoose * 28 | recursive-include python * 29 | recursive-include randnum * 30 | recursive-include scheduling * 31 | recursive-include shell * 32 | recursive-include signeur * 33 | recursive-include synapse * 34 | recursive-include tests * 35 | recursive-include utility * 36 | recursive-include pybind11 * 37 | recursive-include devel * 38 | -------------------------------------------------------------------------------- /WSLGuide.md: -------------------------------------------------------------------------------- 1 | # On WSL or git bash 2 | 3 | - If not already setup, open PowerShell and install it: 4 | ``` 5 | wsl --install 6 | ``` 7 | 8 | - The above will install Ubuntu. Now open the terminal on WSL/Ubuntu and install `g++` and `make` 9 | ``` 10 | sudo apt-get install g++ 11 | sudo apt-get install make 12 | sudo apt-get install qtbase5-dev 13 | sudo apt install firefox 14 | ``` 15 | 16 | - Install micromamba: 17 | 18 | https://mamba.readthedocs.io/en/latest/installation/micromamba-installation.html 19 | 20 | ``` 21 | "${SHELL}" <(curl -L micro.mamba.pm/install.sh) 22 | ``` 23 | 24 | - Update micromamba 25 | 26 | ``` 27 | micromamba self-update 28 | ``` 29 | 30 | - Create environment with various required packages 31 | 32 | ``` 33 | micromamba create -n moose pip h5py numpy vpython scipy matplotlib gsl hdf5 jupyter pyqt cmake pybind11[global] jupyterlab-vpython 34 | ``` 35 | 36 | - Activate the environment 37 | 38 | ``` 39 | micromamba activate moose 40 | ``` 41 | 42 | - Build and install pymoose 43 | 44 | ``` 45 | pip install git+https://github.com/BhallaLab/moose-core.git 46 | ``` 47 | 48 | You need to do the above only once. After that, each time to use moose, open WSL Ubuntu terminal and do the following 49 | 50 | ``` 51 | micromamba activate moose 52 | ``` 53 | 54 | and you are ready to start running moose scripts. 55 | 56 | 57 | NOTE: When running moose examples that use vpython for 3D visualization, you may run into a message like `"gio: http://localhost:39143: Operation not supported` and nothing much happens. To see the visualization, start `firefox` (or any other browser you installed on WSL) from another WSL terminal and enter the web address (http://localhost:39143 in this case) in its address bar. 58 | -------------------------------------------------------------------------------- /basecode/DestFinfo.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment. 4 | ** Copyright (C) 2003-2010 Upinder S. Bhalla. and NCBS 5 | ** It is made available under the terms of the 6 | ** GNU Lesser General Public License version 2.1 7 | ** See the file COPYING.LIB for the full notice. 8 | **********************************************************************/ 9 | #ifndef _DEST_FINFO_H 10 | #define _DEST_FINFO_H 11 | 12 | /* 13 | * DestFinfo manages function requests. All messages terminate on 14 | * the functions stored in DestFinfos. No templates here, as all the 15 | * type-specific work is done by the OpFunc. 16 | */ 17 | class DestFinfo : public Finfo { 18 | public: 19 | ~DestFinfo(); 20 | DestFinfo(const string& name, const string& doc, OpFunc* func); 21 | void registerFinfo(Cinfo* c); 22 | bool strSet(const Eref& tgt, const string& field, const string& arg) const; 23 | bool strGet(const Eref& tgt, const string& field, 24 | string& returnValue) const; 25 | 26 | const OpFunc* getOpFunc() const; 27 | FuncId getFid() const; 28 | 29 | /////////////////////////////////////////////////////////////// 30 | // Override the default virtual function for the rtti info 31 | /////////////////////////////////////////////////////////////// 32 | 33 | string rttiType() const; 34 | 35 | private: 36 | OpFunc* func_; 37 | FuncId fid_; 38 | }; 39 | 40 | #endif // _DEST_FINFO_H 41 | -------------------------------------------------------------------------------- /basecode/EpFunc.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment. 4 | ** Copyright (C) 2003-2013 Upinder S. Bhalla. and NCBS 5 | ** It is made available under the terms of the 6 | ** GNU Lesser General Public License version 2.1 7 | ** See the file COPYING.LIB for the full notice. 8 | **********************************************************************/ 9 | 10 | #include "header.h" 11 | #include "../shell/Shell.h" 12 | 13 | template<> Neutral* getEpFuncData< Neutral >( const Eref& e ) 14 | { 15 | static Neutral dummy; 16 | return &dummy; 17 | } 18 | -------------------------------------------------------------------------------- /basecode/FieldElementFinfo.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment. 4 | ** Copyright (C) 2003-2010 Upinder S. Bhalla. and NCBS 5 | ** It is made available under the terms of the 6 | ** GNU Lesser General Public License version 2.1 7 | ** See the file COPYING.LIB for the full notice. 8 | **********************************************************************/ 9 | 10 | #include "header.h" 11 | #include "../shell/Shell.h" 12 | #include "../msg/OneToOneDataIndexMsg.h" 13 | 14 | void FieldElementFinfoBase::postCreationFunc( Id parent, Element* parentElm ) const 15 | { 16 | static const Finfo* pf = Neutral::initCinfo()->findFinfo( "parentMsg" ); 17 | static const Finfo* f1 = Neutral::initCinfo()->findFinfo( "childOut" ); 18 | 19 | if ( deferCreate_ ) 20 | return; 21 | Id kid = Id::nextId(); 22 | Element* e = new FieldElement( parent, kid, fieldCinfo_, name(), this ); 23 | Msg* m = new OneToOneDataIndexMsg( parent.eref(), Eref( e, 0 ), 0 ); 24 | assert( m ); 25 | 26 | if ( !f1->addMsg( pf, m->mid(), parent.element() ) ) 27 | { 28 | cout << "FieldElementFinfoBase::postCreationFunc: Error: \n" << 29 | " unable to add parent->child msg from " << 30 | parent.element()->getName() << " to " << name() << "\n"; 31 | return; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /basecode/FuncOrder.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment. 4 | ** Copyright (C) 2003-2013 Upinder S. Bhalla. and NCBS 5 | ** It is made available under the terms of the 6 | ** GNU Lesser General Public License version 2.1 7 | ** See the file COPYING.LIB for the full notice. 8 | **********************************************************************/ 9 | /** 10 | * Utility function for sorting by function pointer. 11 | * Used in Element::msgDigest 12 | */ 13 | 14 | class FuncOrder 15 | { 16 | public: 17 | FuncOrder() 18 | : func_( 0 ), index_( 0 ) 19 | {;} 20 | 21 | const OpFunc* func() const 22 | { 23 | return func_; 24 | } 25 | unsigned int index() const 26 | { 27 | return index_; 28 | } 29 | 30 | void set( const OpFunc* func, unsigned int index ) 31 | { 32 | func_ = func; 33 | index_ = index; 34 | } 35 | 36 | bool operator<( const FuncOrder& other ) const 37 | { 38 | return func_ < other.func_; 39 | } 40 | private: 41 | const OpFunc* func_; 42 | unsigned int index_; 43 | }; 44 | -------------------------------------------------------------------------------- /basecode/MsgDigest.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment. 4 | ** Copyright (C) 2003-2013 Upinder S. Bhalla. and NCBS 5 | ** It is made available under the terms of the 6 | ** GNU Lesser General Public License version 2.1 7 | ** See the file COPYING.LIB for the full notice. 8 | **********************************************************************/ 9 | 10 | #ifndef _MSG_DIGEST_H 11 | #define _MSG_DIGEST_H 12 | 13 | /** 14 | * This class manages digested Messages. Each entry is boiled down to the 15 | * function, and an array of targets. The targets are actually stored 16 | * on the Msg, but they referenced in the MsgDigest. 17 | * As a further refinement, if the target DataIndex is ALLDATA, then it 18 | * means that all data entries in the target are to be iterated over. Note 19 | * that this does not extend to Field targets. 20 | */ 21 | class MsgDigest 22 | { 23 | public: 24 | MsgDigest( const OpFunc* f, const vector< Eref >& t ) 25 | : func( f ), targets( t ) 26 | {;} 27 | const OpFunc* func; 28 | vector< Eref > targets; 29 | }; 30 | 31 | #endif // _MSG_DIGEST_H 32 | -------------------------------------------------------------------------------- /basecode/MsgFuncBinding.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment. 4 | ** Copyright (C) 2003-2010 Upinder S. Bhalla. and NCBS 5 | ** It is made available under the terms of the 6 | ** GNU Lesser General Public License version 2.1 7 | ** See the file COPYING.LIB for the full notice. 8 | **********************************************************************/ 9 | 10 | /** 11 | * Binds MsgId to FuncIds. 12 | */ 13 | class MsgFuncBinding 14 | { 15 | public: 16 | MsgFuncBinding() 17 | : mid(), fid( 0 ) 18 | {;} 19 | 20 | MsgFuncBinding( ObjId m, FuncId f ) 21 | : mid( m ), fid( f ) 22 | {;} 23 | 24 | bool operator==( const MsgFuncBinding& other ) const { 25 | return ( mid == other.mid && fid == other.fid ); 26 | } 27 | 28 | ObjId mid; 29 | FuncId fid; 30 | 31 | private: 32 | }; 33 | -------------------------------------------------------------------------------- /basecode/ProcInfo.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment. 4 | ** Copyright (C) 2003-2010 Upinder S. Bhalla. and NCBS 5 | ** It is made available under the terms of the 6 | ** GNU Lesser General Public License version 2.1 7 | ** See the file COPYING.LIB for the full notice. 8 | **********************************************************************/ 9 | 10 | #ifndef PROCINFO_INC 11 | #define PROCINFO_INC 12 | class ProcInfo 13 | { 14 | public: 15 | ProcInfo() 16 | : dt( 1.0 ), currTime( 0.0 ), status_( 0 ) 17 | {;} 18 | double dt; 19 | double currTime; 20 | bool isFirstStep() const { return (status_==0x01); }; // first start 21 | bool isStart() const { return (status_ & 0x03); }; // any start call 22 | bool isContinue() const { return (status_ == 0x02); }; // Start call to continue from current nonzero time of simulation 23 | bool isReinit() const { return (status_ == 0x04); }; 24 | void setFirstStep() { status_ = 0x01 ; }; 25 | void setContinue() { status_ = 0x02 ; }; 26 | void setRunning() { status_ = 0x0 ; }; 27 | void setReinit() { status_ = 0x04 ; }; 28 | 29 | private: 30 | unsigned int status_; // bit 0: firstStep. bit 1: continue Bit 2: reinit. 31 | }; 32 | 33 | typedef const ProcInfo* ProcPtr; 34 | #endif /* ----- #ifndef PROCINFO_INC ----- */ 35 | -------------------------------------------------------------------------------- /basecode/SparseMatrix.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment, 4 | ** also known as GENESIS 3 base code. 5 | ** copyright (C) 2003-2006 Upinder S. Bhalla. and NCBS 6 | ** It is made available under the terms of the 7 | ** GNU Lesser General Public License version 2.1 8 | ** See the file COPYING.LIB for the full notice. 9 | **********************************************************************/ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include "SparseMatrix.h" 17 | 18 | using namespace std; 19 | 20 | 21 | const unsigned int SM_MAX_ROWS = 200000; 22 | const unsigned int SM_MAX_COLUMNS = 200000; 23 | const unsigned int SM_RESERVE = 8; 24 | -------------------------------------------------------------------------------- /basecode/ValueFinfo.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment. 4 | ** Copyright (C) 2003-2010 Upinder S. Bhalla. and NCBS 5 | ** It is made available under the terms of the 6 | ** GNU Lesser General Public License version 2.1 7 | ** See the file COPYING.LIB for the full notice. 8 | **********************************************************************/ 9 | 10 | #include "header.h" 11 | 12 | ValueFinfoBase::ValueFinfoBase( const string& name, const string& doc ) 13 | : Finfo( name, doc ), 14 | set_( 0 ), 15 | get_( 0 ) 16 | {;} 17 | 18 | DestFinfo* ValueFinfoBase::getFinfo() const { 19 | return get_; 20 | } 21 | 22 | vector< string > ValueFinfoBase::innerDest() const 23 | { 24 | vector< string > ret; 25 | if ( set_ ) 26 | ret.push_back( set_->name() ); 27 | 28 | assert( get_ ); 29 | ret.push_back( get_->name() ); 30 | 31 | return ret; 32 | } 33 | -------------------------------------------------------------------------------- /basecode/doubleEq.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment. 4 | ** Copyright (C) 2003-2010 Upinder S. Bhalla. and NCBS 5 | ** It is made available under the terms of the 6 | ** GNU Lesser General Public License version 2.1 7 | ** See the file COPYING.LIB for the full notice. 8 | **********************************************************************/ 9 | 10 | #define EPS1 1e-6 11 | #define EPS2 1e-12 12 | #define EPS3 1e-3 13 | 14 | #include 15 | 16 | bool doubleEq( double x, double y ) 17 | { 18 | double denom = fabs( x ) + fabs( y ); 19 | if ( denom < EPS2 ) 20 | denom = EPS1; 21 | return ( fabs( x - y ) / denom ) < EPS1; 22 | } 23 | 24 | bool doubleApprox( double x, double y ) 25 | { 26 | double denom = fabs( x ) + fabs( y ); 27 | if ( denom < EPS1 ) 28 | denom = EPS1; 29 | return ( fabs( x - y ) / denom ) < EPS3; 30 | } 31 | -------------------------------------------------------------------------------- /basecode/doubleEq.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment. 4 | ** Copyright (C) 2003-2010 Upinder S. Bhalla. and NCBS 5 | ** It is made available under the terms of the 6 | ** GNU Lesser General Public License version 2.1 7 | ** See the file COPYING.LIB for the full notice. 8 | **********************************************************************/ 9 | 10 | extern bool doubleEq( double x, double y ); 11 | extern bool doubleApprox( double x, double y ); 12 | -------------------------------------------------------------------------------- /basecode/meson.build: -------------------------------------------------------------------------------- 1 | # Author: Subhasis Ray 2 | # Date: Sun Jul 7 3 | 4 | basecode_src = ['Element.cpp', 5 | 'DataElement.cpp', 6 | 'GlobalDataElement.cpp', 7 | 'LocalDataElement.cpp', 8 | 'Eref.cpp', 9 | 'Finfo.cpp', 10 | 'DestFinfo.cpp', 11 | 'Cinfo.cpp', 12 | 'SrcFinfo.cpp', 13 | 'ValueFinfo.cpp', 14 | 'SharedFinfo.cpp', 15 | 'FieldElementFinfo.cpp', 16 | 'FieldElement.cpp', 17 | 'Id.cpp', 18 | 'ObjId.cpp', 19 | 'global.cpp', 20 | 'SetGet.cpp', 21 | 'OpFuncBase.cpp', 22 | 'EpFunc.cpp', 23 | 'HopFunc.cpp', 24 | 'SparseMatrix.cpp', 25 | 'doubleEq.cpp', 26 | 'testAsync.cpp'] 27 | 28 | basecode_lib = static_library('basecode', basecode_src) 29 | -------------------------------------------------------------------------------- /basecode/testGlobals.cpp: -------------------------------------------------------------------------------- 1 | /*** 2 | * Description: Tests functions in global.h 3 | * 4 | * Created: 2020-04-03 5 | 6 | * Author: Dilawar Singh 7 | * License: MIT License 8 | */ 9 | 10 | #include "global.h" 11 | #include "../utility/simple_assert.hpp" 12 | 13 | 14 | int main(int argc, const char *argv[]) 15 | { 16 | // Add tests here. 17 | // 18 | return 0; 19 | } 20 | 21 | -------------------------------------------------------------------------------- /biophysics/CompartmentDataHolder.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment, 4 | ** also known as GENESIS 3 base code. 5 | ** copyright (C) 2003-2006 Upinder S. Bhalla. and NCBS 6 | ** It is made available under the terms of the 7 | ** GNU Lesser General Public License version 2.1 8 | ** See the file COPYING.LIB for the full notice. 9 | **********************************************************************/ 10 | 11 | #ifndef _COMPARTMENT_DATA_HOLDER_H 12 | #define _COMPARTMENT_DATA_HOLDER_H 13 | 14 | /** 15 | */ 16 | namespace moose 17 | { 18 | 19 | class CompartmentDataHolder 20 | { 21 | public: 22 | CompartmentDataHolder(); 23 | void readData( const CompartmentBase* c, const Eref& e ); 24 | void writeData( CompartmentBase* c, const Eref& e ); 25 | private: 26 | double Cm_; 27 | double Ra_; 28 | double Rm_; 29 | double Em_; 30 | double initVm_; 31 | double inject_; 32 | 33 | double diameter_; 34 | double length_; 35 | double x0_; 36 | double y0_; 37 | double z0_; 38 | double x_; 39 | double y_; 40 | double z_; 41 | }; 42 | 43 | } 44 | 45 | #endif // _COMPARTMENT_DATA_HOLDER_H 46 | -------------------------------------------------------------------------------- /biophysics/MMPump.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Multiscale Object Oriented Simulation Environment. 4 | ** copyright (C) 2003-2008 5 | ** Upinder S. Bhalla, Niraj Dudani and NCBS 6 | ** It is made available under the terms of the 7 | ** GNU Lesser General Public License version 2.1 8 | ** See the file COPYING.LIB for the full notice. 9 | **********************************************************************/ 10 | 11 | #ifndef _MMPUMP_H 12 | #define _MMPUMP_H 13 | /*This is base class for MMPump*/ 14 | class MMPump 15 | { 16 | public: 17 | MMPump(); 18 | void process( const Eref & e, ProcPtr p); 19 | void reinit(const Eref &e, ProcPtr p); 20 | 21 | double getVmax(const Eref& e) const; //Vmax of the pump 22 | void setVmax(const Eref& e,double value); 23 | 24 | int getVal(const Eref& e) const; //Valence 25 | void setVal(const Eref& e,int value); 26 | 27 | double getKd(const Eref& e) const; // Pump's Kd 28 | void setKd(const Eref& e,double value); 29 | 30 | 31 | 32 | static SrcFinfo2< double,double >* PumpOut(); //Pump parameters; 33 | 34 | static const Cinfo * initCinfo(); 35 | 36 | private: 37 | 38 | double Vmax_; 39 | double Kd_; 40 | }; 41 | 42 | 43 | 44 | 45 | #endif //_MMPUMP_BASE_H 46 | -------------------------------------------------------------------------------- /biophysics/ReadSwc.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment. 4 | ** Copyright (C) 2003-2015 Upinder S. Bhalla. and NCBS 5 | ** It is made available under the terms of the 6 | ** GNU Lesser General Public License version 2.1 7 | ** See the file COPYING.LIB for the full notice. 8 | **********************************************************************/ 9 | #ifndef READSWC_H 10 | #define READSWC_H 11 | 12 | /** 13 | * This class is used to read in SWC files as found in 14 | * NeuroMorph.org and other places. Note that these are only passive 15 | * models at this stage. 16 | */ 17 | 18 | class ReadSwc 19 | { 20 | /** 21 | * Each line is of the form 22 | * n T x y z R P 23 | */ 24 | public: 25 | ReadSwc( const string& fname ); 26 | bool validate() const; 27 | void assignKids(); 28 | void cleanZeroLength(); 29 | void parseBranches(); 30 | void traverseBranch( const SwcSegment& s, double &len, double& L, 31 | vector< int >& cable ) const; 32 | bool build( Id parent, 33 | double lambda, double RM, double RA, double CM ); 34 | void diagnostics() const; 35 | 36 | private: 37 | vector< SwcSegment > segs_; 38 | 39 | /** 40 | * branches holds the NeuroMorpho index of the end segment of 41 | * each branch. Note that NeuroMorph index starts from 1. 42 | * To traverse the branch, go to the end segment, and traverse 43 | * through all parents till you get to a fork. 44 | */ 45 | vector< SwcBranch > branches_; 46 | }; 47 | 48 | #endif // READSWC_H 49 | -------------------------------------------------------------------------------- /biophysics/SpikeRingBuffer.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment. 4 | ** Copyright (C) 2003-2013 Upinder S. Bhalla. and NCBS 5 | ** It is made available under the terms of the 6 | ** GNU Lesser General Public License version 2.1 7 | ** See the file COPYING.LIB for the full notice. 8 | **********************************************************************/ 9 | 10 | #ifndef _SPIKE_RING_BUFFER 11 | #define _SPIKE_RING_BUFFER 12 | /** 13 | * This ring buffer handles incoming spikes. It spans an interval equal to 14 | * the longest arrival delay. When a spike event is notified it puts it into 15 | * the slot defined by the arrival time. It just adds the weight onto the 16 | * existing value in this slot, assuming a linear summation of the 17 | * weights of coincident inputs. 18 | */ 19 | class SpikeRingBuffer 20 | { 21 | public: 22 | SpikeRingBuffer(); 23 | 24 | /// Sets up buffer parameters 25 | void reinit( double dt, double bufferTime ); 26 | 27 | /// Adds spike into the buffer. 28 | void addSpike( double timestamp, double weight ); 29 | /// Advances the buffer one step, returns the current weight 30 | double pop( double currTime ); 31 | private: 32 | static const unsigned int MAXBIN; 33 | double dt_; 34 | double currTime_; 35 | unsigned int currentBin_; 36 | vector< double > weightSum_; 37 | }; 38 | #endif // _SPIKE_RING_BUFFER 39 | -------------------------------------------------------------------------------- /builtins/Group.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment. 4 | ** Copyright (C) 2003-2010 Upinder S. Bhalla. and NCBS 5 | ** It is made available under the terms of the 6 | ** GNU Lesser General Public License version 2.1 7 | ** See the file COPYING.LIB for the full notice. 8 | **********************************************************************/ 9 | 10 | #include 11 | #include "../basecode/header.h" 12 | #include "Group.h" 13 | 14 | ////////////////////////////////////////////////////////////// 15 | // MsgSrc Definitions 16 | ////////////////////////////////////////////////////////////// 17 | static SrcFinfo0 *group() { 18 | static SrcFinfo0 group( 19 | "group", 20 | "Handle for grouping Elements" 21 | ); 22 | return &group; 23 | } 24 | 25 | const Cinfo* Group::initCinfo() 26 | { 27 | 28 | static Finfo* groupFinfos[] = { 29 | group(), // Value 30 | }; 31 | 32 | static Dinfo< Group > dinfo; 33 | static Cinfo groupCinfo ( 34 | "Group", 35 | Neutral::initCinfo(), 36 | groupFinfos, 37 | sizeof( groupFinfos ) / sizeof ( Finfo* ), 38 | &dinfo 39 | ); 40 | 41 | return &groupCinfo; 42 | } 43 | 44 | static const Cinfo* groupCinfo = Group::initCinfo(); 45 | 46 | Group::Group() 47 | { 48 | ; 49 | } 50 | -------------------------------------------------------------------------------- /builtins/Group.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment. 4 | ** Copyright (C) 2003-2010 Upinder S. Bhalla. and NCBS 5 | ** It is made available under the terms of the 6 | ** GNU Lesser General Public License version 2.1 7 | ** See the file COPYING.LIB for the full notice. 8 | **********************************************************************/ 9 | #ifndef _GROUP_H 10 | #define _GROUP_H 11 | 12 | class Group 13 | { 14 | public: 15 | Group(); 16 | static const Cinfo* initCinfo(); 17 | private: 18 | }; 19 | 20 | #endif // _GROUP_H 21 | -------------------------------------------------------------------------------- /builtins/Mstring.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment. 4 | ** Copyright (C) 2003-2010 Upinder S. Bhalla. and NCBS 5 | ** It is made available under the terms of the 6 | ** GNU Lesser General Public License version 2.1 7 | ** See the file COPYING.LIB for the full notice. 8 | **********************************************************************/ 9 | #ifndef _M_STRING_H 10 | #define _M_STRING_H 11 | 12 | class Mstring { 13 | public: 14 | Mstring(); 15 | Mstring(string other); 16 | 17 | //////////////////////////////////////////////////////////////// 18 | // Field assignment stuff. 19 | //////////////////////////////////////////////////////////////// 20 | 21 | void setThis(string v); 22 | string getThis() const; 23 | 24 | //////////////////////////////////////////////////////////////// 25 | // Utility stuff 26 | //////////////////////////////////////////////////////////////// 27 | // const Mstring& operator=( const Mstring& other ); 28 | // string operator=( const Mstring& other ); 29 | // string operator=( const string& other ); 30 | 31 | //////////////////////////////////////////////////////////////// 32 | 33 | static const Cinfo* initCinfo(); 34 | 35 | private: 36 | string value_; 37 | }; 38 | 39 | #endif // _M_STRING_H 40 | -------------------------------------------------------------------------------- /builtins/SpikeStats.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment. 4 | ** Copyright (C) 2003-2011 Upinder S. Bhalla. and NCBS 5 | ** It is made available under the terms of the 6 | ** GNU Lesser General Public License version 2.1 7 | ** See the file COPYING.LIB for the full notice. 8 | **********************************************************************/ 9 | #ifndef _SPIKE_STATS_H 10 | #define _SPIKE_STATS_H 11 | 12 | class SpikeStats: public Stats 13 | { 14 | public: 15 | SpikeStats(); 16 | 17 | /** 18 | * Inserts an event into the pendingEvents queue for spikes. 19 | */ 20 | void addSpike( DataId synIndex, const double time ); 21 | 22 | //////////////////////////////////////////////////////////////// 23 | // Field assignment stuff. 24 | //////////////////////////////////////////////////////////////// 25 | 26 | void setThreshold( double thresh ); 27 | double getThreshold() const; 28 | 29 | //////////////////////////////////////////////////////////////// 30 | // Dest Func 31 | //////////////////////////////////////////////////////////////// 32 | void addSpike( double v ); 33 | void Vm( double v ); 34 | 35 | /// Virtual func for handling process calls. 36 | void vProcess( const Eref& e, ProcPtr p ); 37 | void vReinit( const Eref& e, ProcPtr p ); 38 | 39 | //////////////////////////////////////////////////////////////// 40 | static const Cinfo* initCinfo(); 41 | private: 42 | unsigned int numSpikes_; 43 | double threshold_; 44 | bool fired_; 45 | }; 46 | 47 | #endif // _SPIKE_STATS_H 48 | -------------------------------------------------------------------------------- /builtins/Variable.cpp: -------------------------------------------------------------------------------- 1 | // Description: 2 | // Author: Subhasis Ray 3 | // Maintainer: Dilawar Singh 4 | // Created: Fri May 30 19:56:06 2014 (+0530) 5 | 6 | #include "../basecode/header.h" 7 | #include "MooseParser.h" 8 | #include "Variable.h" 9 | #include "Function.h" 10 | 11 | const Cinfo * Variable::initCinfo() 12 | { 13 | static ValueFinfo< Variable, double > value( 14 | "value", 15 | "Variable value", 16 | &Variable::setValue, 17 | &Variable::getValue 18 | ); 19 | 20 | static DestFinfo input( 21 | "input", 22 | "Handles incoming variable value.", 23 | new EpFunc1< Variable, double >( &Variable::setValue ) 24 | ); 25 | 26 | static Finfo * variableFinfos[] = 27 | { 28 | &value, 29 | &input 30 | }; 31 | 32 | static string doc[] = { 33 | "Name", "Variable", 34 | "Author", "Subhasis Ray", 35 | "Description", "Variable for storing double values. This is used in Function class." 36 | }; 37 | 38 | static Dinfo< Variable > dinfo; 39 | 40 | static Cinfo variableCinfo("Variable", 41 | Neutral::initCinfo(), 42 | variableFinfos, 43 | sizeof(variableFinfos) / sizeof(Finfo*), 44 | &dinfo, 45 | doc, 46 | sizeof(doc) / sizeof(string), 47 | true // is FieldElement, not to be created directly 48 | ); 49 | 50 | return & variableCinfo; 51 | } 52 | 53 | static const Cinfo * variableCinfo = Variable::initCinfo(); 54 | -------------------------------------------------------------------------------- /builtins/Variable.h: -------------------------------------------------------------------------------- 1 | // Variable.h --- 2 | // Filename: Variable.h 3 | // Description: 4 | // Author: Subhasis Ray 5 | // Maintainer: Dilawar Singh 6 | // Created: Fri May 30 19:37:24 2014 (+0530) 7 | 8 | #ifndef _VARIABLE_H 9 | #define _VARIABLE_H 10 | 11 | #include 12 | 13 | class ObjId; 14 | class Eref; 15 | class Cinfo; 16 | 17 | using namespace std; 18 | 19 | /** This class is used as FieldElement in Function. It is used as named 20 | variable of type double. 21 | */ 22 | class Variable 23 | { 24 | 25 | public: 26 | 27 | Variable(string name=""): name_(name), value_(0.0) 28 | {}; 29 | 30 | Variable(const Variable& rhs): name_(rhs.name_), value_(rhs.value_) 31 | { 32 | ; 33 | } 34 | 35 | ~Variable() {}; 36 | 37 | void setValue(double v) 38 | { 39 | value_ = v; 40 | } 41 | 42 | void setValue(const Eref & e, double v) 43 | { 44 | value_ = v; 45 | } 46 | 47 | double getValue() const 48 | { 49 | return value_; 50 | } 51 | 52 | string getName() const 53 | { 54 | return name_; 55 | } 56 | 57 | double* ref() 58 | { 59 | return &value_; 60 | } 61 | 62 | static const Cinfo * initCinfo(); 63 | 64 | private: 65 | string name_{"NONAME"}; 66 | double value_{0.0}; 67 | }; 68 | 69 | #endif // include guard. 70 | 71 | -------------------------------------------------------------------------------- /builtins/meson.build: -------------------------------------------------------------------------------- 1 | # Author: Subhasis Ray 2 | # Date: Sun Jul 7 3 | 4 | builtins_src = ['Arith.cpp', 5 | 'Group.cpp', 6 | 'Mstring.cpp', 7 | 'Function.cpp', 8 | 'Variable.cpp', 9 | 'InputVariable.cpp', 10 | 'TableBase.cpp', 11 | 'Table.cpp', 12 | 'Interpol.cpp', 13 | 'StimulusTable.cpp', 14 | 'TimeTable.cpp', 15 | 'StreamerBase.cpp', 16 | 'Streamer.cpp', 17 | 'Stats.cpp', 18 | 'Interpol2D.cpp', 19 | 'SpikeStats.cpp', 20 | 'MooseParser.cpp', 21 | 'HDF5WriterBase.cpp', 22 | 'HDF5DataWriter.cpp', 23 | 'NSDFWriter.cpp', 24 | 'NSDFWriter2.cpp', 25 | # '../utility/cnpy.cpp', 26 | # '../external/fmt/src/format.cc', 27 | # '../external/fmt/src/os.cc', 28 | 'testBuiltins.cpp'] 29 | 30 | if host_machine.system() != 'windows' 31 | builtins_src += files(['SocketStreamer.cpp']) 32 | endif 33 | include_directories = ['../external/fmt/include'] 34 | 35 | if use_hdf5 36 | builtins_lib = static_library('builtins', builtins_src, include_directories: include_directories, dependencies: hdf5_dep) 37 | else 38 | builtins_lib = static_library('builtins', builtins_src, include_directories: include_directories) 39 | endif 40 | 41 | -------------------------------------------------------------------------------- /cmake/FindLibXML2.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find LibXML2 headers and libraries. 2 | # 3 | # Usage of this module as follows: 4 | # 5 | # find_package(LibXML2) 6 | # 7 | # Variables used by this module, they can change the default behaviour and need 8 | # to be set before calling find_package: 9 | # 10 | # LibXML2_ROOT_DIR Set this variable to the root installation of 11 | # LibXML2 if the module has problems finding 12 | # the proper installation path. 13 | # 14 | # Variables defined by this module: 15 | # 16 | # LIBXML2_FOUND System has LibXML2 libs/headers 17 | # LibXML2_LIBRARIES The LibXML2 libraries 18 | # LibXML2_INCLUDE_DIR The location of LibXML2 headers 19 | 20 | find_path(LibXML2_ROOT_DIR 21 | NAMES include/libxml2/libxml/tree.h 22 | ) 23 | 24 | find_library(LibXML2_LIBRARIES 25 | NAMES xml2 26 | HINTS ${LibXML2_ROOT_DIR}/lib 27 | ) 28 | 29 | find_path(LibXML2_INCLUDE_DIR 30 | NAMES libxml/tree.h 31 | HINTS ${LibXML2_ROOT_DIR}/include/libxml2 32 | ) 33 | 34 | 35 | include(FindPackageHandleStandardArgs) 36 | find_package_handle_standard_args(LibXML2 DEFAULT_MSG 37 | LibXML2_LIBRARIES 38 | LibXML2_INCLUDE_DIR 39 | ) 40 | 41 | mark_as_advanced( 42 | LibXML2_ROOT_DIR 43 | LibXML2_LIBRARIES 44 | LibXML2_INCLUDE_DIR 45 | ) 46 | -------------------------------------------------------------------------------- /cmake/FindReadline.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find readline include dirs and libraries 2 | # 3 | # Usage of this module as follows: 4 | # 5 | # find_package(Readline) 6 | # 7 | # Variables used by this module, they can change the default behaviour and need 8 | # to be set before calling find_package: 9 | # 10 | # Readline_ROOT_DIR Set this variable to the root installation of 11 | # readline if the module has problems finding the 12 | # proper installation path. 13 | # 14 | # Variables defined by this module: 15 | # 16 | # READLINE_FOUND System has readline, include and lib dirs found 17 | # Readline_INCLUDE_DIR The readline include directories. 18 | # Readline_LIBRARY The readline library. 19 | 20 | find_package(Curses) 21 | find_path(Readline_ROOT_DIR 22 | NAMES include/readline/readline.h 23 | ) 24 | 25 | find_path(Readline_INCLUDE_DIR 26 | NAMES readline/readline.h 27 | HINTS ${Readline_ROOT_DIR}/include 28 | ) 29 | 30 | find_library(Readline_LIBRARY 31 | NAMES readline 32 | HINTS ${Readline_ROOT_DIR}/lib 33 | ) 34 | 35 | if(Readline_INCLUDE_DIR AND Readline_LIBRARY AND Ncurses_LIBRARY) 36 | set(READLINE_FOUND TRUE) 37 | else(Readline_INCLUDE_DIR AND Readline_LIBRARY AND Ncurses_LIBRARY) 38 | FIND_LIBRARY(Readline_LIBRARY NAMES readline termcap) 39 | include(FindPackageHandleStandardArgs) 40 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(Readline DEFAULT_MSG Readline_INCLUDE_DIR Readline_LIBRARY ) 41 | MARK_AS_ADVANCED(Readline_INCLUDE_DIR Readline_LIBRARY) 42 | endif(Readline_INCLUDE_DIR AND Readline_LIBRARY AND Ncurses_LIBRARY) 43 | 44 | mark_as_advanced( 45 | Readline_ROOT_DIR 46 | Readline_INCLUDE_DIR 47 | Readline_LIBRARY 48 | ) 49 | -------------------------------------------------------------------------------- /cmake/FindSIP.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # FindSIP.py 3 | # 4 | # Copyright (c) 2007, Simon Edwards 5 | # Redistribution and use is allowed according to the terms of the BSD license. 6 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 7 | 8 | import sys 9 | import sipconfig 10 | 11 | sipcfg = sipconfig.Configuration() 12 | print("sip_version:%06.0x" % sipcfg.sip_version) 13 | print("sip_version_str:%s" % sipcfg.sip_version_str) 14 | print("sip_bin:%s" % sipcfg.sip_bin) 15 | print("default_sip_dir:%s" % sipcfg.default_sip_dir) 16 | print("sip_inc_dir:%s" % sipcfg.sip_inc_dir) 17 | -------------------------------------------------------------------------------- /cmake/FindTermcap.cmake: -------------------------------------------------------------------------------- 1 | # find Terrmcap (terminal input library) includes and library 2 | # 3 | # TERMCAP_INCLUDE_DIR - where the directory containing the TERMCAP headers can be found 4 | # TERMCAP_LIBRARY - full path to the TERMCAP library 5 | # TERMCAP_FOUND - TRUE if TERMCAP was found 6 | 7 | MACRO(FIND_TERMCAP) 8 | 9 | FIND_PATH(TERMCAP_INCLUDE_DIR termcap.h 10 | /usr/include 11 | /usr/local/include 12 | 13 | /opt/local/include 14 | ) 15 | 16 | FIND_LIBRARY(TERMCAP_LIBRARY NAMES termcap PATH 17 | /usr/lib 18 | /usr/local/lib 19 | /opt/local/lib 20 | /usr/lib64 21 | ) 22 | 23 | IF (TERMCAP_INCLUDE_DIR AND TERMCAP_LIBRARY) 24 | SET(TERMCAP_FOUND TRUE) 25 | MESSAGE(STATUS "Found GNU termcap: ${TERMCAP_LIBRARY}") 26 | MESSAGE(STATUS "Include dir is: ${TERMCAP_INCLUDE_DIR}") 27 | INCLUDE_DIRECTORIES(${TERMCAP_INCLUDE_DIR}) 28 | ELSE (TERMCAP_INCLUDE_DIR AND TERMCAP_LIBRARY) 29 | SET(TERMCAP_FOUND FALSE) 30 | MESSAGE(FATAL_ERROR "Could not find GNU termcap") 31 | ENDIF (TERMCAP_INCLUDE_DIR AND TERMCAP_LIBRARY) 32 | 33 | ENDMACRO(FIND_TERMCAP) 34 | -------------------------------------------------------------------------------- /cmake/GetGitRevisionDescription.cmake.in: -------------------------------------------------------------------------------- 1 | # 2 | # Internal file for GetGitRevisionDescription.cmake 3 | # 4 | # Requires CMake 2.6 or newer (uses the 'function' command) 5 | # 6 | # Original Author: 7 | # 2009-2010 Ryan Pavlik 8 | # http://academic.cleardefinition.com 9 | # Iowa State University HCI Graduate Program/VRAC 10 | # 11 | # Copyright Iowa State University 2009-2010. 12 | # Distributed under the Boost Software License, Version 1.0. 13 | # (See accompanying file LICENSE_1_0.txt or copy at 14 | # http://www.boost.org/LICENSE_1_0.txt) 15 | 16 | set(HEAD_HASH) 17 | 18 | file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024) 19 | 20 | string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS) 21 | if(HEAD_CONTENTS MATCHES "ref") 22 | # named branch 23 | string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}") 24 | if(EXISTS "@GIT_DIR@/${HEAD_REF}") 25 | configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) 26 | else() 27 | configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY) 28 | file(READ "@GIT_DATA@/packed-refs" PACKED_REFS) 29 | if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}") 30 | set(HEAD_HASH "${CMAKE_MATCH_1}") 31 | endif() 32 | endif() 33 | else() 34 | # detached HEAD 35 | configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY) 36 | endif() 37 | 38 | if(NOT HEAD_HASH) 39 | file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024) 40 | string(STRIP "${HEAD_HASH}" HEAD_HASH) 41 | endif() 42 | -------------------------------------------------------------------------------- /cmake/GetRevision.cmake: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3) 2 | 3 | MACRO(NOW RESULT) 4 | IF(CMAKE_VERSION VERSION_GREATER "2.8.10") 5 | STRING(TIMESTAMP ${RESULT} "%Y%m%d") 6 | ELSE() 7 | IF(WIN32) 8 | EXECUTE_PROCESS(COMMAND "wmic" "os" "get" "localdatetime" OUTPUT_VARIABLE DATETIME) 9 | IF(NOT DATETIME MATCHES "ERROR") 10 | STRING(REGEX REPLACE ".*\n([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9]).*" "\\1-\\2-\\3 \\4:\\5:\\6" ${RESULT} "${DATETIME}") 11 | ENDIF() 12 | ELSEIF(UNIX) 13 | EXECUTE_PROCESS(COMMAND "date" "+%Y%m%d" OUTPUT_VARIABLE DATETIME) 14 | STRING(REGEX REPLACE "([0-9: -]+).*" "\\1" ${RESULT} "${DATETIME}") 15 | ELSE() 16 | MESSAGE(SEND_ERROR "date not implemented") 17 | SET(${RESULT} "00000000") 18 | ENDIF() 19 | ENDIF() 20 | ENDMACRO() 21 | -------------------------------------------------------------------------------- /cmake/Pinfo.plist: -------------------------------------------------------------------------------- 1 | # Currently empty. 2 | -------------------------------------------------------------------------------- /cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | # This script can be used to uninstall moose and moogli, if they are installed 2 | # using cmake. 3 | 4 | if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 5 | message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 6 | endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 7 | 8 | file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 9 | string(REGEX REPLACE "\n" ";" files "${files}") 10 | foreach(file ${files}) 11 | message(STATUS "Uninstalling $ENV{DESTDIR}${file}") 12 | if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 13 | exec_program( 14 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 15 | OUTPUT_VARIABLE rm_out 16 | RETURN_VALUE rm_retval 17 | ) 18 | if(NOT "${rm_retval}" STREQUAL 0) 19 | message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") 20 | endif(NOT "${rm_retval}" STREQUAL 0) 21 | else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 22 | message(STATUS "File $ENV{DESTDIR}${file} does not exist.") 23 | endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 24 | endforeach(file) 25 | -------------------------------------------------------------------------------- /devel/_conftest.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Top level file to run and generate report. 4 | 5 | __author__ = "Dilawar Singh" 6 | __copyright__ = "Copyright 2019-, Dilawar Singh" 7 | __maintainer__ = "Dilawar Singh" 8 | __email__ = "dilawars@ncbs.res.in" 9 | 10 | import pytest 11 | try: 12 | import reload 13 | except ImportError: 14 | from importlib import reload 15 | 16 | @pytest.fixture(scope="module", autouse=True) 17 | def reload_moose(): 18 | import moose 19 | print('reloading moose') 20 | for p in ['/model', '/library']: 21 | if moose.exists(p): 22 | moose.delete(p) 23 | # If someone has changed the clock-ticks then we need to reset them. 24 | # And relaod just to make sure and other values are initialized. 25 | reload(moose) 26 | -------------------------------------------------------------------------------- /devel/docker/centos/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM centos:7 2 | MAINTAINER Dilawar Singh 3 | 4 | # Install dependencies. 5 | RUN yum -y update && yum -y install epel-release && yum -y update \ 6 | && yum -y clean all 7 | RUN yum install -y git cmake3 gcc gcc-c++ make \ 8 | python3 python3-devel python3-setuptools python3-numpy \ 9 | && yum -y clean all 10 | RUN yum install -y gsl-devel && yum -y clean all 11 | # These are required to run tests. 12 | RUN yum install -y python3-matplotlib python3-scipy python3-numpy && yum -y clean all 13 | RUN yum install -y centos-release-scl && yum -y clean all 14 | RUN yum install -y devtoolset-8 && yum -y clean all 15 | RUN ln -s /usr/bin/cmake3 /usr/bin/cmake 16 | RUN ln -s /usr/bin/ctest3 /usr/bin/ctest 17 | WORKDIR /root 18 | 19 | # Run docker build from project ROOT. 20 | COPY . moose-core 21 | RUN python3 -m pip install matplotlib scipy sympy --user 22 | 23 | # enable devtoolset before building. 24 | SHELL [ "/usr/bin/scl", "enable", "devtoolset-8" ] 25 | RUN cd moose-core && python3 setup.py build test install 26 | CMD ["/usr/bin/python3", "-c", "'import moose;moose.test()'"] 27 | -------------------------------------------------------------------------------- /devel/docker/centos/Makefile: -------------------------------------------------------------------------------- 1 | NAME:=dilawars/centos-moose 2 | VERSION:=$(shell date +%Y.%m.%d) 3 | 4 | PROJECT_ROOT_DIR:=(PWD)/../.. 5 | 6 | all : build 7 | 8 | build : Dockerfile 9 | cd ../../ && docker build -t $(NAME):$(VERSION) -f $(PWD)/Dockerfile . 10 | cd ../../ && docker build -t $(NAME):latest -f $(PWD)/Dockerfile . 11 | 12 | upload : 13 | docker push $(NAME):$(VERSION) 14 | docker push $(NAME):latest 15 | 16 | run : 17 | docker run -ti $(NAME):$(VERSION) bash 18 | 19 | -------------------------------------------------------------------------------- /devel/docker/opensuse/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM opensuse/leap 2 | MAINTAINER Dilawar Singh 3 | 4 | # Install dependencies. 5 | RUN zypper install -y git cmake gcc gcc-c++ make \ 6 | python3 python3-devel python3-setuptools python3-numpy-devel \ 7 | && rm -rf /var/cache/zypp/packages/* 8 | RUN zypper install -y gsl-devel \ 9 | && rm -rf /var/cache/zypp/packages/* 10 | # These are required to run tests. 11 | RUN zypper install -y python3-matplotlib python3-networkx graphviz python3-scipy \ 12 | && rm -rf /var/cache/zypp/packages/* 13 | WORKDIR /home/root 14 | # RUN git clone https://github.com/dilawar/moose-core -b devel 15 | # Run docker build from outside 16 | COPY . moose-core 17 | RUN cd moose-core && python3 setup.py build test install 18 | CMD ["/usr/bin/python3", "-c", "'import moose;moose.test()'"] 19 | -------------------------------------------------------------------------------- /devel/docker/opensuse/Makefile: -------------------------------------------------------------------------------- 1 | NAME:=dilawars/centos-moose 2 | VERSION:=$(shell date +%Y.%m.%d) 3 | 4 | PROJECT_ROOT_DIR:=(PWD)/../.. 5 | 6 | all : build 7 | 8 | build : Dockerfile 9 | cd ../../ && docker build -t $(NAME):$(VERSION) -f $(PWD)/Dockerfile . 10 | cd ../../ && docker build -t $(NAME):latest -f $(PWD)/Dockerfile . 11 | 12 | upload : 13 | docker push $(NAME):$(VERSION) 14 | docker push $(NAME):latest 15 | 16 | run : 17 | docker run $(NAME):$(VERSION) /bin/bash -c "python3 -c 'import moose; moose.test()'" 18 | 19 | -------------------------------------------------------------------------------- /devel/docker/travis/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:18.04 2 | MAINTAINER Dilawar Singh 3 | 4 | ENV DEBIAN_FRONTEND=noninteractive 5 | 6 | # Install dependencies. 7 | RUN apt update && apt install -y cmake gcc g++ make valgrind \ 8 | libboost-all-dev libgsl-dev libblas-dev liblapack-dev \ 9 | python3-pip python-pip \ 10 | python3-numpy python-numpy python3-matplotlib python-matplotlib \ 11 | python-tk python3-tk \ 12 | python-setuptools python3-setuptools \ 13 | python-dev python3-dev \ 14 | && rm -rf /var/lib/apt/lists/* 15 | 16 | RUN python3 -m pip --no-cache-dir install pyneuroml python-libsbml 17 | WORKDIR /root 18 | RUN ls -ltrah 19 | COPY . moose-core/ 20 | RUN ls -ltarh 21 | RUN cd moose-core && rm -rf .git && ./.ci/travis_build_linux.sh 22 | -------------------------------------------------------------------------------- /devel/docker/travis/Makefile: -------------------------------------------------------------------------------- 1 | NAME:=dilawars/moose-travis 2 | VERSION:=$(shell date +"%Y%m%d") 3 | 4 | PWD:=$(shell pwd) 5 | PROJECT_ROOT_DIR:=$(PWD)/../../.. 6 | DOCKERFILE:=$(PWD)/Dockerfile 7 | 8 | all : build 9 | 10 | build : Dockerfile 11 | cd $(PROJECT_ROOT_DIR) && docker build -t $(NAME):$(VERSION) -f $(DOCKERFILE) . 12 | cd $(PROJECT_ROOT_DIR) && docker build -t $(NAME):latest -f $(DOCKERFILE) . 13 | 14 | upload : 15 | docker push $(NAME):$(VERSION) 16 | docker push $(NAME):latest 17 | 18 | run : 19 | docker run -it $(NAME):latest bash 20 | 21 | -------------------------------------------------------------------------------- /devel/docker/wheel/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM quay.io/pypa/manylinux2010_x86_64 2 | 3 | ARG PYPI_PASSWORD 4 | 5 | MAINTAINER Dilawar Singh 6 | ENV PATH=/usr/local/bin:$PATH 7 | RUN yum update -y 8 | RUN yum install -y cmake3 wget curl && yum clean all 9 | RUN ln -s /usr/bin/cmake3 /usr/local/bin/cmake 10 | RUN ln -s /usr/bin/ctest3 /usr/local/bin/ctest 11 | RUN curl -O https://ftp.gnu.org/gnu/gsl/gsl-2.4.tar.gz \ 12 | && tar xvf gsl-2.4.tar.gz \ 13 | && cd gsl-2.4 \ 14 | && CFLAGS=-fPIC ./configure --enable-static && make $MAKEOPTS \ 15 | && make install \ 16 | && cd .. 17 | RUN yum install -y git vim && yum clean all 18 | RUN git config --global user.name 'Dilawar Singh' \ 19 | && git config --global user.email 'dilawar.s.rajput@gmail.com' \ 20 | && git clone https://github.com/dilawar/vim ~/.vim -b minimal 21 | WORKDIR /root 22 | COPY ./build_wheels.sh /root 23 | COPY ./test_and_upload.sh /root 24 | -------------------------------------------------------------------------------- /devel/docker/wheel/Makefile: -------------------------------------------------------------------------------- 1 | VERSION := 3.2.dev$(shell date +"%Y%m%d") 2 | 3 | all : wheels 4 | 5 | DOCKERFILE:="bhallalab/python-wheels" 6 | 7 | wheels : ./Dockerfile 8 | docker build -t $(DOCKERFILE):$(VERSION) . 9 | docker build -t $(DOCKERFILE):latest . 10 | 11 | upload: 12 | docker push $(DOCKERFILE):$(VERSION) 13 | docker push $(DOCKERFILE):latest 14 | 15 | run: 16 | docker run -it $(DOCKERFILE):latest bash 17 | -------------------------------------------------------------------------------- /devel/docker/wheel/README.md: -------------------------------------------------------------------------------- 1 | This docker image can be used to build pymoose wheels. 2 | 3 | This image is based on manylinux_2010 https://www.python.org/dev/peps/pep-0571/. 4 | -------------------------------------------------------------------------------- /devel/fixme/test_docs.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """test_docs.py: 3 | 4 | Test if moose.doc is working. 5 | 6 | """ 7 | 8 | __author__ = "Dilawar Singh" 9 | __copyright__ = "Copyright 2017-, Dilawar Singh" 10 | __version__ = "1.0.0" 11 | __maintainer__ = "Dilawar Singh" 12 | __email__ = "dilawars@ncbs.res.in" 13 | __status__ = "Development" 14 | 15 | import sys 16 | import os 17 | import moose 18 | print( '[INFO] Using moose from %s' % moose.__file__ ) 19 | print( '[INFO] Version : %s' % moose.version( ) ) 20 | 21 | def test_doc( ): 22 | print('==Testing docs') 23 | moose.doc('Compartment') 24 | 25 | def main(): 26 | test_doc() 27 | 28 | if __name__ == '__main__': 29 | main() 30 | -------------------------------------------------------------------------------- /devel/issues/hsolve/README: -------------------------------------------------------------------------------- 1 | This directory contains a test case comparing NEURON simulation of a 2 | neuron with results from MOOSE hsolve and ee solver. 3 | 4 | h10.CNG.swc: Cell morphology from NeuroMorpho.org. Taken from 5 | moose-examples/snippets. 6 | 7 | h10.CNG.moose.py: Loads the swc file in MOOSE and sets the passive 8 | properties. It records the Vm from the soma and the apical 9 | compartments and dumps them to the outout file. Simulates with hsolve 10 | if run with arguments, exponential Euler (EE) otherwise. 11 | 12 | h10.CNG.hoc : Passive model of this cell for NEURON. 13 | 14 | run_h10.CNG.hoc : Sets up current injection at the last apical section 15 | of the above cell, simulates it and dumps the time, soma Vm and 16 | stimulated compartment Vm. 17 | 18 | compare_moose_nrn.py : Plots the dumped Vm from the three cases. -------------------------------------------------------------------------------- /devel/issues/hsolve/run_h10.CNG.hoc: -------------------------------------------------------------------------------- 1 | /* This script sets up current injection on apical[90] section, 2 | corresponding to that between nodes 200 (-3.061, 56.39, -3.12) and 204 3 | (-32.910 128.5 -3.12) in the swc file. */ 4 | 5 | load_file("nrngui.hoc") 6 | load_file("stdrun.hoc") 7 | load_file("h10.CNG.hoc") 8 | 9 | objectvar stim, fd, vec_v_apical_90, vec_v_soma, vec_t 10 | 11 | secondorder=2 12 | dt = 0.025 // ms 13 | celsius=30 14 | v_init=-70.0 // mV 15 | 16 | apic[90] { 17 | stim = new IClamp(0.5) 18 | stim.amp = 1e-3 // nA 19 | stim.del = 20.0 // ms 20 | stim.dur = 10.0 // ms 21 | } 22 | 23 | vec_t = new Vector() 24 | vec_v_apical_90 = new Vector() 25 | vec_v_soma = new Vector() 26 | apic[90] vec_v_apical_90.record(&v(0.5)) 27 | soma[1] vec_v_soma.record(&v(0.5)) 28 | vec_t.record(&t) 29 | 30 | tstop = 100 31 | run() 32 | 33 | fd = new File() 34 | fd.wopen("h10.CNG.nrn.txt") 35 | for ii = 0, vec_t.size() - 1 { 36 | fd.printf("%g %g %g\n", vec_t.x(ii), vec_v_soma.x(ii), vec_v_apical_90.x(ii)) 37 | } 38 | fd.close() 39 | 40 | 41 | -------------------------------------------------------------------------------- /devel/issues/issue_124.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import moose 3 | print(( 'Using moose form %s' % moose.__file__ )) 4 | 5 | 6 | def main(): 7 | solver = "gssa" 8 | moose.Neutral('/model') 9 | moose.CubeMesh('/model/kinetics') 10 | moose.Pool('/model/kinetics/A') 11 | 12 | #delete if exists 13 | if ( moose.exists( 'model/kinetics/stoich' ) ): 14 | moose.delete( '/model/kinetics/stoich' ) 15 | moose.delete( '/model/kinetics/ksolve' ) 16 | 17 | #create solver 18 | compt = moose.element( '/model/kinetics' ) 19 | ksolve = moose.Gsolve( '/model/kinetics/ksolve' ) 20 | stoich = moose.Stoich( '/model/kinetics/stoich' ) 21 | stoich.compartment = compt 22 | stoich.ksolve = ksolve 23 | stoich.path = "/model/kinetics/##" 24 | print(" before reinit") 25 | moose.reinit() 26 | print(" After reinit") 27 | moose.start( 10 ) 28 | print( "Done" ) 29 | 30 | # Run the 'main' if this script is executed standalone. 31 | if __name__ == '__main__': 32 | main() 33 | 34 | -------------------------------------------------------------------------------- /devel/issues/issue_239.py: -------------------------------------------------------------------------------- 1 | import moose 2 | print( 'Using moose from %s' % moose.__file__) 3 | 4 | modelRoot = moose.Neutral('/model') 5 | compt = moose.CubeMesh('/model/kinetics') 6 | p1 = moose.BufPool('/model/kinetics/Ca') 7 | function = moose.Function('/model/kinetics/Ca/func') 8 | #function out to pool 9 | moose.connect( function, 'valueOut', p1 ,'setConc' ) 10 | #input pools to be connected to fuction 11 | S1 = moose.BufPool( '/model/kinetics/s1' ) 12 | S2 = moose.BufPool( '/model/kinetics/s2' ) 13 | 14 | initiexpr = function.expr 15 | #S1 connected to function 16 | numVariables = function.numVars 17 | expr = "" 18 | expr = (function.expr+'+'+'x'+str(numVariables)) 19 | expr = expr.lstrip("0 +") 20 | expr = expr.replace(" ","") 21 | function.expr = expr 22 | s1msg = moose.connect( S1, 'nOut', function.x[numVariables], 'input' ) 23 | #S2 connected to function 24 | numVariables = function.numVars 25 | expr = "" 26 | expr = (function.expr+'+'+'x'+str(numVariables)) 27 | expr = expr.lstrip("0 +") 28 | expr = expr.replace(" ","") 29 | function.expr = expr 30 | s2msg = moose.connect( S2, 'nOut', function.x[numVariables], 'input' ) 31 | 32 | compts = moose.wildcardFind(modelRoot.path+'/##[ISA=ChemCompt]') 33 | solver = 'gsl' 34 | moose.mooseAddChemSolver('/model',solver) 35 | moose.mooseDeleteChemSolver('/model') 36 | 37 | #moose.delete(s1msg) 38 | #moose.delete(s2msg) 39 | #deleting the function 40 | #moose.delete(function) #deleting this will not cause seg fault 41 | print(function.expr) #function's expr still has the expression which is causing the problem 42 | -------------------------------------------------------------------------------- /devel/issues/issue_34.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Issue 34 on github. 3 | import moose 4 | import moose.utils as mu 5 | 6 | compt = moose.CubeMesh('/compt') 7 | compt.volume = 1e-20 8 | 9 | molecules = [ "ca", "S", "S1", "Sp" ] 10 | pools = {} 11 | tables = {} 12 | for m in molecules: 13 | pools[m] = moose.Pool('/compt/%s' % m) 14 | t = moose.Table2("/table%s" % m) 15 | tables[m] = t 16 | moose.connect(t, 'requestOut', pools[m], 'getConc') 17 | 18 | pools['ca'].nInit = 20 19 | 20 | r_p0_p1 = moose.Reac('/compt/reacA') 21 | funA = moose.Function('/compt/funA') 22 | funA.x.num = 1 23 | funA.expr = "{0}*(x0/{1})^6/(1+(x0/{1})^3)^2".format("1.5", "0.7e-3") 24 | # moose.connect(funA.x[0], 'input', pools['ca'], 'getN') 25 | moose.connect(pools['ca'], 'nOut', funA.x[0], 'input') 26 | moose.connect(funA, 'valueOut', pools['S1'], 'setN') 27 | moose.connect(r_p0_p1, 'sub', pools['S'], 'reac') 28 | moose.connect(r_p0_p1, 'prd', pools['S1'], 'reac') 29 | 30 | r_p1_up = moose.Reac('/compt/reacB') 31 | moose.connect(r_p1_up, 'sub', pools['S1'], 'reac') 32 | moose.connect(r_p1_up, 'prd', pools['Sp'], 'reac') 33 | 34 | # Change GSolve to Ksolve and bugs go away. 35 | k = moose.Gsolve('/compt/ksolve') 36 | s = moose.Stoich('/compt/stoich') 37 | s.compartment = compt 38 | s.ksolve = k 39 | s.path = '/compt/##' 40 | 41 | moose.reinit() 42 | moose.start(10) 43 | -------------------------------------------------------------------------------- /devel/issues/issue_45.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import print_function 3 | import moose 4 | 5 | moose.Neutral('/model') 6 | compt = moose.CubeMesh('/model/Compart') 7 | compt.volume = 1.6667e-21 8 | 9 | s = moose.Pool('/model/Compart/S') 10 | s.concInit = 0.3 11 | p = moose.Pool('/model/Compart/P') 12 | r = moose.Reac('/model/Compart/Reac') 13 | moose.connect(r, 'sub', s, 'reac') 14 | 15 | moose.connect(r, 'prd', p, 'reac') 16 | 17 | bf = moose.BufPool('/model/Compart/BufPool') 18 | f = moose.Function('/model/Compart/BufPool/function') 19 | moose.connect( f, 'valueOut', bf ,'setN' ) 20 | 21 | numVariables = f.numVars 22 | f.numVars+=1 23 | expr = "" 24 | expr = (f.expr+'+'+'x'+str(numVariables)) 25 | expr = expr.lstrip("0 +") 26 | expr = expr.replace(" ","") 27 | f.expr = expr 28 | moose.connect( s, 'nOut', f.x[numVariables], 'input' ) 29 | 30 | bf1 = moose.BufPool('/model/Compart/BufPool1') 31 | f1 = moose.Function('/model/Compart/BufPool1/func') 32 | moose.connect( f1, 'valueOut', bf1 ,'setN' ) 33 | numVariables = f1.numVars 34 | expr = "" 35 | expr = (f1.expr+'+'+'x'+str(numVariables)) 36 | expr = expr.lstrip("0 +") 37 | expr = expr.replace(" ","") 38 | f1.expr = expr 39 | moose.connect( s, 'nOut', f1.x[numVariables], 'input' ) 40 | 41 | compts = moose.wildcardFind('/model/##[ISA=ChemCompt]') 42 | 43 | print(" f name= ",f.name, f.tick) 44 | print(" f1 name= ",f1.name, f1.tick) 45 | for compt in compts: 46 | ksolve = moose.Ksolve( compt.path+'/ksolve' ) 47 | stoich = moose.Stoich( compt.path+'/stoich' ) 48 | stoich.compartment = compt 49 | stoich.ksolve = ksolve 50 | stoich.path = compt.path+"/##" 51 | 52 | print("After solver is set") 53 | print(" f name= ",f.name,f.tick) 54 | print(" f1 name= ", f1.name, f1.tick) 55 | -------------------------------------------------------------------------------- /devel/issues/issue_47.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Issue 47 on moose-core 3 | import moose 4 | import os 5 | sdir = os.path.dirname( __file__ ) 6 | print( '[INFO] Using moose from %s' % moose.__file__ ) 7 | print( '[WONTFIX] See https://github.com/BhallaLab/moose-core/issues/47') 8 | if False: 9 | moose.loadModel(os.path.join(sdir,'../data/acc94.g'),'/acc94','gsl') 10 | #moose.loadModel(os.path.join(sdir,'../data/acc94.g'),'/acc94','gssa') 11 | moose.reinit() 12 | moose.start( 10 ) 13 | else: 14 | quit(0) 15 | -------------------------------------------------------------------------------- /device/DiffAmp.h: -------------------------------------------------------------------------------- 1 | // DiffAmp.h --- 2 | // 3 | // Filename: DiffAmp.h 4 | // Description: 5 | // Author: Subhasis Ray 6 | // Maintainer: 7 | // Created: Wed Feb 22 02:28:54 2012 (+0530) 8 | // Version: 9 | // Last-Updated: Wed Feb 22 03:03:01 2012 (+0530) 10 | // By: Subhasis Ray 11 | // Update #: 15 12 | // URL: 13 | // Keywords: 14 | // Compatibility: 15 | // 16 | // 17 | 18 | // Commentary: 19 | // 20 | // 21 | // 22 | // 23 | 24 | // Change log: 25 | // 26 | // 27 | // 28 | 29 | // Code: 30 | 31 | #ifndef _DIFFAMP_H 32 | #define _DIFFAMP_H 33 | 34 | #include "../basecode/header.h" 35 | 36 | class DiffAmp 37 | { 38 | public: 39 | DiffAmp(); 40 | ~DiffAmp(); 41 | void setGain(double gain); 42 | double getGain() const; 43 | void setSaturation(double saturation); 44 | double getSaturation() const; 45 | double getOutput() const; 46 | void plusFunc(double input); 47 | void minusFunc(double input); 48 | void process(const Eref& e, ProcPtr p); 49 | void reinit(const Eref& e, ProcPtr p); 50 | 51 | static const Cinfo* initCinfo(); 52 | 53 | protected: 54 | double gain_; 55 | double saturation_; 56 | double plus_; 57 | double minus_; 58 | double output_; 59 | }; 60 | 61 | #endif 62 | 63 | // 64 | // DiffAmp.h ends here 65 | -------------------------------------------------------------------------------- /device/meson.build: -------------------------------------------------------------------------------- 1 | # Author: Subhasis Ray 2 | # Date: Sun Jul 7 3 | 4 | device_src = ['PulseGen.cpp', 5 | 'DiffAmp.cpp', 6 | 'PIDController.cpp', 7 | 'RC.cpp'] 8 | 9 | device_lib = static_library('device', device_src) 10 | -------------------------------------------------------------------------------- /diffusion/ConcChanInfo.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment. 4 | ** Copyright (C) 2003-2012 Upinder S. Bhalla. and NCBS 5 | ** It is made available under the terms of the 6 | ** GNU Lesser General Public License version 2.1 7 | ** See the file COPYING.LIB for the full notice. 8 | **********************************************************************/ 9 | 10 | #ifndef _CONC_CHAN_INFO_H 11 | #define _CONC_CHAN_INFO_H 12 | 13 | /** 14 | */ 15 | class ConcChanInfo 16 | { 17 | public: 18 | ConcChanInfo(); 19 | ConcChanInfo( unsigned int my, unsigned int other, 20 | unsigned int chan, double perm, bool isSwapped, bool _isLocal ) 21 | : myPool( my ), otherPool( other ), chanPool( chan ), 22 | swapped( isSwapped ), 23 | isLocal( _isLocal ), 24 | permeability( perm ) 25 | {;} 26 | 27 | unsigned int myPool; /// This is not Id, it is internal PoolIndex 28 | /// Obtained using convertIdToPoolIndex. 29 | unsigned int otherPool; /// Internal PoolIndex 30 | unsigned int chanPool; /// Internal PoolIndex 31 | bool swapped; // Flag records whether myPool/otherPool are 32 | // swapped wrt inPool/outPool. System expects 33 | // that inPool should be in same compt as chanPool. 34 | bool isLocal; // Flag, records odd cases where the channel is 35 | // entirely local to one compartment. 36 | double permeability; 37 | }; 38 | 39 | #endif // _CONC_CHAN_INFO_H 40 | -------------------------------------------------------------------------------- /diffusion/meson.build: -------------------------------------------------------------------------------- 1 | # Author: Subhasis Ray 2 | # Date: Sun Jul 7 3 | 4 | diffusion_src = ['FastMatrixElim.cpp', 5 | 'DiffPoolVec.cpp', 6 | 'Dsolve.cpp', 7 | 'testDiffusion.cpp'] 8 | 9 | diffusion_lib = static_library('diffusion', diffusion_src, include_directories: gsl_dep.get_variable(pkgconfig:'includedir')) 10 | -------------------------------------------------------------------------------- /examples/Ex.h: -------------------------------------------------------------------------------- 1 | #ifndef _EX_H 2 | #define _EX_H 3 | 4 | class Ex 5 | { 6 | public: 7 | Ex(); 8 | ~Ex(); 9 | static const Cinfo* initCinfo(); 10 | 11 | void process(const Eref& e, ProcPtr p); 12 | void reinit(const Eref& e, ProcPtr p); 13 | 14 | double getX() const; 15 | int getN() const; 16 | void setX(double x); 17 | void setN(int n); 18 | void setNX(int n, double x); 19 | double getVal(unsigned int index) const; 20 | void setVal(unsigned int index, double val); 21 | void getVal(unsigned int index, double val); 22 | 23 | void handleX(double x); 24 | void handleN(int n); 25 | 26 | private: 27 | double x_; 28 | int n_; 29 | vector< double > values_; 30 | }; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /examples/Example.h: -------------------------------------------------------------------------------- 1 | #ifndef EXAMPLE_H 2 | #endif /* end of include guard: EXAMPLE_H */ 3 | class Example { 4 | 5 | private: 6 | double x_; 7 | double y_; 8 | double output_; 9 | 10 | public: 11 | 12 | Example(); 13 | 14 | double getX() const; 15 | void setX( double x ); 16 | double getY() const; 17 | void setY( double y ); 18 | 19 | void process( const Eref& e, ProcPtr p ); 20 | void reinit( const Eref& e, ProcPtr p ); 21 | 22 | void handleX(double arg); 23 | void handleY(double arg); 24 | 25 | vector< Id > getNeighbors( const Eref& e, string field ) const; 26 | 27 | static const Cinfo* initCinfo(); 28 | 29 | }; 30 | 31 | #define EXAMPLE_H 32 | -------------------------------------------------------------------------------- /examples/meson.build: -------------------------------------------------------------------------------- 1 | # Author: Subhasis Ray 2 | # Date: Sun Jul 7 3 | 4 | examples_src = ['Example.cpp', 5 | 'Ex.cpp'] 6 | 7 | examples_lib = static_library('examples', examples_src) 8 | -------------------------------------------------------------------------------- /external/README: -------------------------------------------------------------------------------- 1 | This folder contains third party software required for MOOSE. The copyright information should be available in the file headers. 2 | -------------------------------------------------------------------------------- /external/boost-numeric-bindings/.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | Makefile 3 | *.swp 4 | *.patch 5 | .svn 6 | *.orig 7 | *.rej 8 | -------------------------------------------------------------------------------- /external/boost-numeric-bindings/LICENSE_1_0.txt: -------------------------------------------------------------------------------- 1 | Boost Software License - Version 1.0 - August 17th, 2003 2 | 3 | Permission is hereby granted, free of charge, to any person or organization 4 | obtaining a copy of the software and accompanying documentation covered by 5 | this license (the "Software") to use, reproduce, display, distribute, 6 | execute, and transmit the Software, and to prepare derivative works of the 7 | Software, and to permit third-parties to whom the Software is furnished to 8 | do so, all subject to the following: 9 | 10 | The copyright notices in the Software and this entire statement, including 11 | the above license grant, this restriction and the following disclaimer, 12 | must be included in all copies of the Software, in whole or in part, and 13 | all derivative works of the Software, unless such copies or derivative 14 | works are solely in the form of machine-executable object code generated by 15 | a source language processor. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /external/boost-numeric-bindings/boost/numeric/bindings/amos/amos_names.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright Toon Knapen 3 | // 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | 9 | #ifndef BOOST_NUMERIC_BINDINGS_AMOS_AMOS_NAMES_H 10 | #define BOOST_NUMERIC_BINDINGS_AMOS_AMOS_NAMES_H 11 | 12 | #include 13 | 14 | #define AMOS_DBESI FORTRAN_ID( dbesi ) 15 | #define AMOS_CBESI FORTRAN_ID( cbesi ) 16 | #define AMOS_ZBESI FORTRAN_ID( zbesi ) 17 | 18 | #define AMOS_DBESJ FORTRAN_ID( dbesj ) 19 | #define AMOS_CBESJ FORTRAN_ID( cbesj ) 20 | #define AMOS_ZBESJ FORTRAN_ID( zbesj ) 21 | 22 | #define AMOS_DBESY FORTRAN_ID( dbesy ) 23 | #define AMOS_CBESY FORTRAN_ID( cbesy ) 24 | #define AMOS_ZBESY FORTRAN_ID( zbesy ) 25 | 26 | #endif // BOOST_NUMERIC_BINDINGS_AMOS_AMOS_NAMES_HPP 27 | -------------------------------------------------------------------------------- /external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Kresimir Fresl 2002 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. 6 | * (See accompanying file LICENSE_1_0.txt or copy at 7 | * http://www.boost.org/LICENSE_1_0.txt) 8 | * 9 | * Author acknowledges the support of the Faculty of Civil Engineering, 10 | * University of Zagreb, Croatia. 11 | * 12 | */ 13 | 14 | #ifndef BOOST_NUMERIC_BINDINGS_CBLAS_HPP 15 | #define BOOST_NUMERIC_BINDINGS_CBLAS_HPP 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /external/boost-numeric-bindings/boost/numeric/bindings/atlas/cblas_inc.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Kresimir Fresl 2002 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. 6 | * (See accompanying file LICENSE_1_0.txt or copy at 7 | * http://www.boost.org/LICENSE_1_0.txt) 8 | * 9 | * Author acknowledges the support of the Faculty of Civil Engineering, 10 | * University of Zagreb, Croatia. 11 | * 12 | */ 13 | 14 | ////////////////////////////////////////////////////////////////////////// 15 | // 16 | // ATLAS (Automatically Tuned Linear Algebra Software) 17 | // 18 | // ''At present, it provides C and Fortran77 interfaces to a portably 19 | // efficient BLAS implementation, as well as a few routines from LAPACK.'' 20 | // 21 | // see: http://math-atlas.sourceforge.net/ 22 | // 23 | ////////////////////////////////////////////////////////////////////////// 24 | 25 | #ifndef BOOST_NUMERIC_BINDINGS_CBLAS_INC_H 26 | #define BOOST_NUMERIC_BINDINGS_CBLAS_INC_H 27 | 28 | extern "C" { 29 | #include 30 | } 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /external/boost-numeric-bindings/boost/numeric/bindings/atlas/clapack_inc.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Kresimir Fresl 2002 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. 6 | * (See accompanying file LICENSE_1_0.txt or copy at 7 | * http://www.boost.org/LICENSE_1_0.txt) 8 | * 9 | * Author acknowledges the support of the Faculty of Civil Engineering, 10 | * University of Zagreb, Croatia. 11 | * 12 | */ 13 | 14 | ////////////////////////////////////////////////////////////////////////// 15 | // 16 | // ATLAS (Automatically Tuned Linear Algebra Software) 17 | // 18 | // ''At present, it provides C and Fortran77 interfaces to a portably 19 | // efficient BLAS implementation, as well as a few routines from LAPACK.'' 20 | // 21 | // see: http://math-atlas.sourceforge.net/ 22 | // 23 | ////////////////////////////////////////////////////////////////////////// 24 | 25 | #ifndef BOOST_NUMERIC_BINDINGS_CLAPACK_INC_H 26 | #define BOOST_NUMERIC_BINDINGS_CLAPACK_INC_H 27 | 28 | extern "C" { 29 | /* see footnote [2] in libs/numeric/bindings/lapack/doc/index.html */ 30 | /* #include */ 31 | #include 32 | } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /external/boost-numeric-bindings/boost/numeric/bindings/blas/blas.hpp: -------------------------------------------------------------------------------- 1 | #ifndef boost_blasbindings_blasbindings_hpp 2 | #define boost_blasbindings_blasbindings_hpp 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | #endif // boost_blasbindings_blasbindings_hpp 10 | -------------------------------------------------------------------------------- /external/boost-numeric-bindings/boost/numeric/bindings/lapack/ilaenv.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Toon Knapen, Kresimir Fresl and Matthias Troyer 2003 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. 6 | * (See accompanying file LICENSE_1_0.txt or copy at 7 | * http://www.boost.org/LICENSE_1_0.txt) 8 | * 9 | * KF acknowledges the support of the Faculty of Civil Engineering, 10 | * University of Zagreb, Croatia. 11 | * 12 | */ 13 | 14 | #ifndef BOOST_NUMERIC_BINDINGS_LAPACK_ILAENV_HPP 15 | #define BOOST_NUMERIC_BINDINGS_LAPACK_ILAENV_HPP 16 | 17 | #include 18 | #include 19 | 20 | namespace boost { namespace numeric { namespace bindings { namespace lapack { 21 | 22 | /* 23 | * ilaenv() is called from the LAPACK routines to choose 24 | * problem-dependent parameters such as the block sizes 25 | * for the local environment. 26 | */ 27 | 28 | inline 29 | int ilaenv (int const ispec, const char* name, const char* opts, 30 | int const n1 = -1, int const n2 = -1, 31 | int const n3 = -1, int const n4 = -1) 32 | { 33 | return ::LAPACK_ILAENV (&ispec, name, opts, &n1, &n2, &n3, &n4, 34 | std::strlen (name), std::strlen (opts)); 35 | } 36 | 37 | 38 | }}}} 39 | 40 | #endif 41 | 42 | -------------------------------------------------------------------------------- /external/boost-numeric-bindings/boost/numeric/bindings/lapack/syevd.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Thomas Klimpel 2008 3 | // 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | 9 | #ifndef BOOST_NUMERIC_BINDINGS_LAPACK_SYEVD_HPP 10 | #define BOOST_NUMERIC_BINDINGS_LAPACK_SYEVD_HPP 11 | 12 | #include 13 | 14 | namespace boost { namespace numeric { namespace bindings { 15 | namespace lapack { 16 | 17 | template 18 | inline int syevd ( 19 | char jobz, char uplo, A& a, 20 | W& w, Work work = optimal_workspace() ) { 21 | 22 | #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK 23 | typedef typename A::value_type value_type ; 24 | typedef typename traits::type_traits< value_type >::real_type real_type ; 25 | BOOST_STATIC_ASSERT((boost::is_same::value)); 26 | #endif 27 | 28 | return heevd (jobz, uplo, a, w, work); 29 | } 30 | } 31 | }}} 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /external/boost-numeric-bindings/boost/numeric/bindings/lapack/syevx.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Thomas Klimpel 2008 3 | // 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | 9 | #ifndef BOOST_NUMERIC_BINDINGS_LAPACK_SYEVX_HPP 10 | #define BOOST_NUMERIC_BINDINGS_LAPACK_SYEVX_HPP 11 | 12 | #include 13 | 14 | namespace boost { namespace numeric { namespace bindings { 15 | namespace lapack { 16 | template 17 | int syevx ( 18 | char jobz, char range, A& a, T vl, T vu, int il, int iu, T abstol, int& m, 19 | W& w, Z& z, IFail& ifail, Work work = optimal_workspace() ) { 20 | 21 | #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK 22 | typedef typename A::value_type value_type ; 23 | typedef typename traits::type_traits< value_type >::real_type real_type ; 24 | BOOST_STATIC_ASSERT((boost::is_same::value)); 25 | #endif 26 | 27 | return heevx (jobz, range, a, vl, vu, il, iu, abstol, m, w, z, ifail, work); 28 | } 29 | } 30 | }}} 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /external/boost-numeric-bindings/boost/numeric/bindings/lapack/sygv.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright Fabien Dekeyser, Quoc-Cuong Pham 2008 3 | // 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | 9 | #ifndef BOOST_NUMERIC_BINDINGS_LAPACK_SYGV_HPP 10 | #define BOOST_NUMERIC_BINDINGS_LAPACK_SYGV_HPP 11 | 12 | #include 13 | 14 | namespace boost { namespace numeric { namespace bindings { 15 | namespace lapack { 16 | 17 | template 18 | int sygv (int itype, char jobz, char uplo, A& a, B& b, W& w, Work work = optimal_workspace()) { 19 | 20 | #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK 21 | typedef typename A::value_type value_type ; 22 | typedef typename traits::type_traits< value_type >::real_type real_type ; 23 | BOOST_STATIC_ASSERT((boost::is_same::value)); 24 | #endif 25 | 26 | return hegv (itype, jobz, uplo, a, b, w, work); 27 | } 28 | } 29 | 30 | }}} 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /external/boost-numeric-bindings/boost/numeric/bindings/mumps/mumps_driver.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright Karl Meerbergen 2007 3 | // 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | 9 | #ifndef BOOST_NUMERIC_BINDINGS_MUMPS_MUMPS_DRIVER_HPP 10 | #define BOOST_NUMERIC_BINDINGS_MUMPS_MUMPS_DRIVER_HPP 11 | 12 | #include 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /external/boost-numeric-bindings/boost/numeric/bindings/traits/algorithm.hpp: -------------------------------------------------------------------------------- 1 | #ifndef boost_numeric_bindings_traits_algorithm_hpp 2 | #define boost_numeric_bindings_traits_algorithm_hpp 3 | 4 | #include 5 | 6 | namespace boost { namespace numeric { namespace bindings { namespace traits { 7 | 8 | /// 9 | /// To be used instead of operator== for numeric types 10 | /// Implemented as functor instead of free function because of specialisation 11 | /// rationale: operator== on builtin types can not be overloaded. 12 | 13 | template < typename T > 14 | struct is_equal 15 | { 16 | is_equal(typename type_traits< T >::real_type tolerance) : tolerance_( tolerance ) {} 17 | 18 | bool operator()(const T& a, const T& b) 19 | { return std::abs( a - b ) < tolerance_ ; } 20 | 21 | // bool operator()(const T& a, const T& b, typename value_traits< T >::value_type tolerance) 22 | // { return std::abs( a - b ) < tolerance ; } 23 | 24 | typename type_traits< T >::real_type tolerance_ ; 25 | } ; 26 | 27 | }}}} 28 | 29 | #endif // boost_numeric_bindings_traits_algorithm_hpp 30 | -------------------------------------------------------------------------------- /external/boost-numeric-bindings/boost/numeric/bindings/traits/boost_array.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2002, 2003 Kresimir Fresl, Toon Knapen and Karl Meerbergen 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. 6 | * (See accompanying file LICENSE_1_0.txt or copy at 7 | * http://www.boost.org/LICENSE_1_0.txt) 8 | * 9 | * KF acknowledges the support of the Faculty of Civil Engineering, 10 | * University of Zagreb, Croatia. 11 | * 12 | */ 13 | 14 | #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_BOOST_ARRAY_H 15 | #define BOOST_NUMERIC_BINDINGS_TRAITS_BOOST_ARRAY_H 16 | 17 | #include 18 | 19 | #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS 20 | 21 | #include 22 | #include 23 | 24 | #else 25 | 26 | #error with your compiler boost::array<> cannot be used in bindings 27 | 28 | #endif 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /external/boost-numeric-bindings/boost/numeric/bindings/traits/config.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2003 3 | // Toon Knapen, Kresimir Fresl, Joerg Walter 4 | // 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | // 9 | 10 | #ifndef BOOST_NUMERIC_BINDINGS_CONFIG_HPP 11 | #define BOOST_NUMERIC_BINDINGS_CONFIG_HPP 12 | 13 | #include 14 | 15 | // Microsoft Visual C++ 16 | #if defined (BOOST_MSVC) 17 | // .. version 6.0 & 7.0 18 | # if BOOST_MSVC <= 1300 19 | # define BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS 20 | # endif 21 | 22 | #elif defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC) 23 | 24 | #elif defined(__IBMCPP__) 25 | 26 | #elif defined(__GNUC__) 27 | 28 | #elif defined(__COMO__) 29 | 30 | #elif defined(__KCC) 31 | 32 | #elif defined(__sgi) 33 | 34 | #else 35 | // temporarily deactivate error message, 36 | // because the checks above are no longer in sync with "boost/config/select_compiler_config.hpp" 37 | //#error bindings do not recognise compiler 38 | #endif 39 | 40 | 41 | #if defined (BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS) 42 | 43 | // structure checks require proper traits 44 | # define BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK 45 | 46 | // type checks require proper traits 47 | # define BOOST_NUMERIC_BINDINGS_NO_TYPE_CHECK 48 | 49 | #endif 50 | 51 | #endif 52 | 53 | -------------------------------------------------------------------------------- /external/boost-numeric-bindings/boost/numeric/bindings/traits/dense_traits.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright Markus Rickert 2008 3 | // 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | 9 | #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_DENSE_TRAITS_H 10 | #define BOOST_NUMERIC_BINDINGS_TRAITS_DENSE_TRAITS_H 11 | 12 | #include 13 | 14 | #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS 15 | 16 | #include 17 | #include 18 | 19 | namespace boost { namespace numeric { namespace bindings { namespace traits { 20 | 21 | template 22 | inline 23 | std::ptrdiff_t 24 | dense_matrix_stride1 (M& m) { 25 | return detail::dense_ordering< typename matrix_traits::ordering_type >::stride1 (m); 26 | } 27 | template 28 | inline 29 | std::ptrdiff_t 30 | dense_matrix_stride2 (M& m) { 31 | return detail::dense_ordering< typename matrix_traits::ordering_type >::stride2 (m); 32 | } 33 | 34 | }}}} 35 | 36 | #else // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS 37 | 38 | #error with your compiler dense matrices cannot be used in bindings 39 | 40 | #endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS 41 | 42 | #endif // BOOST_NUMERIC_BINDINGS_TRAITS_DENSE_TRAITS_H 43 | -------------------------------------------------------------------------------- /external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/array.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Kresimir Fresl 2003 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. 6 | * (See accompanying file LICENSE_1_0.txt or copy at 7 | * http://www.boost.org/LICENSE_1_0.txt) 8 | * 9 | * Author acknowledges the support of the Faculty of Civil Engineering, 10 | * University of Zagreb, Croatia. 11 | * 12 | */ 13 | 14 | #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_DETAIL_ARRAY_HPP 15 | #define BOOST_NUMERIC_BINDINGS_TRAITS_DETAIL_ARRAY_HPP 16 | 17 | #include 18 | 19 | #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS 20 | 21 | #include 22 | 23 | namespace boost { namespace numeric { namespace bindings { namespace traits { 24 | 25 | template 26 | struct vector_traits > { 27 | typedef T value_type; 28 | typedef std::ptrdiff_t size_type; 29 | typedef T* pointer; 30 | 31 | static pointer storage (detail::array& a) { return a.storage(); } 32 | static size_type size (detail::array& a) { return a.size(); } 33 | }; 34 | 35 | 36 | }}}} 37 | 38 | #endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS 39 | 40 | #endif // BOOST_NUMERIC_BINDINGS_TRAITS_DETAIL_ARRAY_HPP 41 | -------------------------------------------------------------------------------- /external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/dense_ordering.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright Markus Rickert 2008 3 | // 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | 9 | #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_DETAIL_DENSE_ORDERING_H 10 | #define BOOST_NUMERIC_BINDINGS_TRAITS_DETAIL_DENSE_ORDERING_H 11 | 12 | #include 13 | 14 | namespace boost { namespace numeric { namespace bindings { namespace traits { 15 | 16 | namespace detail { 17 | 18 | template 19 | struct dense_ordering {}; 20 | 21 | template<> 22 | struct dense_ordering { 23 | typedef row_major_t type; 24 | 25 | template 26 | static std::ptrdiff_t stride1( M const& m ) { 27 | return leading_dimension (m) ; 28 | } 29 | 30 | template 31 | static std::ptrdiff_t stride2( M const& m ) { 32 | return 1 ; 33 | } 34 | }; 35 | 36 | template<> 37 | struct dense_ordering { 38 | typedef column_major_t type; 39 | 40 | template 41 | static std::ptrdiff_t stride1( M const& m ) { 42 | return 1 ; 43 | } 44 | 45 | template 46 | static std::ptrdiff_t stride2( M const& m ) { 47 | return leading_dimension (m) ; 48 | } 49 | }; 50 | 51 | } 52 | 53 | }}}} 54 | 55 | #endif // BOOST_NUMERIC_BINDINGS_TRAITS_DETAIL_DENSE_ORDERING_H 56 | -------------------------------------------------------------------------------- /external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/generate_const.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2002, 2003 Kresimir Fresl, Toon Knapen and Karl Meerbergen 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. 6 | * (See accompanying file LICENSE_1_0.txt or copy at 7 | * http://www.boost.org/LICENSE_1_0.txt) 8 | * 9 | * First author acknowledges the support of the Faculty of Civil 10 | * Engineering, University of Zagreb, Croatia. 11 | * 12 | */ 13 | 14 | #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_DETAIL_GENERATE_CONST_HPP 15 | #define BOOST_NUMERIC_BINDINGS_TRAITS_DETAIL_GENERATE_CONST_HPP 16 | 17 | #include 18 | 19 | #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS 20 | 21 | namespace boost { namespace numeric { namespace bindings { namespace traits { namespace detail { 22 | 23 | /// Copy const from V to X if present 24 | 25 | template 26 | struct generate_const { 27 | typedef X type; 28 | }; 29 | 30 | template 31 | struct generate_const< const V, X > { 32 | typedef X const type; 33 | }; 34 | 35 | template 36 | struct generate_const< V const, X const > { 37 | typedef X const type; 38 | }; 39 | 40 | template 41 | struct generate_const< const T[N], X > { 42 | typedef X const type; 43 | }; 44 | 45 | template 46 | struct generate_const< const T[N], X const > { 47 | typedef X const type; 48 | }; 49 | 50 | }}}}} 51 | 52 | #endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS 53 | 54 | #endif // BOOST_NUMERIC_BINDINGS_TRAITS_DETAIL_GENERATE_CONST_HPP 55 | -------------------------------------------------------------------------------- /external/boost-numeric-bindings/boost/numeric/bindings/traits/detail/ublas_uplo.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Kresimir Fresl 2002 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. 6 | * (See accompanying file LICENSE_1_0.txt or copy at 7 | * http://www.boost.org/LICENSE_1_0.txt) 8 | * 9 | * Author acknowledges the support of the Faculty of Civil Engineering, 10 | * University of Zagreb, Croatia. 11 | * 12 | */ 13 | 14 | #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_UBLAS_UPLO_H 15 | #define BOOST_NUMERIC_BINDINGS_TRAITS_UBLAS_UPLO_H 16 | 17 | #include 18 | 19 | namespace boost { namespace numeric { namespace bindings { namespace traits { 20 | 21 | namespace detail { 22 | 23 | template 24 | struct ublas_uplo {}; 25 | 26 | template<> 27 | struct ublas_uplo { 28 | typedef lower_t type; 29 | }; 30 | template<> 31 | struct ublas_uplo { 32 | typedef upper_t type; 33 | }; 34 | 35 | } 36 | 37 | }}}} 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /external/boost-numeric-bindings/boost/numeric/bindings/traits/fortran.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2002, 2003 Si-Lab b.v.b.a., Toon Knapen and Kresimir Fresl 3 | // 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | 9 | #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_FORTRAN_H 10 | #define BOOST_NUMERIC_BINDINGS_TRAITS_FORTRAN_H 11 | 12 | #if defined(BIND_FORTRAN_LOWERCASE_UNDERSCORE) || defined(BIND_FORTRAN_LOWERCASE) 13 | // Allow manual override of the defaults, e.g. if you want to use a fortran 14 | // lib compiled with gcc from MSVC 15 | #else 16 | 17 | // First we need to know what the conventions for linking 18 | // C with Fortran is on this platform/toolset 19 | #if defined(__GNUC__) || defined(__ICC) || defined(__sgi) || defined(__COMO__) || defined(__KCC) 20 | #define BIND_FORTRAN_LOWERCASE_UNDERSCORE 21 | #elif defined(__IBMCPP__) || defined(_MSC_VER) 22 | #define BIND_FORTRAN_LOWERCASE 23 | #else 24 | #error do not know how to link with fortran for the given platform 25 | #endif 26 | 27 | #endif 28 | 29 | // Next we define macro's to convert our symbols to 30 | // the current convention 31 | #if defined(BIND_FORTRAN_LOWERCASE_UNDERSCORE) 32 | #define FORTRAN_ID( id ) id##_ 33 | #elif defined(BIND_FORTRAN_LOWERCASE) 34 | #define FORTRAN_ID( id ) id 35 | #else 36 | #error do not know how to bind to fortran calling convention 37 | #endif 38 | 39 | #endif // BOOST_NUMERIC_BINDINGS_TRAITS_FORTRAN_H 40 | -------------------------------------------------------------------------------- /external/boost-numeric-bindings/boost/numeric/bindings/traits/std_vector.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2002, 2003 Kresimir Fresl, Toon Knapen and Karl Meerbergen 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. 6 | * (See accompanying file LICENSE_1_0.txt or copy at 7 | * http://www.boost.org/LICENSE_1_0.txt) 8 | * 9 | * KF acknowledges the support of the Faculty of Civil Engineering, 10 | * University of Zagreb, Croatia. 11 | * 12 | */ 13 | 14 | #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_STD_VECTOR_H 15 | #define BOOST_NUMERIC_BINDINGS_TRAITS_STD_VECTOR_H 16 | 17 | #include 18 | 19 | #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS 20 | 21 | #include 22 | 23 | 24 | namespace boost { namespace numeric { namespace bindings { namespace traits { 25 | 26 | // std::vector<> 27 | template 28 | struct vector_detail_traits, V> 29 | : default_vector_traits< V, T > 30 | { 31 | 32 | #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK 33 | BOOST_STATIC_ASSERT( (boost::is_same< std::vector, typename boost::remove_const::type >::value) ); 34 | #endif 35 | 36 | typedef std::vector identifier_type; 37 | typedef V vector_type; 38 | typedef typename default_vector_traits< V, T >::pointer pointer; 39 | 40 | static pointer storage (vector_type& v) { return &v.front(); } 41 | }; 42 | 43 | }}}} 44 | 45 | #endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS 46 | 47 | #endif // BOOST_NUMERIC_BINDINGS_TRAITS_STD_VECTOR_H 48 | -------------------------------------------------------------------------------- /external/boost-numeric-bindings/boost/numeric/bindings/traits/traits.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2002, 2003 Kresimir Fresl, Toon Knapen and Karl Meerbergen 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. 6 | * (See accompanying file LICENSE_1_0.txt or copy at 7 | * http://www.boost.org/LICENSE_1_0.txt) 8 | * 9 | * KF acknowledges the support of the Faculty of Civil Engineering, 10 | * University of Zagreb, Croatia. 11 | * 12 | */ 13 | 14 | #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_H 15 | #define BOOST_NUMERIC_BINDINGS_TRAITS_H 16 | 17 | #include 18 | #include 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /external/boost-numeric-bindings/boost/numeric/bindings/traits/transpose.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright Kresimir Fresl, Toon Knapen, and Karl Meerbergen 2002, 2003 3 | // 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | 9 | #ifndef BOOST_BINDINGS_TRANSPOSE_HPP 10 | #define BOOST_BINDINGS_TRANSPOSE_HPP 11 | 12 | namespace boost { namespace numeric { namespace bindings { namespace traits { 13 | 14 | const char NO_TRANSPOSE = 'N' ; 15 | const char TRANSPOSE = 'T' ; 16 | const char CONJUGATE = 'C' ; 17 | 18 | }}}} 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /external/boost-numeric-bindings/boost/numeric/bindings/traits/type.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2000,2001,2002,2003 Si-Lab b.v.b.a. and Toon Knapen 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. 5 | * (See accompanying file LICENSE_1_0.txt or copy at 6 | * http://www.boost.org/LICENSE_1_0.txt) 7 | * 8 | */ 9 | 10 | #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_TYPE_H 11 | #define BOOST_NUMERIC_BINDINGS_TRAITS_TYPE_H 12 | 13 | /* 14 | * This header defines the C types that will be mapped to 15 | * COMPLEX and COMPLEX*16 of Fortran 16 | */ 17 | 18 | #ifndef BOOST_NUMERIC_BINDINGS_USE_COMPLEX_STRUCT 19 | 20 | typedef float fcomplex_t ; 21 | typedef double dcomplex_t ; 22 | 23 | #else 24 | 25 | typedef 26 | union { 27 | float cmplx[2] ; 28 | double align_struct_ ; 29 | } fcomplex_t ; 30 | 31 | typedef 32 | struct { 33 | double cmplx[2] ; 34 | } dcomplex_t ; 35 | 36 | #endif /* BOOST_NUMERIC_BINDINGS_USE_COMPLEX_STRUCT */ 37 | 38 | /* 39 | * Define a fortran LOGICAL as a void (for now). 40 | */ 41 | 42 | typedef void logical_t ; 43 | 44 | #endif /* BOOST_NUMERIC_BINDINGS_TRAITS_TYPE_H */ 45 | -------------------------------------------------------------------------------- /external/boost-numeric-bindings/boost/numeric/bindings/traits/type.hpp: -------------------------------------------------------------------------------- 1 | #ifndef boost_numeric_bindings_type_hpp 2 | #define boost_numeric_bindings_type_hpp 3 | 4 | // This header provides typedefs to float complex and double complex. 5 | // This makes it possible to redefine the complex class being used. 6 | 7 | #include 8 | 9 | namespace boost { namespace numeric { namespace bindings { namespace traits { 10 | 11 | /* The types for single and double precision complex numbers. 12 | * You can use your own types if you define 13 | * BOOST_NUMERIC_BINDINGS_USE_CUSTOM_COMPLEX_TYPE. 14 | * Note that these types must have the same memory layout as the 15 | * corresponding FORTRAN types. 16 | * For that reason you can even use a different type in each translation 17 | * unit and the resulting binary will still work! 18 | */ 19 | #ifndef BOOST_NUMERIC_BINDINGS_USE_CUSTOM_COMPLEX_TYPE 20 | typedef std::complex< float > complex_f ; 21 | typedef std::complex< double > complex_d ; 22 | #endif 23 | 24 | template 25 | T real (std::complex const& c) { return std::real (c); } 26 | template 27 | T imag (std::complex const& c) { return std::imag (c); } 28 | 29 | }}}} 30 | 31 | #endif // boost_numeric_bindings_type_hpp 32 | -------------------------------------------------------------------------------- /external/fmt/include/fmt/posix.h: -------------------------------------------------------------------------------- 1 | #include "os.h" 2 | #warning "fmt/posix.h is deprecated; use fmt/os.h instead" -------------------------------------------------------------------------------- /external/fmt/meson.build: -------------------------------------------------------------------------------- 1 | # Author: Subhasis Ray 2 | # Date: Sun Jul 7 3 | 4 | fmt_src = [ 5 | 'src/format.cc', 6 | 'src/os.cc' 7 | ] 8 | 9 | incdir = include_directories('include') 10 | 11 | fmt_lib = static_library('fmt', fmt_src, include_directories: incdir) 12 | -------------------------------------------------------------------------------- /external/getopt/getopt.c: -------------------------------------------------------------------------------- 1 | /* ***************************************************************** 2 | * 3 | * Copyright 2016 Microsoft 4 | * 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | ******************************************************************/ 19 | 20 | #include "getopt.h" 21 | #include 22 | 23 | char* optarg = NULL; 24 | int optind = 1; 25 | 26 | int getopt(int argc, char *const argv[], const char *optstring) 27 | { 28 | if ((optind >= argc) || (argv[optind][0] != '-') || (argv[optind][0] == 0)) 29 | { 30 | return -1; 31 | } 32 | 33 | int opt = argv[optind][1]; 34 | const char *p = strchr(optstring, opt); 35 | 36 | if (p == NULL) 37 | { 38 | return '?'; 39 | } 40 | if (p[1] == ':') 41 | { 42 | optind++; 43 | if (optind >= argc) 44 | { 45 | return '?'; 46 | } 47 | optarg = argv[optind]; 48 | optind++; 49 | } 50 | return opt; 51 | } 52 | 53 | -------------------------------------------------------------------------------- /external/getopt/getopt.h: -------------------------------------------------------------------------------- 1 | /* ***************************************************************** 2 | * 3 | * Copyright 2016 Microsoft 4 | * 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | ******************************************************************/ 19 | 20 | #ifndef GETOPT_H__ 21 | #define GETOPT_H__ 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | extern char *optarg; 28 | extern int optind; 29 | 30 | int getopt(int argc, char *const argv[], const char *optstring); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif 37 | 38 | -------------------------------------------------------------------------------- /external/getopt/meson.build: -------------------------------------------------------------------------------- 1 | # Author: Subhasis Ray 2 | # Date: Sun Jul 7 3 | 4 | getopt_lib = static_library('getopt', ['getopt.c']) 5 | -------------------------------------------------------------------------------- /external/libsoda/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Dilawar Singh 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /external/libsoda/README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/dilawar/libsoda.svg?branch=master)](https://travis-ci.org/dilawar/libsoda) 2 | 3 | ## libsoda++ 4 | 5 | This is `c++11` version of LSODA library. See the `./test_LSODA.cpp` file for example. 6 | 7 | ## CREDIT 8 | 9 | This work is based on http://lh3lh3.users.sourceforge.net/download/lsoda.c . 10 | 11 | Related projects: 12 | 13 | 1. https://github.com/sdwfrost/liblsoda 14 | -------------------------------------------------------------------------------- /external/libsoda/helper.h: -------------------------------------------------------------------------------- 1 | #ifndef HELPER_H 2 | #define HELPER_H 3 | 4 | template bool areEqual(T a, T b) { 5 | return std::fabs(a - b) < 1e-6; 6 | } 7 | 8 | template 9 | void print_vec(const vector &v, const string prefix = "") { 10 | cout << prefix << " SIZE=" << v.size() << " : "; 11 | for (auto x : v) 12 | cout << x << ','; 13 | cout << endl; 14 | } 15 | 16 | template 17 | void print_arr( const double* a, const size_t n, const string prefix="" ) { 18 | cout << prefix << " SIZE=" << n << " : "; 19 | for (size_t i = 0; i < n; i++) 20 | cout << a[i] << ','; 21 | cout << endl; 22 | } 23 | 24 | #endif /* end of include guard: HELPER_H */ 25 | -------------------------------------------------------------------------------- /external/libsoda/meson.build: -------------------------------------------------------------------------------- 1 | # Author: Subhasis Ray 2 | # Date: Sun Jul 7, 2024 3 | 4 | threads_dep = dependency('Threads') 5 | 6 | lsoda_lib = static_library('soda', ['LSODA.cpp'], dependencies: threads_dep) 7 | -------------------------------------------------------------------------------- /external/libsoda/run_benchmark.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | set -x 4 | valgrind --tool=callgrind --callgrind-out-file=callgrind.out ./test_lsoda 5 | gprof2dot -f callgrind ./callgrind.out > callgrind.prof.dot 6 | dot -Tpng ./callgrind.prof.dot > lsoda_prof.png 7 | -------------------------------------------------------------------------------- /external/tinyexpr/.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | 3 | compiler: 4 | - clang 5 | - gcc 6 | 7 | script: make 8 | -------------------------------------------------------------------------------- /external/tinyexpr/CONTRIBUTING: -------------------------------------------------------------------------------- 1 | A core strength of TinyExpr is that it is small and simple. This makes it easy 2 | to add new features. However, if we keep adding new features, it'll no longer 3 | be small or simple. In other words, each new feature corrodes away at the core 4 | strength of TinyExpr. 5 | 6 | If you want to add a new feature, and you expect me to merge it, please discuss 7 | it with me before you go to that work. Open an issue at 8 | https://github.com/codeplea/tinyexpr and let us know what you're proposing. 9 | 10 | Bug fixes are always welcome and appreciated, of course. 11 | -------------------------------------------------------------------------------- /external/tinyexpr/LICENSE: -------------------------------------------------------------------------------- 1 | zlib License 2 | 3 | Copyright (C) 2015, 2016 Lewis Van Winkle 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgement in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | 21 | -------------------------------------------------------------------------------- /external/tinyexpr/doc/e1.dot: -------------------------------------------------------------------------------- 1 | digraph G { 2 | "+" -> "sin"; 3 | "+" -> div; 4 | "sin" -> "x"; 5 | div -> "1"; 6 | div -> "4"; 7 | div [label="÷"] 8 | } 9 | -------------------------------------------------------------------------------- /external/tinyexpr/doc/e1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BhallaLab/moose-core/e2198017d1203671a422ce2825b1e7b4656e8e00/external/tinyexpr/doc/e1.png -------------------------------------------------------------------------------- /external/tinyexpr/doc/e2.dot: -------------------------------------------------------------------------------- 1 | digraph G { 2 | "+" -> "sin"; 3 | "+" -> "0.25"; 4 | "sin" -> "x"; 5 | } 6 | -------------------------------------------------------------------------------- /external/tinyexpr/doc/e2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BhallaLab/moose-core/e2198017d1203671a422ce2825b1e7b4656e8e00/external/tinyexpr/doc/e2.png -------------------------------------------------------------------------------- /external/tinyexpr/example.c: -------------------------------------------------------------------------------- 1 | #include "tinyexpr.h" 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | const char *c = "sqrt(5^2+7^2+11^2+(8-2)^2)"; 7 | double r = te_interp(c, 0); 8 | printf("The expression:\n\t%s\nevaluates to:\n\t%f\n", c, r); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /external/tinyexpr/example2.c: -------------------------------------------------------------------------------- 1 | #include "tinyexpr.h" 2 | #include 3 | #include 4 | 5 | double H( double a) 6 | { 7 | return pow(a, 3.0); 8 | } 9 | 10 | int main(int argc, char *argv[]) 11 | { 12 | const char* expr = "p + g + l + len + dia + h(1-l)"; 13 | printf("Evaluating:\n\t%s\n", expr); 14 | 15 | /* This shows an example where the variables 16 | * x and y are bound at eval-time. */ 17 | double p, g, L, len, dia; 18 | te_variable vars[] = {{"p", &p}, {"g", &g}, {"l", &L}, {"len", &len}, {"dia", &dia} 19 | , { "h", H, TE_FUNCTION1} 20 | }; 21 | 22 | 23 | /* This will compile the expression and check for errors. */ 24 | int err; 25 | te_expr *n = te_compile(expr, vars, 6, &err); 26 | 27 | if (n) { 28 | /* The variables can be changed here, and eval can be called as many 29 | * times as you like. This is fairly efficient because the parsing has 30 | * already been done. */ 31 | p = 1; g = 0.1; L = 10; len = 2; dia = 0.2; 32 | const double r = te_eval(n); printf("Result:\n\t%f\n", r); 33 | 34 | te_free(n); 35 | } else { 36 | /* Show the user where the error is at. */ 37 | printf("\t%*s^\nError near here", err-1, ""); 38 | } 39 | 40 | 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /external/tinyexpr/example3.c: -------------------------------------------------------------------------------- 1 | #include "tinyexpr.h" 2 | #include 3 | 4 | 5 | /* An example of calling a C function. */ 6 | double my_sum(double a, double b) { 7 | printf("Called C function with %f and %f.\n", a, b); 8 | return a + b; 9 | } 10 | 11 | 12 | int main(int argc, char *argv[]) 13 | { 14 | te_variable vars[] = { 15 | {"mysum", my_sum, TE_FUNCTION2} 16 | }; 17 | 18 | const char *expression = "mysum(5, 6)"; 19 | printf("Evaluating:\n\t%s\n", expression); 20 | 21 | int err; 22 | te_expr *n = te_compile(expression, vars, 1, &err); 23 | 24 | if (n) { 25 | const double r = te_eval(n); 26 | printf("Result:\n\t%f\n", r); 27 | te_free(n); 28 | } else { 29 | /* Show the user where the error is at. */ 30 | printf("\t%*s^\nError near here", err-1, ""); 31 | } 32 | 33 | 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /hsolve/CTestTestfile.cmake: -------------------------------------------------------------------------------- 1 | # CMake generated Testfile for 2 | # Source directory: /home/dilawar/Work/NCBS/moose_svn_1.8/moose/branches/async_multiscale_cmake/hsolve 3 | # Build directory: /home/dilawar/Work/NCBS/moose_svn_1.8/moose/branches/async_multiscale_cmake/hsolve 4 | # 5 | # This file includes the relevant testing commands required for 6 | # testing this directory and lists subdirectories to be tested as well. 7 | -------------------------------------------------------------------------------- /hsolve/README.txt: -------------------------------------------------------------------------------- 1 | A high-level overview for the HSolve code can be found at: 2 | Docs/developer/HSolve-developer-overview.cpp 3 | 4 | The 'doxygen' tool can be used to convert this file into an easy-to-read HTML 5 | document. Run 'doxygen' in the top-level directory of the MOOSE source tree to 6 | generate all the HTML docs. The HTML docs can also be found on the MOOSE 7 | website (http://moose.ncbs.res.in/) in the Developer Documentation section. 8 | -------------------------------------------------------------------------------- /hsolve/TestHSolve.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment. 4 | ** copyright (C) 2003-2007 Upinder S. Bhalla, Niraj Dudani and NCBS 5 | ** It is made available under the terms of the 6 | ** GNU Lesser General Public License version 2.1 7 | ** See the file COPYING.LIB for the full notice. 8 | **********************************************************************/ 9 | 10 | #ifndef _TEST_HSOLVE_H 11 | #define _TEST_HSOLVE_H 12 | 13 | void makeFullMatrix( 14 | const vector< TreeNodeStruct >& tree, 15 | double dt, 16 | vector< vector< double > >& matrix ); 17 | 18 | template< class T > 19 | void permute( 20 | vector< T >& g, 21 | const vector< unsigned int >& permutation ) 22 | { 23 | assert( g.size() == permutation.size() ); 24 | 25 | vector< T > copy( g.size() ); 26 | 27 | for ( unsigned int i = 0; i < g.size(); i++ ) 28 | copy[ permutation[ i ] ] = g[ i ]; 29 | 30 | for ( unsigned int i = 0; i < g.size(); i++ ) 31 | g[ i ] = copy[ i ]; 32 | } 33 | 34 | #endif // _TEST_HSOLVE_H 35 | -------------------------------------------------------------------------------- /hsolve/meson.build: -------------------------------------------------------------------------------- 1 | # Author: Subhasis Ray 2 | # Date: Sun Jul 7 3 | 4 | hsolve_src = ['HSolveStruct.cpp', 5 | 'HinesMatrix.cpp', 6 | 'Cell.cpp', 7 | 'HSolvePassive.cpp', 8 | 'RateLookup.cpp', 9 | 'HSolveActive.cpp', 10 | 'HSolveActiveSetup.cpp', 11 | 'HSolveInterface.cpp', 12 | 'HSolve.cpp', 13 | 'HSolveUtils.cpp', 14 | 'testHSolve.cpp', 15 | 'ZombieCompartment.cpp', 16 | 'ZombieCaConc.cpp', 17 | 'ZombieHHChannel.cpp'] 18 | 19 | hsolve_lib = static_library('hsolve', hsolve_src) 20 | -------------------------------------------------------------------------------- /intfire/ExIF.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment, 4 | ** also known as GENESIS 3 base code. 5 | ** copyright (C) 2003-2006 Upinder S. Bhalla. and NCBS 6 | ** It is made available under the terms of the 7 | ** GNU Lesser General Public License version 2.1 8 | ** See the file COPYING.LIB for the full notice. 9 | **********************************************************************/ 10 | 11 | #ifndef _ExIF_H 12 | #define _ExIF_H 13 | 14 | namespace moose 15 | { 16 | /** 17 | * The IntFire class sets up an integrate-and-fire compartment. 18 | */ 19 | class ExIF: public IntFireBase 20 | { 21 | public: 22 | ExIF(); 23 | virtual ~ExIF(); 24 | 25 | void setDeltaThresh( const Eref& e, double val ); 26 | double getDeltaThresh( const Eref& e ) const; 27 | void setVPeak( const Eref& e, double val ); 28 | double getVPeak( const Eref& e ) const; 29 | 30 | /** 31 | * The process function does the object updating and sends out 32 | * messages to channels, nernsts, and so on. 33 | */ 34 | void vProcess( const Eref& e, ProcPtr p ); 35 | 36 | /** 37 | * The reinit function reinitializes all fields. 38 | */ 39 | void vReinit( const Eref& e, ProcPtr p ); 40 | 41 | /** 42 | * Initializes the class info. 43 | */ 44 | static const Cinfo* initCinfo(); 45 | 46 | protected: // needed in AdExIF 47 | double deltaThresh_; 48 | double vPeak_; 49 | }; 50 | } 51 | 52 | #endif // _ExIF_H 53 | -------------------------------------------------------------------------------- /intfire/LIF.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment, 4 | ** also known as GENESIS 3 base code. 5 | ** copyright (C) 2003-2006 Upinder S. Bhalla. and NCBS 6 | ** It is made available under the terms of the 7 | ** GNU Lesser General Public License version 2.1 8 | ** See the file COPYING.LIB for the full notice. 9 | **********************************************************************/ 10 | 11 | #ifndef _LIF_H 12 | #define _LIF_H 13 | 14 | namespace moose 15 | { 16 | 17 | /** 18 | * The IntFire class sets up an integrate-and-fire compartment. 19 | */ 20 | class LIF: public IntFireBase 21 | { 22 | public: 23 | LIF(); 24 | virtual ~LIF(); 25 | /** 26 | * The process function does the object updating and sends out 27 | * messages to channels, nernsts, and so on. 28 | */ 29 | void vProcess( const Eref& e, ProcPtr p ); 30 | 31 | /** 32 | * The reinit function reinitializes all fields. 33 | */ 34 | void vReinit( const Eref& e, ProcPtr p ); 35 | 36 | /** 37 | * Initializes the class info. 38 | */ 39 | static const Cinfo* initCinfo(); 40 | }; 41 | 42 | } 43 | 44 | #endif // _LIF_H 45 | -------------------------------------------------------------------------------- /intfire/QIF.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment, 4 | ** also known as GENESIS 3 base code. 5 | ** copyright (C) 2003-2006 Upinder S. Bhalla. and NCBS 6 | ** It is made available under the terms of the 7 | ** GNU Lesser General Public License version 2.1 8 | ** See the file COPYING.LIB for the full notice. 9 | **********************************************************************/ 10 | 11 | #ifndef _QIF_H 12 | #define _QIF_H 13 | 14 | namespace moose 15 | { 16 | /** 17 | * The Quadratic Integrate and Fire class 18 | * sets up an integrate-and-fire compartment, 19 | * with a qudratic sub threshold behaviour. 20 | */ 21 | class QIF: public IntFireBase 22 | { 23 | public: 24 | QIF(); 25 | virtual ~QIF(); 26 | 27 | void setVCritical( const Eref& e, double val ); 28 | double getVCritical( const Eref& e ) const; 29 | void setA0( const Eref& e, double val ); 30 | double getA0( const Eref& e ) const; 31 | 32 | /** 33 | * The process function does the object updating and sends out 34 | * messages to channels, nernsts, and so on. 35 | */ 36 | void vProcess( const Eref& e, ProcPtr p ); 37 | 38 | /** 39 | * The reinit function reinitializes all fields. 40 | */ 41 | void vReinit( const Eref& e, ProcPtr p ); 42 | 43 | /** 44 | * Initializes the class info. 45 | */ 46 | static const Cinfo* initCinfo(); 47 | 48 | private: 49 | double vCritical_; 50 | double a0_; 51 | }; 52 | } 53 | 54 | #endif // _QIF_H 55 | -------------------------------------------------------------------------------- /intfire/meson.build: -------------------------------------------------------------------------------- 1 | # Author: Subhasis Ray 2 | # Date: Sun Jul 7 3 | 4 | intfire_src = ['AdExIF.cpp', 5 | 'AdThreshIF.cpp', 6 | 'ExIF.cpp', 7 | 'IntFireBase.cpp', 8 | 'IzhIF.cpp', 9 | 'LIF.cpp', 10 | 'QIF.cpp', 11 | 'testIntFire.cpp'] 12 | intfire_lib = static_library('intfire', intfire_src) 13 | -------------------------------------------------------------------------------- /intfire/testIntFire.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment. 4 | ** Copyright (C) 2003-2013 Upinder S. Bhalla. and NCBS 5 | ** It is made available under the terms of the 6 | ** GNU Lesser General Public License version 2.1 7 | ** See the file COPYING.LIB for the full notice. 8 | **********************************************************************/ 9 | 10 | 11 | #include "../basecode/header.h" 12 | #include "../shell/Shell.h" 13 | #include "../biophysics/CompartmentBase.h" 14 | #include "../biophysics/Compartment.h" 15 | #include "IntFireBase.h" 16 | 17 | // This tests stuff without using the messaging. 18 | void testIntFire() 19 | { 20 | #if 0 21 | test network 22 | #endif 23 | } 24 | 25 | // This is applicable to tests that use the messaging and scheduling. 26 | void testIntFireProcess() 27 | { 28 | } 29 | -------------------------------------------------------------------------------- /kinetics/MMenz.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment. 4 | ** Copyright (C) 2003-2010 Upinder S. Bhalla. and NCBS 5 | ** It is made available under the terms of the 6 | ** GNU Lesser General Public License version 2.1 7 | ** See the file COPYING.LIB for the full notice. 8 | **********************************************************************/ 9 | 10 | #ifndef _MM_ENZ_H 11 | #define _MM_ENZ_H 12 | 13 | /** 14 | * This class represents the Michaelis-Menten type enzyme, obeying the 15 | * equation 16 | * V = kcat.[Etot].[S]/( Km + [S] ) 17 | */ 18 | class MMenz: public EnzBase 19 | { 20 | public: 21 | MMenz(); 22 | virtual ~MMenz(); 23 | 24 | ////////////////////////////////////////////////////////////////// 25 | // Field assignment stuff 26 | ////////////////////////////////////////////////////////////////// 27 | 28 | void vSetKm( const Eref& e, double v ); 29 | void vSetKcat( const Eref& e, double v ); 30 | 31 | ////////////////////////////////////////////////////////////////// 32 | // Dest funcs 33 | ////////////////////////////////////////////////////////////////// 34 | // sub, prd, enz, remesh are all defined in EnzBase as dummies. 35 | 36 | void setSolver( const Eref& e, ObjId solver ); 37 | static const Cinfo* initCinfo(); 38 | private: 39 | Stoich* stoich_; 40 | }; 41 | 42 | #endif // MM_ENZ_H 43 | -------------------------------------------------------------------------------- /kinetics/Species.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment. 4 | ** Copyright (C) 2003-2011 Upinder S. Bhalla. and NCBS 5 | ** It is made available under the terms of the 6 | ** GNU Lesser General Public License version 2.1 7 | ** See the file COPYING.LIB for the full notice. 8 | **********************************************************************/ 9 | 10 | #ifndef _SPECIES_H 11 | #define _SPECIES_H 12 | 13 | /** 14 | * The species is a unique chemically distinct compound. 15 | * Examples are Ca2+, PKC, H2O 16 | * Each pool is associated with a chemical species. 17 | * Each molecule is associated with a species too. 18 | */ 19 | class Species 20 | { 21 | public: 22 | Species(); 23 | ////////////////////////////////////////////////////////////////// 24 | // Field assignment stuff 25 | ////////////////////////////////////////////////////////////////// 26 | 27 | void setMolWt( double v ); 28 | double getMolWt() const; 29 | 30 | ////////////////////////////////////////////////////////////////// 31 | // DestFinfo 32 | ////////////////////////////////////////////////////////////////// 33 | 34 | void handleMolWtRequest( const Eref& e ); 35 | 36 | ////////////////////////////////////////////////////////////////// 37 | static const Cinfo* initCinfo(); 38 | private: 39 | double molWt_; 40 | }; 41 | 42 | #endif // _SPECIES_H 43 | -------------------------------------------------------------------------------- /kinetics/meson.build: -------------------------------------------------------------------------------- 1 | # Author: Subhasis Ray 2 | # Date: Sun Jul 7 3 | 4 | kinetics_src = ['PoolBase.cpp', 5 | 'Reac.cpp', 6 | 'EnzBase.cpp', 7 | 'Enz.cpp', 8 | 'MMenz.cpp', 9 | 'Species.cpp', 10 | 'ConcChan.cpp', 11 | 'ReadKkit.cpp', 12 | 'WriteKkit.cpp', 13 | 'ReadCspace.cpp', 14 | 'lookupVolumeFromMesh.cpp', 15 | 'testKinetics.cpp'] 16 | 17 | kinetics_lib = static_library('kinetics', kinetics_src, include_directories: gsl_dep.get_variable(pkgconfig:'includedir')) 18 | -------------------------------------------------------------------------------- /ksolve/BoostSys.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ===================================================================================== 3 | * 4 | * Filename: BoostSystem.cpp 5 | * 6 | * Description: Ode system described boost library. 7 | * 8 | * Created: 04/11/2016 10:58:34 AM 9 | * Compiler: g++ 10 | * 11 | * Author: Dilawar Singh (), dilawars@ncbs.res.in 12 | * Organization: NCBS Bangalore 13 | * 14 | * ===================================================================================== 15 | */ 16 | 17 | #include "../utility/boost_ode.h" 18 | #include 19 | #include "VoxelPools.h" 20 | 21 | #ifdef USE_BOOST_ODE 22 | 23 | BoostSys::BoostSys( ) : vp( NULL ) 24 | { ; } 25 | 26 | BoostSys::~BoostSys() 27 | { ; } 28 | 29 | 30 | void BoostSys::operator()( const vector_type_ y 31 | , vector_type_& dydt, const double t ) 32 | { 33 | assert( vp ); 34 | VoxelPools::evalRates( y, dydt, t, vp ); 35 | } 36 | 37 | #else /* ----- not USE_BOOST_ODE ----- */ 38 | 39 | #endif /* ----- not USE_BOOST_ODE ----- */ 40 | -------------------------------------------------------------------------------- /ksolve/BoostSys.h: -------------------------------------------------------------------------------- 1 | #ifndef BOOSTSYSTEM_H 2 | #define BOOSTSYSTEM_H 3 | 4 | #ifdef USE_BOOST_ODE 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | typedef double value_type_; 11 | typedef std::vector vector_type_; 12 | 13 | typedef boost::numeric::odeint::runge_kutta4< vector_type_ > rk4_stepper_type_; 14 | typedef boost::numeric::odeint::runge_kutta_dopri5< vector_type_ > rk_dopri_stepper_type_; 15 | typedef boost::numeric::odeint::modified_midpoint< vector_type_ > rk_midpoint_stepper_type_; 16 | 17 | /*----------------------------------------------------------------------------- 18 | * This stepper type found to be most suitable for adaptive solver. The gsl 19 | * implementation has runge_kutta_fehlberg78 solver. 20 | *-----------------------------------------------------------------------------*/ 21 | typedef boost::numeric::odeint::runge_kutta_cash_karp54< vector_type_ > rk_karp_stepper_type_; 22 | typedef boost::numeric::odeint::runge_kutta_fehlberg78< vector_type_ > rk_felhberg_stepper_type_; 23 | 24 | #endif // USE_BOOST_ODE 25 | 26 | #endif /* end of include guard: BOOSTSYSTEM_H */ 27 | 28 | -------------------------------------------------------------------------------- /ksolve/OdeSystem.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment. 4 | ** Copyright (C) 2003-2007 Upinder S. Bhalla. and NCBS 5 | ** It is made available under the terms of the 6 | ** GNU Lesser General Public License version 2.1 7 | ** See the file COPYING.LIB for the full notice. 8 | **********************************************************************/ 9 | 10 | #ifndef _ODE_SYSTEM_H 11 | #define _ODE_SYSTEM_H 12 | 13 | #if USE_BOOST_ODE 14 | #include "BoostSys.h" 15 | #elif USE_GSL 16 | #include 17 | #endif /* ----- not USE_BOOST_ODE ----- */ 18 | 19 | class OdeSystem { 20 | public: 21 | OdeSystem() 22 | : method( "rk5" ), 23 | initStepSize( 0.001 ), 24 | epsAbs( 1e-6 ), 25 | epsRel( 1e-6 ) 26 | {;} 27 | 28 | std::string method; 29 | 30 | double initStepSize; 31 | double epsAbs; // Absolute error 32 | double epsRel; // Relative error 33 | 34 | #ifdef USE_GSL 35 | // GSL stuff 36 | gsl_odeiv2_system gslSys; 37 | const gsl_odeiv2_step_type* gslStep; 38 | #endif 39 | 40 | #if USE_BOOST_ODE 41 | size_t dimension; 42 | #endif /* ----- USE_BOOST_ODE ----- */ 43 | }; 44 | 45 | #endif // _ODE_SYSTEM_H 46 | -------------------------------------------------------------------------------- /ksolve/RateTerm.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment, 4 | ** also known as GENESIS 3 base code. 5 | ** copyright (C) 2003-2010 Upinder S. Bhalla. and NCBS 6 | ** It is made available under the terms of the 7 | ** GNU Lesser General Public License version 2.1 8 | ** See the file COPYING.LIB for the full notice. 9 | **********************************************************************/ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include "../basecode/header.h" 16 | #include "RateTerm.h" 17 | using namespace std; 18 | 19 | const double RateTerm::EPSILON = 1.0e-6; 20 | 21 | StochNOrder::StochNOrder( double k, vector< unsigned int > v ) 22 | : NOrder( k, v ) 23 | { 24 | // Here we sort the y vector so that if there are repeated 25 | // substrates, they are put consecutively. This lets us use 26 | // the algorithm below to deal with repeats. 27 | sort( v_.begin(), v_.end() ); 28 | } 29 | 30 | double StochNOrder::operator() ( const double* S ) const 31 | { 32 | double ret = k_; 33 | vector< unsigned int >::const_iterator i; 34 | unsigned int lasty = ~0U; 35 | double y = 0.0; 36 | for ( i = v_.begin(); i != v_.end(); i++) 37 | { 38 | assert( !std::isnan( S[ *i ] ) ); 39 | if ( lasty == *i ) { 40 | y -= 1.0; 41 | } else { 42 | y = S[ *i ]; 43 | } 44 | ret *= y; 45 | if ( ret < 0.0 ) { 46 | return 0.0; 47 | } 48 | lasty = *i; 49 | } 50 | return ret; 51 | } 52 | -------------------------------------------------------------------------------- /ksolve/helper.h: -------------------------------------------------------------------------------- 1 | #ifndef HELPER_H 2 | #define HELPER_H 3 | 4 | template 5 | bool areEqual(T a, T b) 6 | { 7 | return std::fabs(a - b) < 1e-6; 8 | } 9 | 10 | template 11 | void print_vec( const vector& v, const string prefix="" ) 12 | { 13 | cout << prefix << " SIZE=" << v.size() << " : "; 14 | for( auto x : v ) cout << x << ','; 15 | cout << endl; 16 | } 17 | 18 | #endif /* end of include guard: HELPER_H */ 19 | -------------------------------------------------------------------------------- /ksolve/meson.build: -------------------------------------------------------------------------------- 1 | # Author: Subhasis Ray 2 | # Date: Sun Jul 7 3 | 4 | ksolve_src = ['KinSparseMatrix.cpp', 5 | 'VoxelPoolsBase.cpp', 6 | 'VoxelPools.cpp', 7 | 'GssaVoxelPools.cpp', 8 | 'RateTerm.cpp', 9 | 'FuncTerm.cpp', 10 | 'Stoich.cpp', 11 | 'Ksolve.cpp', 12 | 'Gsolve.cpp', 13 | 'KsolveBase.cpp', 14 | 'SteadyStateGsl.cpp', 15 | 'testKsolve.cpp', 16 | # '../utility/utility.cpp' 17 | ] 18 | 19 | ksolve_lib = static_library('ksolve', ksolve_src, dependencies: [gsl_dep], include_directories: gsl_dep.get_variable(pkgconfig:'includedir')) 20 | 21 | -------------------------------------------------------------------------------- /mesh/Boundary.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment. 4 | ** Copyright (C) 2003-2010 Upinder S. Bhalla. and NCBS 5 | ** It is made available under the terms of the 6 | ** GNU Lesser General Public License version 2.1 7 | ** See the file COPYING.LIB for the full notice. 8 | **********************************************************************/ 9 | 10 | #ifndef _BOUNDARY_H 11 | #define _BOUNDARY_H 12 | 13 | /** 14 | * manages geometries and optionally keeps track of adjacent compartments, 15 | * if any. 16 | */ 17 | class Boundary 18 | { 19 | public: 20 | Boundary(); 21 | 22 | void setReflectivity( const double v ); 23 | double getReflectivity() const; 24 | 25 | static const Cinfo* initCinfo(); 26 | private: 27 | /** 28 | * Boundary condition. Reflective = 1. Completely diffusive = 0 29 | * Unless it is completely reflective, there should be an adjacent 30 | * compartment into which the molecules diffuse. 31 | */ 32 | double reflectivity_; 33 | }; 34 | 35 | #endif // _BOUNDARY_H 36 | -------------------------------------------------------------------------------- /mesh/meson.build: -------------------------------------------------------------------------------- 1 | # Author: Subhasis Ray 2 | # Date: Sun Jul 7 3 | 4 | mesh_src = ['ChemCompt.cpp', 5 | 'MeshCompt.cpp', 6 | 'MeshEntry.cpp', 7 | 'CubeMesh.cpp', 8 | 'CylBase.cpp', 9 | 'CylMesh.cpp', 10 | 'NeuroNode.cpp', 11 | 'NeuroMesh.cpp', 12 | 'SpineEntry.cpp', 13 | 'SpineMesh.cpp', 14 | 'PsdMesh.cpp', 15 | 'EndoMesh.cpp', 16 | 'PresynMesh.cpp', 17 | 'testMesh.cpp'] 18 | 19 | mesh_lib = static_library('mesh', mesh_src) 20 | -------------------------------------------------------------------------------- /mesh/testPresynMesh.py: -------------------------------------------------------------------------------- 1 | import moose 2 | import rdesigneur as rd 3 | 4 | rdes = rd.rdesigneur( 5 | elecDt = 50e-6, 6 | chemDt = 0.002, 7 | # cellProto syntax: ['ballAndStick', 'name', somaDia, somaLength, dendDia, dendLength, numDendSegments ] 8 | cellProto = [['ballAndStick', 'soma', 12e-6, 12e-6, 4e-6, 100e-6, 2 ]], 9 | spineProto = [['makeActiveSpine()', 'spine']], 10 | spineDistrib = [['spine', '#dend#', '50e-6', '1e-6']], 11 | ) 12 | 13 | moose.seed(123) 14 | rdes.buildModel() 15 | moose.reinit() 16 | 17 | pre1 = moose.PresynMesh( 'pre1' ) 18 | spineHeads = moose.wildcardFind( "/model/elec/#head#" ) 19 | print( spineHeads ) 20 | pre1.buildOnSpineHeads( spineHeads ) 21 | 22 | moose.showfield( pre1 ) 23 | print( "pre1 voxelVolume = ", pre1.voxelVolume ) 24 | print( "pre1 voxelMidpoint = ", pre1.voxelMidpoint ) 25 | 26 | 27 | pre2 = moose.PresynMesh( 'pre2' ) 28 | dends = moose.wildcardFind( "/model/elec/#dend#" ) 29 | print( dends ) 30 | pre2.buildOnDendrites( dends , 20e-6 ) 31 | 32 | moose.showfield( pre2 ) 33 | print( "pre2 voxelVolume = ", pre2.voxelVolume ) 34 | print( "pre2 voxelMidpoint = ", pre2.voxelMidpoint ) 35 | 36 | 37 | -------------------------------------------------------------------------------- /meson_options.txt: -------------------------------------------------------------------------------- 1 | option('use_mpi', type: 'boolean', value: false, 2 | description: 'If specified, build with MPI support') 3 | option('use_hdf5', type: 'boolean', value: true, 4 | description: 'If specified, build with HDF5 support. Needed for NSDF.') 5 | -------------------------------------------------------------------------------- /mpi/meson.build: -------------------------------------------------------------------------------- 1 | # Author: Subhasis Ray 2 | # Date: Sun Jul 7 3 | 4 | mpi_src = ['PostMaster.cpp', 'testMpi.cpp'] 5 | mpi_lib = static_library('mpi', mpi_src) 6 | # TODO: add include dirs and link options if USE_MPI is defined and MPI library is available 7 | -------------------------------------------------------------------------------- /mpi/testMpi.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment. 4 | ** Copyright (C) 2003-2013 Upinder S. Bhalla. and NCBS 5 | ** It is made available under the terms of the 6 | ** GNU Lesser General Public License version 2.1 7 | ** See the file COPYING.LIB for the full notice. 8 | **********************************************************************/ 9 | 10 | void testMpi() 11 | { 12 | ; 13 | } 14 | -------------------------------------------------------------------------------- /msg/meson.build: -------------------------------------------------------------------------------- 1 | # Author: Subhasis Ray 2 | # Date: Sun Jul 7 3 | 4 | msg_src = ['Msg.cpp', 5 | 'DiagonalMsg.cpp', 6 | 'OneToAllMsg.cpp', 7 | 'OneToOneMsg.cpp', 8 | 'SingleMsg.cpp', 9 | 'SparseMsg.cpp', 10 | 'OneToOneDataIndexMsg.cpp', 11 | 'testMsg.cpp'] 12 | 13 | msg_lib = static_library('msg', msg_src) 14 | 15 | -------------------------------------------------------------------------------- /pybind11/meson.build: -------------------------------------------------------------------------------- 1 | # Author: Subhasis Ray 2 | # Date: Sun Jul 7 3 | 4 | pybind11_src = ['Finfo.cpp', 5 | 'helper.cpp', 6 | 'MooseVec.cpp', 7 | # 'pymoose.cpp', 8 | 'PyRun.cpp'] 9 | 10 | python_res = run_command('python', '-c', 'from sysconfig import get_paths as gp; print(gp()["include"])') 11 | if python_res.returncode() == 0 12 | inc_dirs = python_res.stdout().strip() 13 | else 14 | message('ERROR: could not find Python include directory') 15 | inc_dirs = [] 16 | endif 17 | 18 | pybind11_lib = static_library('pybind11', pybind11_src, dependencies: pybind_dep, include_directories: inc_dirs) 19 | 20 | -------------------------------------------------------------------------------- /pybind11/pymoose.h: -------------------------------------------------------------------------------- 1 | // ===================================================================================== 2 | // 3 | // Filename: pymoose.h 4 | // 5 | // Description: pymoose module. 6 | // 7 | // Version: 1.0 8 | // Created: 03/17/2020 05:32:37 PM 9 | // Revision: none 10 | // Compiler: g++ 11 | // 12 | // Author: Dilawar Singh (), dilawar.s.rajput@gmail.com 13 | // Organization: NCBS Bangalore 14 | // 15 | // ===================================================================================== 16 | 17 | #ifndef PYMOOSE_H 18 | #define PYMOOSE_H 19 | 20 | #include "MooseVec.h" 21 | 22 | template 23 | inline bool setField(const ObjId& id, const string& fname, T val) 24 | { 25 | return Field::set(id, fname, val); 26 | } 27 | 28 | template 29 | inline T getField(const ObjId& id, const string& fname) 30 | { 31 | return Field::get(id, fname); 32 | } 33 | 34 | // FIXME: Is it most efficient? 35 | // See discussion here: https://github.com/pybind/pybind11/issues/1042 36 | template 37 | inline py::array_t getFieldNumpy(const ObjId& id, const string& fname) 38 | { 39 | auto v = Field>::get(id, fname); 40 | return py::array_t(v.size(), v.data()); 41 | } 42 | 43 | bool setFieldGeneric(const ObjId& id, const string& frname, 44 | const py::object& val); 45 | 46 | py::object getFieldGeneric(const ObjId& oid, const string& fname); 47 | 48 | #endif /* end of include guard: PYMOOSE_H */ 49 | -------------------------------------------------------------------------------- /pymoose/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import absolute_import, division, print_function 3 | 4 | # Bring everything from c++ module to global namespace. 5 | from moose._moose import * 6 | 7 | # Bring everything from moose.py to global namespace. 8 | # IMP: It will overwrite any c++ function with the same name. We can override 9 | # some C++ here. 10 | from moose.moose import * 11 | from moose.server import * 12 | 13 | # SBML and NML2 support. 14 | from moose.model_utils import * 15 | 16 | # create a shorthand for version() call here. 17 | __version__ = version() 18 | 19 | # C++ core override 20 | from moose.wrapper import * 21 | 22 | # Import moose test. 23 | from moose.moose_test import test 24 | -------------------------------------------------------------------------------- /python/moose/SBML/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from .writeSBML import mooseWriteSBML 3 | from .readSBML import mooseReadSBML 4 | 5 | __all__ = ["mooseWriteSBML","mooseReadSBML"] 6 | -------------------------------------------------------------------------------- /python/moose/chemMerge/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from .merge import * 3 | -------------------------------------------------------------------------------- /python/moose/chemUtil/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from .add_Delete_ChemicalSolver import * 3 | from .chemConnectUtil import * 4 | from .graphUtils import autoCoordinates 5 | -------------------------------------------------------------------------------- /python/moose/constants.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | ## for Ca Pool 4 | #FARADAY = 96154.0 # Coulombs # from cadecay.mod : 1/(2*96154.0) = 5.2e-6 which is the Book of Genesis / readcell value 5 | FARADAY = 96485.3415 # Coulombs/mol # from Wikipedia 6 | 7 | ## Table step_mode 8 | TAB_IO=0 # table acts as lookup - default mode 9 | TAB_ONCE=2 # table outputs value until it reaches the end and then stays at the last value 10 | TAB_BUF=3 # table acts as a buffer: succesive entries at each time step 11 | TAB_SPIKE=4 # table acts as a buffer for spike times. Threshold stored in the pymoose 'stepSize' field. 12 | 13 | ## Table fill modes 14 | BSplineFill = 0 # B-spline fill (default) 15 | CSplineFill = 1 # C_Spline fill (not yet implemented) 16 | LinearFill = 2 # Linear fill 17 | 18 | ## The hsolve and ee methods use clock 1. 19 | ## hsolve further uses clock 2 for mg_block, nmdachan and others. 20 | ## keep clock 3 for plots. 21 | PLOTCLOCK = 3 22 | -------------------------------------------------------------------------------- /python/moose/genesis/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from .writeKkit import mooseWriteKkit 3 | -------------------------------------------------------------------------------- /python/moose/methods_utils.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | """methods_utils.py: 4 | 5 | """ 6 | 7 | __author__ = "Dilawar Singh" 8 | __copyright__ = "Copyright 2013, NCBS Bangalore" 9 | __credits__ = ["NCBS Bangalore", "Bhalla Lab"] 10 | __license__ = "GPL" 11 | __version__ = "1.0.0" 12 | __maintainer__ = "Dilawar Singh" 13 | __email__ = "dilawars@ncbs.res.in" 14 | __status__ = "Development" 15 | 16 | 17 | import re 18 | 19 | objPathPat = re.compile(r'(\/\w+\[\d+\])+?$') 20 | 21 | def idPathToObjPath( idPath ): 22 | """ Append a [0] if missing from idPath. 23 | 24 | Id-paths do not have [0] at their end. This does not allow one to do 25 | algebra properly. 26 | """ 27 | m = objPathPat.match( idPath ) 28 | if m: return idPath 29 | else: 30 | return '{}[0]'.format(idPath) 31 | 32 | 33 | def main(): 34 | p1 = '/cable[0]/comp_[1]/a' 35 | p2 = '/cab[1]/comp/com' 36 | p3 = '/cab[1]/p[2]/c[3]' 37 | p4 = '/ca__b[1]/_p[2]/c[122]' 38 | for p in [p1, p2, p3, p4]: 39 | m = objPathPat.match(p) 40 | if m: 41 | print(m.group(0)) 42 | else: 43 | print(("{} is invalid Obj path in moose".format( p ))) 44 | 45 | if __name__ == '__main__': 46 | main() 47 | -------------------------------------------------------------------------------- /python/moose/neuroml/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from __future__ import absolute_import, division, print_function 4 | 5 | import moose.utils as mu 6 | 7 | from .NeuroML import NeuroML, loadNeuroML_L123 8 | from .NetworkML import NetworkML 9 | from .MorphML import MorphML 10 | from .ChannelML import ChannelML 11 | -------------------------------------------------------------------------------- /python/moose/neuroml2/README: -------------------------------------------------------------------------------- 1 | Update 2021-10-28 Padraig Gleeson 2 | 3 | reader.py updated to work with Python 3. 4 | 5 | To test, run: 6 | 7 | python run_cell.py # example of a passive cell 8 | python run_hhcell.py # example of a HH cell 9 | 10 | Note: older test_*.py files are still giving errors, but may be out of date 11 | 12 | 13 | =============================== 14 | 15 | Previous status: 16 | 17 | NeuroML2 is a moving target and the current parser was generated from 18 | the schema publicly available on Jul 28 10:18:38 2013 using the 19 | generateDS.py module. 20 | 21 | This is broken with respect to NeuroML_v2beta3. Morphology loading 22 | works, but ion channels are not visible in the parsed document. This 23 | version of NeuroML2 has a mix of ionChannel and ionChannelHH and from 24 | the comments in the schema the situation seems to be inconsistent. 25 | 26 | You can install generateDS.py and generate the Python wrappers for the 27 | latest schema as follows: 28 | 29 | generateDS.py -o generated_neuroml.py -s generated_neuromlsub.py ~/src/neuroml_dev/NeuroML2/Schemas/NeuroML2/NeuroML_v2beta.xsd 30 | 31 | Replace the last argument with the path to NeurML xsd. 32 | 33 | The other python files in this directory were hand-coded. So you may 34 | need to tweak them in case NeuroML2 has some incompatible changes or 35 | adds new types. 36 | 37 | - Subhasis Ray, 2016-04-17 38 | -------------------------------------------------------------------------------- /python/moose/neuroml2/test_files/LEMS_passiveCell.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /python/moose/neuroml2/test_files/SimpleIonChannel.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /python/moose/streamer_utils.py: -------------------------------------------------------------------------------- 1 | """streamer_utils.py: 2 | 3 | Utility for Table streamer. 4 | 5 | """ 6 | 7 | __author__ = "Dilawar Singh" 8 | __copyright__ = "Copyright 2017-, Dilawar Singh" 9 | __version__ = "1.0.0" 10 | __maintainer__ = "Dilawar Singh" 11 | __email__ = "dilawars@ncbs.res.in" 12 | __status__ = "Development" 13 | 14 | import sys 15 | import os 16 | import numpy as np 17 | import math 18 | import struct 19 | from collections import defaultdict 20 | 21 | def bytes_to_np_arr(data): 22 | return np.frombuffer(data, float) 23 | 24 | def np_array_to_string(arr): 25 | return np.uint8(arr).tostring() 26 | 27 | def np_array_to_data(arr): 28 | # Make sure that first char of arr is 'H' 29 | n = 0 30 | res = defaultdict(list) 31 | while n < len(arr): 32 | assert chr(int(arr[n])) == 'H', 'Expected H, Got %s'%arr[n] 33 | hSize = int(arr[n+1]) 34 | n += 1 35 | colName = np_array_to_string(arr[n+1:n+1+hSize]) 36 | n += hSize + 1 37 | assert chr(int(arr[n])) == 'V', 'Expected V' 38 | n += 1 39 | dataSize = int(arr[n]) 40 | n += 1 41 | res[colName].append(arr[n:n+dataSize]) 42 | n += dataSize 43 | return { k : np.concatenate(v) for k, v in res.items() } 44 | 45 | def decode_data(data): 46 | arr = bytes_to_np_arr(data) 47 | assert int(arr[0]) == ord('H'), "First char must be H" 48 | return np_array_to_data(arr) 49 | 50 | def test(): 51 | with open(sys.argv[1], 'rb') as f: 52 | data = f.read() 53 | print( "[INFO ] Total bytes read %d" % len(data)) 54 | s = decode_data(data) 55 | print(s) 56 | 57 | if __name__ == '__main__': 58 | test() 59 | -------------------------------------------------------------------------------- /python/rdesigneur/.gitignore: -------------------------------------------------------------------------------- 1 | test*.py 2 | foo.py 3 | old.py 4 | NOTES 5 | -------------------------------------------------------------------------------- /python/rdesigneur/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import print_function, absolute_import 3 | 4 | from rdesigneur.rdesigneur import * 5 | from rdesigneur.rdesigneur import rdesigneur 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /python/rdesigneur/chans/CaConc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Ca pool 5 | 6 | 7 | Signifies that the ion is involved in a process which alters its concentration 8 | 9 | 10 | 11 | 12 | 13 | 14 | Upi Bhalla 15 | 16 | 17 | 18 | An expontially decaying pool of calcium 19 | 20 | 21 | 22 | Upi Bhalla 23 | National Centre for Biological Sciences, Bangalore, India. 24 | bhalla - at - ncbs.res.in 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /python/rdesigneur/chans/DoubExpSyn.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ChannelML file describing a single synaptic mechanism 5 | 6 | 7 | 8 | 9 | 10 | 11 | Simple example of a synaptic mechanism, which consists of a postsynaptic conductance which changes as 12 | double exponential function of time. Mappings exist for NEURON and GENESIS. 13 | 14 | 15 | 16 | Padraig Gleeson 17 | UCL 18 | p.gleeson - at - ucl.ac.uk 19 | 20 | 21 | 22 | 23 | Receptor properties 24 | http://senselab.med.yale.edu/senselab/NeuronDB/receptors2.asp 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /python/rdesigneur/chans/Glu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | Glutamate receptor synchan, 2 ms tau. 10 | 11 | 12 | 13 | Simple double exponential waveform glu synapse 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /python/rdesigneur/chans/NMDA.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | NMDA receptor synchan, 20 ms tau. 10 | 11 | 12 | 13 | Simple double exponential waveform NMDA synapse 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /python/rdesigneur/chans/pas.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ChannelML file containing a single Channel description 5 | 6 | 7 | 8 | 9 | 10 | Simple example of a leak/passive conductance. Note: for GENESIS cells with a single leak conductance, 11 | it is better to use the Rm and Em variables for a passive current. 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /randnum/Definitions.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * Filename: Definitions.h 3 | * 4 | * Description: Various definitions. 5 | * 6 | * Version: 0.0.1 7 | * Created: 2018-08-04 8 | 9 | * Revision: none 10 | * 11 | * Author: Dilawar Singh 12 | * Organization: NCBS Bangalore 13 | * 14 | * License: GNU GPL3 15 | */ 16 | 17 | #ifndef DEFINITIONS_H 18 | #define DEFINITIONS_H 19 | 20 | #include 21 | 22 | namespace moose { 23 | 24 | /* --------------------------------------------------------------------------*/ 25 | /** 26 | * @Synopsis MOOSE's random device. Use it from 27 | */ 28 | /* ----------------------------------------------------------------------------*/ 29 | typedef std::random_device MOOSE_RANDOM_DEVICE; 30 | 31 | /* --------------------------------------------------------------------------*/ 32 | /** 33 | * @Synopsis Global random number generator engine. Everywhere we use this 34 | * engine. 35 | */ 36 | /* ----------------------------------------------------------------------------*/ 37 | typedef std::mersenne_twister_engine< std::uint_fast32_t, 32, 624, 397, 31 38 | , 0x9908b0df, 11 39 | , 0xffffffff, 7 40 | , 0x9d2c5680, 15 41 | , 0xefc60000, 18, 1812433253 42 | > MOOSE_RNG_DEFAULT_ENGINE; 43 | 44 | } 45 | 46 | #endif /* end of include guard: DEFINITIONS_H */ 47 | -------------------------------------------------------------------------------- /randnum/Distributions.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * Filename: Distributions.h 3 | * 4 | * Description: All distributions. 5 | * 6 | * Version: 0.0.1 7 | * Created: 2018-08-04 8 | 9 | * Revision: none 10 | * 11 | * Author: Dilawar Singh 12 | * Organization: NCBS Bangalore 13 | * 14 | * License: GNU GPL2 15 | */ 16 | 17 | #ifndef DISTRIBUTIONS_H 18 | #define DISTRIBUTIONS_H 19 | 20 | #include "NormalDistribution.hpp" 21 | #include 22 | 23 | namespace moose { 24 | 25 | template 26 | using MOOSE_UNIFORM_DISTRIBUTION = std::uniform_real_distribution; 27 | 28 | template 29 | using MOOSE_NORMAL_DISTRIBUTION = moose::normal_distribution; 30 | 31 | } 32 | 33 | 34 | #endif /* end of include guard: DISTRIBUTIONS_H */ 35 | -------------------------------------------------------------------------------- /randnum/RNG.cpp: -------------------------------------------------------------------------------- 1 | /*** 2 | * Description: Random number generator. 3 | * 4 | * Created: 2019-05-26 5 | 6 | * Author: Dilawar Singh 7 | * Organization: NCBS Bangalore 8 | * License: MIT License 9 | */ 10 | 11 | #include "RNG.h" 12 | 13 | namespace moose { 14 | 15 | RNG::RNG () /* constructor */ 16 | { 17 | // Setup a random seed if possible. 18 | setRandomSeed( ); 19 | } 20 | 21 | RNG::~RNG () /* destructor */ 22 | { ; } 23 | 24 | void RNG::setRandomSeed( ) 25 | { 26 | MOOSE_RANDOM_DEVICE rd_; 27 | setSeed( rd_() ); 28 | } 29 | 30 | double RNG::getSeed( void ) 31 | { 32 | return seed_; 33 | } 34 | 35 | /** 36 | * @brief If seed if 0 then set seed to a random number else set seed to 37 | * the given number. 38 | * 39 | * @param seed 40 | */ 41 | void RNG::setSeed( const unsigned long seed ) 42 | { 43 | seed_ = seed; 44 | if( seed == 0 ) 45 | { 46 | MOOSE_RANDOM_DEVICE rd_; 47 | seed_ = rd_(); 48 | } 49 | rng_.seed( seed_ ); 50 | } 51 | 52 | /** 53 | * @brief Generate a uniformly distributed random number between a and b. 54 | * 55 | * @param a Lower limit (inclusive) 56 | * @param b Upper limit (inclusive). 57 | */ 58 | double RNG::uniform( const double a, const double b) 59 | { 60 | return ( b - a ) * dist_( rng_ ) + a; 61 | } 62 | 63 | /** 64 | * @brief Return a uniformly distributed random number between 0 and 1 65 | * (exclusive). 66 | * 67 | * @return randum number. 68 | */ 69 | double RNG::uniform( void ) 70 | { 71 | return dist_( rng_ ); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /randnum/meson.build: -------------------------------------------------------------------------------- 1 | # Author: Subhasis Ray 2 | # Date: Sun Jul 7 3 | 4 | randnum_src = ['RNG.cpp', 'randnum.cpp'] 5 | randnum_lib = static_library('randnum', randnum_src) 6 | 7 | 8 | -------------------------------------------------------------------------------- /randnum/randnum.cpp: -------------------------------------------------------------------------------- 1 | /*** 2 | * Description: random number generator. 3 | * 4 | * Created: 2020-04-03 5 | 6 | * Author: Dilawar Singh 7 | * License: Same as MOOSE license. 8 | */ 9 | 10 | #include "randnum.h" 11 | 12 | namespace moose { 13 | 14 | unsigned long __rng_seed__ = 0; 15 | 16 | RNG rng; 17 | 18 | /** 19 | * @brief Set the global seed or all rngs. 20 | * 21 | * @param x 22 | */ 23 | void mtseed(unsigned int x) 24 | { 25 | static bool isRNGInitialized = false; 26 | moose::__rng_seed__ = x; 27 | moose::rng.setSeed(x); 28 | isRNGInitialized = true; 29 | } 30 | 31 | /* Generate a random number */ 32 | double mtrand(void) 33 | { 34 | return moose::rng.uniform(); 35 | } 36 | 37 | double mtrand(double a, double b) 38 | { 39 | return (b - a) * mtrand() + a; 40 | } 41 | 42 | int getGlobalSeed() 43 | { 44 | return __rng_seed__; 45 | } 46 | 47 | void setGlobalSeed(int seed) 48 | { 49 | __rng_seed__ = seed; 50 | } 51 | 52 | } // namespace moose. 53 | -------------------------------------------------------------------------------- /randnum/test_normal_dist.cpp: -------------------------------------------------------------------------------- 1 | /*** 2 | * Filename: test_normal_dist.cpp 3 | * 4 | * Description: test script. 5 | * 6 | * Version: 0.0.1 7 | * Created: 2018-08-04 8 | 9 | * Revision: none 10 | * 11 | * Author: Dilawar Singh 12 | * Organization: NCBS Bangalore 13 | * 14 | * License: GNU GPL2 15 | */ 16 | 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #include "Distributions.h" 23 | #include "../utility/testing_macros.hpp" 24 | 25 | 26 | int test_normal_dist( ) 27 | { 28 | 29 | moose::MOOSE_RANDOM_DEVICE rd; 30 | moose::MOOSE_RNG_DEFAULT_ENGINE gen; 31 | gen.seed( 10 ); 32 | 33 | moose::MOOSE_NORMAL_DISTRIBUTION d(0, 1); 34 | 35 | std::map hist{}; 36 | std::vector dist; 37 | for(int n=0; n<100000; ++n) 38 | { 39 | double x = d(gen); 40 | dist.push_back( x ); 41 | ++hist[ std::round(x) ]; 42 | } 43 | 44 | for(auto p : hist) { 45 | std::cout << std::setw(2) 46 | << p.first << ' ' << std::string(p.second/200, '*') << '\n'; 47 | } 48 | 49 | ASSERT_DOUBLE_EQ( hist[-3], 542 , "NORMALDIST") 50 | ASSERT_DOUBLE_EQ( hist[-2], 5987 , "NORMALDIST"); 51 | ASSERT_DOUBLE_EQ( hist[-1], 24262, "NORMALDIST"); 52 | ASSERT_DOUBLE_EQ( hist[0], 38236, "NORMALDIST"); 53 | ASSERT_DOUBLE_EQ( hist[1], 24386, "NORMALDIST"); 54 | ASSERT_DOUBLE_EQ( hist[2], 6071 , "NORMALDIST"); 55 | 56 | return 0; 57 | } 58 | 59 | int main(int argc, const char *argv[]) 60 | { 61 | test_normal_dist(); 62 | return 0; 63 | } 64 | -------------------------------------------------------------------------------- /scheduling/meson.build: -------------------------------------------------------------------------------- 1 | # Author: Subhasis Ray 2 | # Date: Sun Jul 7 3 | 4 | scheduling_src = ['Clock.cpp', 'testScheduling.cpp'] 5 | scheduling_lib = static_library('scheduling', scheduling_src) 6 | 7 | -------------------------------------------------------------------------------- /scheduling/testScheduling.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment. 4 | ** Copyright (C) 2003-2009 Upinder S. Bhalla. and NCBS 5 | ** It is made available under the terms of the 6 | ** GNU Lesser General Public License version 2.1 7 | ** See the file COPYING.LIB for the full notice. 8 | **********************************************************************/ 9 | 10 | class TestSched 11 | { 12 | public: 13 | /** 14 | * This may be created as an array, but only on one thread 15 | */ 16 | TestSched() 17 | : index_( 0 ) 18 | { 19 | if ( isInitPending_ ) { 20 | globalIndex_ = 0; 21 | isInitPending_ = 0; 22 | } 23 | } 24 | ~TestSched() 25 | { 26 | isInitPending_ = 1; 27 | } 28 | 29 | void process( const Eref& e, ProcPtr p ); 30 | 31 | void zeroIndex() { 32 | index_ = 0 ; 33 | } 34 | 35 | static const Cinfo* initCinfo(); 36 | private: 37 | int index_; 38 | static int globalIndex_; 39 | static bool isInitPending_; 40 | }; 41 | 42 | -------------------------------------------------------------------------------- /shell/LoadModels.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment. 4 | ** Copyright (C) 2003-2009 Upinder S. Bhalla. and NCBS 5 | ** It is made available under the terms of the 6 | ** GNU Lesser General Public License version 2.1 7 | ** See the file COPYING.LIB for the full notice. 8 | **********************************************************************/ 9 | enum ModelType { 10 | UNKNOWN, 11 | KKIT, 12 | DOTP, 13 | SBML, 14 | NEUROML, 15 | NINEML, 16 | SEDML, 17 | CSPACE, 18 | SWC 19 | }; 20 | -------------------------------------------------------------------------------- /shell/meson.build: -------------------------------------------------------------------------------- 1 | # Author: Subhasis Ray 2 | # Date: Sun Jul 7 3 | 4 | shell_src = ['Shell.cpp', 5 | 'ShellCopy.cpp', 6 | 'ShellThreads.cpp', 7 | 'LoadModels.cpp', 8 | 'SaveModels.cpp', 9 | 'Neutral.cpp', 10 | 'Wildcard.cpp', 11 | 'testShell.cpp'] 12 | 13 | shell_lib = static_library('shell', shell_src) 14 | 15 | -------------------------------------------------------------------------------- /signeur/meson.build: -------------------------------------------------------------------------------- 1 | # Author: Subhasis Ray 2 | # Date: Sun Jul 7 3 | 4 | signeur_src = ['Adaptor.cpp', 'testSigNeur.cpp'] 5 | 6 | signeur_lib = static_library('signeur', signeur_src) 7 | 8 | -------------------------------------------------------------------------------- /synapse/STDPSynapse.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment. 4 | ** Copyright (C) 2003-2009 Upinder S. Bhalla. and NCBS 5 | ** It is made available under the terms of the 6 | ** GNU Lesser General Public License version 2.1 7 | ** See the file COPYING.LIB for the full notice. 8 | **********************************************************************/ 9 | 10 | #ifndef _STDP_SYNAPSE_H 11 | #define _STDP_SYNAPSE_H 12 | 13 | class SynHandlerBase; 14 | /** 15 | * This is the base class for synapses with STDP. It is meant to be used as a 16 | * FieldElement entry on a parent object, derived from the STDPSynHandlerBase. 17 | */ 18 | class STDPSynapse: public Synapse 19 | { 20 | public: 21 | STDPSynapse(); 22 | 23 | void setAPlus( double v ); 24 | double getAPlus() const; 25 | 26 | void setHandler( SynHandlerBase* h ); 27 | static const Cinfo* initCinfo(); 28 | 29 | private: 30 | double aPlus_; 31 | SynHandlerBase* handler_; 32 | }; 33 | 34 | #endif // _STDP_SYNAPSE_H 35 | -------------------------------------------------------------------------------- /synapse/Synapse.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | ** This program is part of 'MOOSE', the 3 | ** Messaging Object Oriented Simulation Environment. 4 | ** Copyright (C) 2003-2009 Upinder S. Bhalla. and NCBS 5 | ** It is made available under the terms of the 6 | ** GNU Lesser General Public License version 2.1 7 | ** See the file COPYING.LIB for the full notice. 8 | **********************************************************************/ 9 | 10 | #ifndef _SYNAPSE_H 11 | #define _SYNAPSE_H 12 | 13 | class SynHandlerBase; 14 | /** 15 | * This is the base class for synapses. It is meant to be used as a 16 | * FieldElement entry on a parent object, derived from the SynHandlerBase. 17 | */ 18 | class Synapse 19 | { 20 | public: 21 | Synapse(); 22 | void setWeight( double v ); 23 | void setDelay( double v ); 24 | 25 | double getWeight() const; 26 | double getDelay() const; 27 | 28 | void addSpike( const Eref& e, double time ); 29 | double getTopSpike( const Eref& e ) const; 30 | 31 | void setHandler( SynHandlerBase* h ); 32 | 33 | /////////////////////////////////////////////////////////////// 34 | static void addMsgCallback( 35 | const Eref& e, const string& finfoName, 36 | ObjId msg, unsigned int msgLookup ); 37 | static void dropMsgCallback( 38 | const Eref& e, const string& finfoName, 39 | ObjId msg, unsigned int msgLookup ); 40 | static const Cinfo* initCinfo(); 41 | private: 42 | double weight_; 43 | double delay_; 44 | SynHandlerBase* handler_; 45 | }; 46 | 47 | #endif // _SYNAPSE_H 48 | -------------------------------------------------------------------------------- /synapse/meson.build: -------------------------------------------------------------------------------- 1 | # Author: Subhasis Ray 2 | # Date: Sun Jul 7 3 | 4 | synapse_src = ['GraupnerBrunel2012CaPlasticitySynHandler.cpp', 5 | 'RollingMatrix.cpp', 6 | 'SeqSynHandler.cpp', 7 | 'SimpleSynHandler.cpp', 8 | 'STDPSynapse.cpp', 9 | 'STDPSynHandler.cpp', 10 | 'Synapse.cpp', 11 | 'SynHandlerBase.cpp', 12 | 'testSynapse.cpp'] 13 | 14 | synapse_lib = static_library('synapse', synapse_src) 15 | 16 | -------------------------------------------------------------------------------- /tests/benchmarks/load_module.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BhallaLab/moose-core/e2198017d1203671a422ce2825b1e7b4656e8e00/tests/benchmarks/load_module.py -------------------------------------------------------------------------------- /tests/benchmarks/micro_benchmark.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # set -x 3 | 4 | python3 -c "import moose;print(moose.__file__)" 5 | 6 | function run_str() { 7 | echo "- Timeit: $*" && python3 -m timeit -s "import moose" "$*" 8 | } 9 | 10 | # Loading time. 11 | run_str "import moose" 12 | run_str "a=moose.Neutral('a');moose.delete(a)" 13 | run_str "a=moose.Neutral('a', 10000);moose.delete(a)" 14 | run_str "a1=moose.Neutral('a');a2=moose.element(a1);moose.delete(a1)" 15 | run_str "a1=moose.Neutral('a');a2=moose.element(a1);a1==a2;moose.delete(a1)" 16 | run_str "a1=moose.Neutral('a');a2=moose.element(a1);a1==a2;moose.delete(a1)" 17 | -------------------------------------------------------------------------------- /tests/core/benchmark.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import print_function 3 | 4 | from datetime import datetime 5 | import moose 6 | 7 | def time_creation(n=1000): 8 | elist = [] 9 | start = datetime.now() 10 | for ii in range(n): 11 | elist.append(moose.Neutral('a_%d' % (ii))) 12 | end = datetime.now() 13 | delta = end - start 14 | print('total time to create %d Neutral elements: %g' % (n, delta.days * 86400 + delta.seconds + delta.microseconds * 1e-6)) 15 | return delta 16 | 17 | if __name__ == '__main__': 18 | time_creation() 19 | -------------------------------------------------------------------------------- /tests/core/models.py: -------------------------------------------------------------------------------- 1 | # Library of simple models. 2 | import moose 3 | 4 | def simple_model_a(): 5 | compt = moose.CubeMesh( '/compt' ) 6 | r = moose.Reac( '/compt/r' ) 7 | a = moose.Pool( '/compt/a' ) 8 | a.concInit = 1 9 | b = moose.Pool( '/compt/b' ) 10 | b.concInit = 2 11 | c = moose.Pool( '/compt/c' ) 12 | c.concInit = 0.5 13 | moose.connect( r, 'sub', a, 'reac' ) 14 | moose.connect( r, 'prd', b, 'reac' ) 15 | moose.connect( r, 'prd', c, 'reac' ) 16 | r.Kf = 0.1 17 | r.Kb = 0.01 18 | 19 | tabA = moose.Table2( '/compt/a/tab' ) 20 | tabB = moose.Table2( '/compt/tabB' ) 21 | tabC = moose.Table2( '/compt/tabB/tabC' ) 22 | print(tabA, tabB, tabC) 23 | moose.connect( tabA, 'requestOut', a, 'getConc' ) 24 | moose.connect( tabB, 'requestOut', b, 'getConc' ) 25 | moose.connect( tabC, 'requestOut', c, 'getConc' ) 26 | return [tabA, tabB, tabC] 27 | -------------------------------------------------------------------------------- /tests/core/param_chan.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from chan_proto import (ChannelSettings, ZChannelParams,ChannelParams,GateParams) 3 | 4 | krev=-87e-3 5 | narev=50e-3 6 | carev=140e-3 #assumes CaExt=2 mM and CaIn=50e-3 7 | ZpowCDI=0 8 | 9 | VMIN = -100e-3 10 | VMAX = 50e-3 11 | VDIVS = 3000 #0.5 mV steps 12 | CAMIN=0.01e-3 #10 nM 13 | CAMAX=40e-3 #40 uM, might want to go up to 100 uM with spines 14 | CADIVS=3000 #10 nM steps 15 | 16 | CaL12param = ChannelSettings(Xpow=1, Ypow=0, Zpow=0, Erev=0.048, name='CaL12') 17 | qfactCaL = 1 18 | CaL12_X_params = GateParams(A_rate=-880,A_B= -220e3,A_C = -1.0,Avhalf= 4.0003e-3, A_vslope=-7.5e-3,B_rate=-284,B_B=71e3,B_C=-1.0,Bvhalf=-4.0003e-3,B_vslope=5e-3) 19 | 20 | SKparam = ChannelSettings(Xpow=0, Ypow=0, Zpow=1, Erev=-.087, name='SKCa') 21 | 22 | SK_Z_params = ZChannelParams(Kd = 0.57e-3, 23 | power = 5.2, 24 | tau = 4.9e-3) 25 | 26 | 27 | Cal = ChannelParams(channel=CaL12param,X=CaL12_X_params,Y=[],Z=[]) 28 | SK = ChannelParams(channel=SKparam,X=[],Y=[],Z=SK_Z_params) 29 | -------------------------------------------------------------------------------- /tests/core/run_mumble.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | echo "Running mumble script $1" 4 | if [ $# -lt 1 ]; then 5 | echo "Usage: $0 python_script" 6 | exit 7 | fi 8 | script_name="$1" 9 | export PYTHONPATH=$PYTHONPATH:../../python/ 10 | echo "PYTHONPATH $PYTHONPATH" 11 | python $script_name 12 | dot -Teps $script_name.dot > $script_name.eps 13 | #evince $script_name.eps & 14 | -------------------------------------------------------------------------------- /tests/core/soma.p: -------------------------------------------------------------------------------- 1 | 2 | *relative 3 | *cartesian 4 | *asymmetric 5 | 6 | *set_global RA 4.0 7 | //change Cm to account for no spines - make 3x higher? 8 | *set_global CM 0.03 9 | *set_global RM 2.8 10 | *set_global EREST_ACT -80e-3 11 | *set_global ELEAK -50e-3 12 | 13 | *start_cell 14 | soma none 16.000 0 0 16.000 15 | 16 | -------------------------------------------------------------------------------- /tests/core/streamer.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """test_table_stream.py: 3 | 4 | Test moose.TableStream. 5 | 6 | This class takes over moose.Table and make sure that their vector is written 7 | to stream. Once a chunk of data is written, it is removed from vector. 8 | 9 | This way, moose never runs out of memory during simulation. 10 | 11 | """ 12 | __author__ = "Dilawar Singh" 13 | __copyright__ = "Copyright 2016, Dilawar Singh" 14 | __credits__ = ["NCBS Bangalore"] 15 | __license__ = "GNU GPL" 16 | __version__ = "1.0.0" 17 | __maintainer__ = "Dilawar Singh" 18 | __email__ = "dilawars@ncbs.res.in" 19 | __status__ = "Development" 20 | 21 | import sys 22 | import moose 23 | 24 | print( '[INFO] Using moose from %s' % moose.__file__ ) 25 | 26 | t1 = moose.Table( '/t1' ) 27 | t2 = moose.Table( '/t1/t1' ) 28 | 29 | a = moose.Streamer( '/a' ) 30 | assert( a.streamname == 'stdout' ), 'default is stdout, got %s' % a.streamname 31 | 32 | # Add another table 33 | a.addTable( t1 ) 34 | a.addTable( t2 ) 35 | a.removeTable( t1 ) 36 | -------------------------------------------------------------------------------- /tests/core/test_accessing_existing_paths.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import moose 3 | import re 4 | 5 | def fixPath(path): 6 | path = re.sub(r'/+', '/', path) 7 | return path 8 | 9 | def test_existing_path(): 10 | paths = [ '/a' 11 | , '//a' 12 | , '/a/b' 13 | , '/a/b/' 14 | , '//a//b/////' 15 | , '/a/./b' 16 | , '///a/././b' 17 | ] 18 | expectedPath = [fixPath(p) for p in paths] 19 | 20 | expectedChanges = zip(paths, expectedPath) 21 | 22 | for p in expectedPath: 23 | print( 'Accessing %s' % p ) 24 | try: 25 | moose.Neutral(p) 26 | except Exception as e: 27 | print( 'Same path access by element' ) 28 | moose.element( p ) 29 | 30 | foundPath = [] 31 | for p in moose.wildcardFind('/##'): 32 | if "/a" in p.path: 33 | foundPath.append(p.path) 34 | 35 | testFailed = False 36 | for f in foundPath: 37 | f = re.sub(r'\[\d+\]', '', f) 38 | if f not in expectedPath: 39 | testFailed = True 40 | 41 | assert not testFailed, "Test failed on paths" 42 | 43 | def main(): 44 | test_existing_path() 45 | 46 | if __name__ == '__main__': 47 | main() 48 | -------------------------------------------------------------------------------- /tests/core/test_doctests.py: -------------------------------------------------------------------------------- 1 | __author__ = "Dilawar Singh" 2 | __copyright__ = "Copyright 2019-, Dilawar Singh" 3 | __maintainer__ = "Dilawar Singh" 4 | __email__ = "dilawars@ncbs.res.in" 5 | 6 | import doctest 7 | import moose 8 | 9 | print("[INFO ] Using moose from", moose.about()) 10 | 11 | def test_showfield_func(): 12 | """Show field of a function. 13 | >>> test_showfield_func() #doctest: +NORMALIZE_WHITESPACE 14 | [/dadada[0]] 15 | allowUnknownVariable =True 16 | className =Function 17 | derivative =nan 18 | doEvalAtReinit =False 19 | dt =0.1 20 | expr =0 21 | fieldIndex =0 22 | idValue =448 23 | independent =t 24 | index =0 25 | mode =1 26 | name =dadada 27 | numData =1 28 | numField =1 29 | numVars =0 30 | path =/dadada[0] 31 | rate =0.0 32 | tick =12 33 | useTrigger =False 34 | value =0.0 35 | """ 36 | f = moose.Function('/dadada') 37 | moose.showfield(f) 38 | 39 | if __name__ == '__main__': 40 | import doctest 41 | doctest.testmod() 42 | -------------------------------------------------------------------------------- /tests/core/test_kkit.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import numpy 3 | import sys 4 | import os 5 | import moose 6 | 7 | scriptdir = os.path.dirname(os.path.realpath(__file__)) 8 | print('Script dir %s' % scriptdir) 9 | 10 | def test_kkit(): 11 | 12 | """This example illustrates loading, running, and saving a kinetic model 13 | defined in kkit format. It uses a default kkit model but you can specify 14 | another using the command line ``python filename runtime solver``. We use 15 | the gsl solver here. The model already defines a couple of plots and sets 16 | the runtime to 20 seconds. """ 17 | 18 | solver = "gsl" # Pick any of gsl, gssa, ee.. 19 | mfile = os.path.join(scriptdir, '..', 'data', 'kkit_objects_example.g') 20 | runtime = 20.0 21 | modelId = moose.loadModel(mfile, 'model') 22 | moose.reinit() 23 | moose.start(runtime) 24 | 25 | for x in moose.wildcardFind('/model/#graphs/conc#/#'): 26 | t = numpy.arange(0, x.vector.size, 1) * x.dt 27 | 28 | vals = x.vector 29 | stats = [vals.min(), vals.max(), vals.mean(), vals.std()] 30 | expected = [0.0, 0.00040464, 0.0001444, 0.00013177] 31 | assert numpy.allclose(stats, expected, 32 | rtol=1e-4), 'Got %s expected %s' % (stats, expected) 33 | 34 | def main(): 35 | test_kkit() 36 | 37 | # Run the 'main' if this script is executed standalone. 38 | if __name__ == '__main__': 39 | main() 40 | -------------------------------------------------------------------------------- /tests/core/test_metaclass.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # This test shows how to properly use metaclass to avoid 4 | # > TypeError: metaclass conflict: the metaclass of a derived class must be 5 | # > a (non-strict) subclass of the metaclasses of all its bases 6 | # error. 7 | 8 | import moose 9 | try: 10 | import six 11 | except ImportError: 12 | print("[INFO ] Requires `six` to run this test.") 13 | quit(0) 14 | 15 | # Can't use type here. Use metaclass of the base class (i.e. 16 | # moose.melement). 17 | class ChannelMeta(moose.melement.__class__): 18 | def __new__(cls, name, bases, cdict): 19 | if 'abstract' in cdict and cdict['abstract'] == True: 20 | return type.__new__(cls, name, bases, cdict) 21 | 22 | 23 | @six.add_metaclass(ChannelMeta) 24 | class ChannelBase(moose.HHChannel): 25 | annotation = {'cno': 'cno_0000047'} 26 | abstract = True 27 | def __init__(self, path, xpower=1, ypower=0, Ek=0.0): 28 | moose.HHChannel.__init__(self, path) 29 | 30 | def test_metaclass(): 31 | a = ChannelBase('a') 32 | print(a) 33 | 34 | def main(): 35 | test_metaclass() 36 | 37 | if __name__ == '__main__': 38 | main() 39 | -------------------------------------------------------------------------------- /tests/core/test_moose_paths.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import moose 3 | import re 4 | 5 | def fixPath(path): 6 | path = re.sub(r'/+', '/', path) 7 | return path 8 | 9 | def test_path(): 10 | paths = [ '/a' 11 | , '//a' 12 | , '/a/b' 13 | , '/a/b/' 14 | , '//a//b/////' 15 | , '/a/./b' 16 | , '///a/././b' 17 | ] 18 | 19 | expectedPath = set([fixPath(p) for p in paths]) 20 | print(expectedPath) 21 | 22 | for p in paths: 23 | print("-- Creating %s" % p) 24 | if not moose.exists(p): 25 | print('exists') 26 | p = moose.Neutral(p) 27 | else: 28 | p = moose.element(p) 29 | print(p) 30 | 31 | foundPath = [] 32 | for p in moose.wildcardFind('/##'): 33 | if "/a" in p.path: 34 | foundPath.append(p.path) 35 | 36 | testFailed = False 37 | for f in foundPath: 38 | f = re.sub(r'\[\d+\]', '', f) 39 | if f not in expectedPath: 40 | testFailed = True 41 | 42 | assert not testFailed, "Test failed" 43 | 44 | 45 | def main(): 46 | test_path() 47 | 48 | if __name__ == '__main__': 49 | main() 50 | -------------------------------------------------------------------------------- /tests/core/test_random_gen.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | PYTHON_EXECUTABLE=${1:-/usr/bin/python} 3 | if [ $2 ]; then 4 | export PYTHONPATH="$2" 5 | fi 6 | FAILED=0 7 | a=`${PYTHON_EXECUTABLE} -c 'import moose; moose.seed(1); print([moose.rand() for x in range(10)])'` 8 | b=`${PYTHON_EXECUTABLE} -c 'import moose; moose.seed(2); print([moose.rand() for x in range(10)])'` 9 | a=`printf "$a" | tail -n1` 10 | b=`printf "$b" | tail -n1` 11 | echo $a 12 | echo $b 13 | 14 | if [[ "$a" == "$b" ]]; then 15 | echo "Test 1 failed. Expecting not equal output. Got" 16 | printf "$a \n\t and,\n $b\n" 17 | FAILED=1 18 | else 19 | echo "Test 1 passed" 20 | fi 21 | 22 | c=`${PYTHON_EXECUTABLE} -c 'import moose; moose.seed(10); print([moose.rand() for x in \ 23 | range(10)])'` 24 | d=`${PYTHON_EXECUTABLE} -c 'import moose; moose.seed(10); print([moose.rand() for x in \ 25 | range(10)])'` 26 | c=`printf "$c" | tail -n1` 27 | d=`printf "$d" | tail -n1` 28 | echo $c 29 | echo $d 30 | 31 | if [[ "$c" == "$d" ]]; then 32 | echo "Test 2 passed" 33 | else 34 | echo "Test failed. Expecting equal output. Got" 35 | printf "$c \n\t and,\n$d\n" 36 | FAILED=1 37 | fi 38 | 39 | if [ $FAILED -eq 1 ]; then 40 | exit 1 41 | else 42 | exit 0; 43 | fi 44 | -------------------------------------------------------------------------------- /tests/core/test_random_num.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """test_random_num.py: 3 | 4 | """ 5 | 6 | __author__ = "Dilawar Singh" 7 | __copyright__ = "Copyright 2017-, Dilawar Singh" 8 | __version__ = "1.0.0" 9 | __maintainer__ = "Dilawar Singh" 10 | __email__ = "dilawars@ncbs.res.in" 11 | __status__ = "Development" 12 | 13 | import sys 14 | import os 15 | import numpy as np 16 | import moose 17 | 18 | try: 19 | reload 20 | except NameError: 21 | # Python 3 22 | from importlib import reload 23 | 24 | def test_unequal(): 25 | rand1, rand2 = [], [] 26 | N = 10 27 | for i in range( N ): 28 | x = moose.rand() 29 | rand1.append( x ) 30 | reload( moose ) 31 | for i in range( N ): 32 | x = moose.rand() 33 | rand2.append( x ) 34 | 35 | assert not np.equal( rand1, rand2 ).all() 36 | 37 | def test_equal(): 38 | rand1, rand2 = [], [] 39 | N = 10 40 | moose.seed( 10 ) 41 | for i in range( N ): 42 | x = moose.rand() 43 | rand1.append( x ) 44 | 45 | reload( moose ) 46 | moose.seed( 10 ) 47 | for i in range( N ): 48 | x = moose.rand() 49 | rand2.append( x ) 50 | 51 | assert np.equal( rand1, rand2 ).all() 52 | 53 | def main( ): 54 | test_unequal() 55 | test_equal() 56 | 57 | if __name__ == '__main__': 58 | main() 59 | 60 | -------------------------------------------------------------------------------- /tests/core/test_rdesigneur.py: -------------------------------------------------------------------------------- 1 | """test_rdesigneur.py: 2 | 3 | """ 4 | 5 | __author__ = "Dilawar Singh" 6 | __copyright__ = "Copyright 2017-, Dilawar Singh" 7 | __version__ = "1.0.0" 8 | __maintainer__ = "Dilawar Singh" 9 | __email__ = "dilawars@ncbs.res.in" 10 | __status__ = "Development" 11 | 12 | import sys 13 | import os 14 | import numpy as np 15 | import moose 16 | import rdesigneur as rd 17 | 18 | def test_rdes2(): 19 | if moose.exists( '/model' ): 20 | moose.delete( '/model' ) 21 | 22 | rdes = rd.rdesigneur( 23 | stimList = [['soma', '1', '.', 'inject', '(t>0.1 && t<0.2) * 2e-8' ]], 24 | plotList = [['soma', '1', '.', 'Vm', 'Soma membrane potential']] 25 | ) 26 | rdes.buildModel() 27 | moose.reinit() 28 | moose.start( 0.3 ) 29 | 30 | def test_rdes1(): 31 | rdes = rd.rdesigneur() 32 | rdes.buildModel() 33 | moose.showfield(rdes.soma) 34 | 35 | def main( ): 36 | test_rdes1() 37 | test_rdes2() 38 | 39 | if __name__ == '__main__': 40 | main() 41 | -------------------------------------------------------------------------------- /tests/core/test_suit1.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Script to test all import modules. 3 | 4 | import moose 5 | 6 | try: 7 | import libsbml 8 | except ImportError as e: 9 | print(e) 10 | pass 11 | 12 | def library1(): 13 | import moose.genesis 14 | import moose.SBML 15 | import moose.chemMerge 16 | import moose.utils 17 | import moose.network_utils 18 | print('done') 19 | 20 | p1 = moose.le() 21 | a = moose.Pool('/a') 22 | for i in range(10): 23 | moose.Pool('/a/p%d'%i) 24 | p2 = moose.le() 25 | assert set(p2) - set(p1) == set(['/a']), set(p2) - set(p1) 26 | aa = moose.le(a) 27 | assert len(aa) == 10 28 | 29 | try: 30 | moose.showfield('/x') 31 | except ValueError: 32 | pass 33 | 34 | moose.showfield('/a') 35 | 36 | def test_library(): 37 | library1() 38 | 39 | def main(): 40 | test_library() 41 | 42 | if __name__ == '__main__': 43 | main() 44 | -------------------------------------------------------------------------------- /tests/core/test_vec.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import moose 3 | import numpy as np 4 | 5 | def test_vec(): 6 | foo = moose.Pool('/foo1', 500) 7 | # bar = moose.vec('/foo1') 8 | bar = moose.vec(foo) 9 | assert len(bar) == 500, len(bar) 10 | for i in range(len(bar)): 11 | print(bar[i]) 12 | 13 | def test_vec2(): 14 | iaf = moose.vec('/iaf', n=10, dtype='IntFire') 15 | 16 | print(iaf, 111) 17 | iaf.Vm = np.arange(0, 10, 1.0) 18 | print(iaf.Vm) 19 | print("All done") 20 | assert iaf[5].Vm == 5, iaf[5].Vm 21 | print(iaf.Vm) 22 | 23 | def test_vec3(): 24 | print("test vec3") 25 | foo = moose.Pool('/foo3', 500) 26 | foo.vec.concInit = 0.123 27 | print(foo.vec) 28 | assert foo.concInit == 0.123, foo.concInit 29 | assert np.allclose(foo.vec.concInit, [0.123]*500) 30 | 31 | 32 | if __name__ == '__main__': 33 | test_vec() 34 | test_vec2() 35 | test_vec3() 36 | -------------------------------------------------------------------------------- /tests/data/19085.cspace: -------------------------------------------------------------------------------- 1 | M101: |DabX|Jbca| 5.59269 0.0157641 0.172865 0.361005 4.72728 1.08558 0.0982933 -------------------------------------------------------------------------------- /tests/profiling/profile.py: -------------------------------------------------------------------------------- 1 | import moose 2 | import time 3 | 4 | def profile_creation(): 5 | print('Only creation') 6 | moose.Neutral('x') 7 | t = time.time() 8 | for i in range(10000): 9 | moose.Neutral('x/x%d'%i) 10 | print('Time taken %g s' % time.time()-t) 11 | moose.delete('x') 12 | 13 | def profile_creation_destruction(): 14 | print('Create and delete') 15 | t = time.time() 16 | for i in range(10000): 17 | moose.Neutral('a') 18 | moose.delete('a') 19 | print('Time taken %g s' % time.time()-t) 20 | 21 | if __name__ == "__main__": 22 | profile_creation() 23 | profile_creation_destruction() 24 | -------------------------------------------------------------------------------- /tests/pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | addopts = -ra -q --maxfail=2 3 | norecusedirs = .git _build tmp* 4 | filterwarnings = 5 | error 6 | ignore::DeprecationWarning 7 | ignore::PendingDeprecationWarning 8 | ignore::UserWarning 9 | ignore::Warning 10 | ignore::FutureWarning 11 | -------------------------------------------------------------------------------- /tests/rdesigneur/test_1_minimalModel.py: -------------------------------------------------------------------------------- 1 | # Rdesigneur tutorial converted to a test. 2 | import moose 3 | print("[INFO ] MOOSE version=%s, loc=%s" % (moose.version(), moose.__file__)) 4 | import rdesigneur as rd 5 | 6 | def test_simple(): 7 | """First test. 8 | >>> test_simple() # doctest: +NORMALIZE_WHITESPACE 9 | Rdesigneur: Elec model has 1 compartments and 0 spines on 0 compartments. 10 | 11 | [/model[0]/elec[0]/soma[0]] 12 | Cm =7.853981633975e-09 13 | Em =-0.0544 14 | Im =1.3194689277024895e-08 15 | Ra =7639437.268410473 16 | Rm =424413.1773342278 17 | Vm =-0.06 18 | className =ZombieCompartment 19 | diameter =0.0005 20 | dt =0.0 21 | fieldIndex =0 22 | idValue =455 23 | index =0 24 | initVm =-0.065 25 | inject =0.0 26 | length =0.0005 27 | name =soma 28 | numData =1 29 | numField =1 30 | path =/model[0]/elec[0]/soma[0] 31 | tick =-2 32 | x =0.0005 33 | x0 =0.0 34 | y =0.0 35 | y0 =0.0 36 | z =0.0 37 | z0 =0.0 38 | 39 | INCOMING: 40 | /model[0]/elec[0]/soma ('parentMsg',) <--- /model[0]/elec ('childOut',) 41 | OUTGOING: 42 | """ 43 | rdes = rd.rdesigneur() 44 | rdes.buildModel() 45 | moose.showfield(rdes.soma) 46 | moose.showmsg(rdes.soma) 47 | 48 | if __name__ == '__main__': 49 | import doctest 50 | doctest.testmod() 51 | -------------------------------------------------------------------------------- /tests/rdesigneur/test_21_vclamp.py: -------------------------------------------------------------------------------- 1 | import moose 2 | import numpy as np 3 | import rdesigneur as rd 4 | 5 | def test_21_vclamp(): 6 | """Test vclamp. 7 | """ 8 | rdes = rd.rdesigneur( 9 | stimList = [['soma', '1', '.', 'vclamp', '-0.065 + (t>0.1 && t<0.2) * 0.02' ]], 10 | plotList = [ 11 | ['soma', '1', '.', 'Vm', 'Soma membrane potential'], 12 | ['soma', '1', 'vclamp', 'current', 'Soma holding current'], 13 | ] 14 | ) 15 | rdes.buildModel() 16 | moose.reinit() 17 | moose.start( 0.3 ) 18 | # rdes.display(block=False) 19 | data = [] 20 | for t in moose.wildcardFind('/##[TYPE=Table]'): 21 | data.append(t.vector) 22 | mean = np.mean(data, axis=1) 23 | std = np.std(data, axis=1) 24 | assert np.allclose([-5.83422152e-02, -9.28563233e-09], mean), mean 25 | assert np.allclose([9.41512562e-03, 2.79081939e-08], std), std 26 | return data 27 | 28 | if __name__ == '__main__': 29 | test_21_vclamp() 30 | -------------------------------------------------------------------------------- /tests/rdesigneur/test_30_squid_currentPulse.py: -------------------------------------------------------------------------------- 1 | import matplotlib as mpl 2 | mpl.use('Agg') 3 | import numpy as np 4 | import moose 5 | import rdesigneur as rd 6 | 7 | def test_current_pulse_squid(): 8 | """Test current pulse. 9 | >>> test_current_pulse_squid() 10 | Rdesigneur: Elec model has 1 compartments and 0 spines on 0 compartments. 11 | [array([-0.065 , -0.06525877, -0.06549723, ..., -0.06676325, 12 | -0.06676329, -0.06676332])] 13 | """ 14 | rdes = rd.rdesigneur( 15 | chanProto = [['make_HH_Na()', 'Na'], ['make_HH_K()', 'K']], 16 | chanDistrib = [ 17 | ['Na', 'soma', 'Gbar', '1200' ], 18 | ['K', 'soma', 'Gbar', '360' ]], 19 | stimList = [['soma', '1', '.', 'inject', '(t>0.1 && t<0.2) * 1e-8' ]], 20 | plotList = [['soma', '1', '.', 'Vm', 'Membrane potential']]) 21 | rdes.buildModel() 22 | moose.reinit() 23 | moose.start(0.3) 24 | rdes.display(block=False) 25 | data = moose.wildcardFind('/##[TYPE=Table]')[0].vector 26 | m, u = data.mean(), data.std() 27 | np.allclose([-0.06507780556166297, 0.012544993918549656], [m, u]) 28 | print("[INFO ] Done") 29 | return True 30 | 31 | if __name__ == '__main__': 32 | test_current_pulse_squid() 33 | -------------------------------------------------------------------------------- /tests/rdesigneur/test_51_periodic_syn_input.py: -------------------------------------------------------------------------------- 1 | # This example demonstrates periodic synaptic input to a cell. 2 | # Copyright (C) Upinder S. Bhalla NCBS 2018 3 | # Released under the terms of the GNU Public License V3. No warranty. 4 | # Doctest by Dilawar Singh 5 | 6 | import moose 7 | import rdesigneur as rd 8 | import numpy as np 9 | 10 | 11 | def test_periodic_syninput(): 12 | rdes = rd.rdesigneur( 13 | cellProto = [['somaProto', 'soma', 20e-6, 200e-6]], 14 | chanProto = [['make_glu()', 'glu']], 15 | chanDistrib = [['glu', 'soma', 'Gbar', '1' ]], 16 | 17 | # Deliver stimulus to glu synapse on soma, periodically at 50 Hz. 18 | stimList = [['soma', '0.5', 'glu', 'periodicsyn', '50' ]], 19 | plotList = [['soma', '1', '.', 'Vm', 'Soma membrane potential']] 20 | ) 21 | rdes.buildModel() 22 | moose.reinit() 23 | moose.start( 0.3 ) 24 | t = moose.wildcardFind('/##[TYPE=Table]')[0].vector 25 | expected = np.array([-0.04995514162861773, 0.004795008283676097]) 26 | got = np.array([t.mean(), t.std()]) 27 | assert np.allclose(expected, got, rtol=1e-3), (expected, got) 28 | print('ok') 29 | return t 30 | 31 | if __name__ == '__main__': 32 | test_periodic_syninput() 33 | -------------------------------------------------------------------------------- /tests/rdesigneur/test_6_chem_osc.py: -------------------------------------------------------------------------------- 1 | import moose 2 | import numpy as np 3 | import rdesigneur as rd 4 | 5 | def test_chem_osc(): 6 | """Test chemical oscillation. 7 | """ 8 | rdes = rd.rdesigneur( 9 | turnOffElec = True, 10 | diffusionLength = 1e-3, # Default diffusion length is 2 microns 11 | chemProto = [['makeChemOscillator()', 'osc']], 12 | chemDistrib = [['osc', 'soma', 'install', '1' ]], 13 | plotList = [['soma', '1', 'dend/a', 'conc', 'a Conc'], 14 | ['soma', '1', 'dend/b', 'conc', 'b Conc']] 15 | ) 16 | rdes.buildModel() 17 | b = moose.element( '/model/chem/dend/b' ) 18 | b.concInit *= 5 19 | moose.reinit() 20 | moose.start(200) 21 | res = [t.vector for t in moose.wildcardFind('/##[TYPE=Table2]')] 22 | m = np.mean(res, axis=1) 23 | s = np.std(res, axis=1) 24 | expected = ([0.13622532, 0.13261175], [0.08518292, 0.06766806]) 25 | assert np.allclose(expected, [m,s]), (m,s) 26 | 27 | if __name__ == '__main__': 28 | test_chem_osc() 29 | -------------------------------------------------------------------------------- /tests/requirements.txt: -------------------------------------------------------------------------------- 1 | coverage 2 | pytest 3 | pytest-cov 4 | python-libsbml 5 | pyneuroml 6 | scipy 7 | matplotlib 8 | -------------------------------------------------------------------------------- /tests/support/_neuroml/CA1.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | ## Aditya Gilra, NCBS, Bangalore, 2012 3 | ## Dilawar Singh, NCBS, 2015 4 | 5 | import os 6 | os.environ['NUMPTHREADS'] = '1' 7 | import sys 8 | 9 | import moose 10 | from moose.utils import * 11 | import moose.utils as mu 12 | from . import count 13 | import numpy as np 14 | 15 | from moose.neuroml.NeuroML import NeuroML 16 | 17 | import unittest 18 | 19 | simdt = 10e-6 # s 20 | plotdt = 10e-6 # s 21 | runtime = 0.19 # s 22 | 23 | def loadGran98NeuroML_L123(filename): 24 | neuromlR = NeuroML() 25 | populationDict, projectionDict = \ 26 | neuromlR.readNeuroMLFromFile(filename) 27 | soma_path = populationDict['CA1group'][1][0].path+'/Seg0_soma_0_0' 28 | somaVm = setupTable('somaVm',moose.Compartment(soma_path),'Vm') 29 | soma = moose.Compartment(soma_path) 30 | moose.reinit() 31 | moose.start(runtime) 32 | tvec = np.arange(0.0,runtime,simdt) 33 | res = count.spike_train_simple_stat( somaVm.vector ) 34 | return res['number of spikes'] 35 | 36 | if __name__ == "__main__": 37 | if len(sys.argv)<2: 38 | filename = "CA1soma.net.xml" 39 | else: 40 | filename = sys.argv[1] 41 | loadGran98NeuroML_L123(filename) 42 | 43 | 44 | -------------------------------------------------------------------------------- /tests/support/_neuroml/README: -------------------------------------------------------------------------------- 1 | This is a modified version of contents of directory 2 | ../../../Demos/neuroml/CA1PyramidalCell/ . This is here for purpose of testing 3 | only. 4 | 5 | File ./ca1_test.py adds two tests: injected current vs frequency and no of spike 6 | when a certain amount of current is inject. If these test fails, neuroml parser 7 | is not working properly. 8 | -------------------------------------------------------------------------------- /tests/support/_neuroml/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BhallaLab/moose-core/e2198017d1203671a422ce2825b1e7b4656e8e00/tests/support/_neuroml/__init__.py -------------------------------------------------------------------------------- /tests/support/_neuroml/cells_channels/README: -------------------------------------------------------------------------------- 1 | CA1.morph.original.xml is the original file exported from neuroConstruct. 2 | It does not work with MOOSE as it has inhomogeneous_value tags, 3 | and negative conductances for hd channel (!), 4 | and channels whose parameters change in the morphml after loading in the channelml. 5 | 6 | CA1.morph.bad.xml is the CA1 cell morphology with channels from the cerebellar granule cell! 7 | It shows spikes that are a few tens of microsecond wide using 10microsec time step in ee, 8 | but hsolve just oscillates for 10microsec, with 1 microsec time step, hsolve works. 9 | 10 | CA1.morph.xml is the original file from neuroConstruct, but the inhomogeneous_value tags have been removed, 11 | and hd channels with negative conductances have been removed, 12 | and some new channels with the parameter changes hard coded have been used. 13 | This works in MOOSE, but fires uniformly spontaneously at a low rate. 14 | 15 | -------------------------------------------------------------------------------- /tests/support/_neuroml/cells_channels/pas.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ChannelML file containing a single Channel description 5 | 6 | 7 | 8 | 9 | 10 | Simple example of a leak/passive conductance. Note: for GENESIS cells with a single leak conductance, 11 | it is better to use the Rm and Em variables for a passive current. 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /tests/support/test_kkit.py: -------------------------------------------------------------------------------- 1 | # savemodel.py --- 2 | 3 | # Filename: savemodel.py 4 | # Description: 5 | # Author: Subhasis Ray 6 | # Maintainer: 7 | # Created: Wed Oct 29 00:08:50 2014 (+0530) 8 | # Version: 9 | # Last-Updated:Thr Dec 23 16:31:00 2015 (+0530) 10 | # By: 11 | # Update #: 0 12 | # URL: 13 | # Keywords: 14 | # Compatibility: 15 | 16 | import os 17 | import traceback 18 | import moose 19 | 20 | cwd = os.path.dirname( os.path.realpath( __file__ ) ) 21 | 22 | def test_kkit(): 23 | """ 24 | The script demonstates to convert Chemical (Genesis) file back to Genesis 25 | file using moose 26 | """ 27 | moose.loadModel(os.path.join( cwd, '../data/reaction.g'), '/model') 28 | written = moose.writeKkit('/model', 'testsave.g') 29 | print( written ) 30 | 31 | if __name__ == '__main__': 32 | test_kkit() 33 | -------------------------------------------------------------------------------- /tests/support/test_neuroml.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from __future__ import absolute_import, print_function, division 4 | 5 | __author__ = "Dilawar Singh" 6 | __copyright__ = "Copyright 2015, Dilawar Singh and NCBS Bangalore" 7 | __credits__ = ["NCBS Bangalore"] 8 | __license__ = "GNU GPL" 9 | __version__ = "1.0.0" 10 | __maintainer__ = "Dilawar Singh" 11 | __email__ = "dilawars@ncbs.res.in" 12 | __status__ = "Development" 13 | 14 | import sys 15 | import os 16 | import moose 17 | 18 | # the model lives in the same directory as the test script 19 | modeldir = os.path.dirname(__file__) 20 | 21 | import _neuroml 22 | from _neuroml.FvsI_CA1 import ca1_main, loadModel 23 | from _neuroml.CA1 import loadGran98NeuroML_L123 24 | 25 | def test_ca1(): 26 | p = os.path.join(modeldir, '_neuroml/cells_channels/CA1soma.morph.xml') 27 | loadModel(p) 28 | assert 10 == ca1_main(4e-13) 29 | assert 20 == ca1_main(8e-13) 30 | assert 29 == ca1_main(14e-13) 31 | assert 34 == ca1_main(18e-13) 32 | 33 | def test_gran(): 34 | p = os.path.join(modeldir, '_neuroml/CA1soma.net.xml') 35 | assert loadGran98NeuroML_L123(p) in [8,9] 36 | 37 | def main(): 38 | test_ca1() 39 | test_gran() 40 | 41 | if __name__ == '__main__': 42 | main() 43 | -------------------------------------------------------------------------------- /tests/support/test_sbml.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Test SBML capabilities of PyMOOSE 4 | """ 5 | 6 | __author__ = "Dilawar Singh, HarshaRani" 7 | __copyright__ = "Copyright 2015, Dilawar Singh and NCBS Bangalore" 8 | __credits__ = ["NCBS Bangalore"] 9 | __license__ = "GNU GPL" 10 | __version__ = "1.0.0" 11 | __maintainer__ = "Dilawar Singh" 12 | __email__ = "dilawars@ncbs.res.in" 13 | __status__ = "Development" 14 | 15 | import os 16 | import moose 17 | 18 | print("Using moose form %s" % moose.__file__) 19 | print("\t Moose version %s" % moose.version()) 20 | 21 | # the model lives in the same directory as the test script 22 | sdir_ = os.path.dirname(os.path.realpath(__file__)) 23 | 24 | 25 | def test_sbml(): 26 | modelname = os.path.join(sdir_, "..", "data", "00001-sbml-l3v1.xml") 27 | model = moose.readSBML(modelname, "/sbml") 28 | if not model: 29 | print("Most likely python-libsbml is not installed.") 30 | return 0 31 | moose.reinit() 32 | moose.start(200) 33 | # TODO: Add more tests here. 34 | p = moose.wildcardFind("/sbml/##") 35 | assert len(p) == 8, p 36 | names = ["compartment", "mesh", "S1", "info", "S2", "info", "reaction1"] 37 | for x in p: 38 | assert x.name in names 39 | 40 | 41 | def main(): 42 | test_sbml() 43 | 44 | 45 | if __name__ == "__main__": 46 | main() 47 | -------------------------------------------------------------------------------- /utility/boost_ode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ===================================================================================== 3 | * 4 | * Filename: boost_ode.h 5 | * 6 | * Description: Utility function for Boost ODEINT library. 7 | * 8 | * Version: 1.0 9 | * Created: Saturday 24 November 2018 04:54:32 IST 10 | * Revision: none 11 | * Compiler: gcc 12 | * 13 | * Author: Dilawar Singh (), dilawars@ncbs.res.in 14 | * Organization: NCBS Bangalore 15 | * 16 | * ===================================================================================== 17 | */ 18 | #ifndef BOOST_ODE_H 19 | #define BOOST_ODE_H 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | typedef double value_type_; 26 | typedef std::vector vector_type_; 27 | 28 | typedef boost::numeric::odeint::runge_kutta4< vector_type_ > rk4_stepper_type_; 29 | typedef boost::numeric::odeint::runge_kutta_dopri5< vector_type_ > rk_dopri_stepper_type_; 30 | typedef boost::numeric::odeint::modified_midpoint< vector_type_ > rk_midpoint_stepper_type_; 31 | 32 | /*----------------------------------------------------------------------------- 33 | * This stepper type found to be most suitable for adaptive solver. The gsl 34 | * implementation has runge_kutta_fehlberg78 solver. 35 | *-----------------------------------------------------------------------------*/ 36 | typedef boost::numeric::odeint::runge_kutta_cash_karp54< vector_type_ > rk_karp_stepper_type_; 37 | typedef boost::numeric::odeint::runge_kutta_fehlberg78< vector_type_ > rk_felhberg_stepper_type_; 38 | 39 | #endif /* end of include guard: BOOST_ODE_H */ 40 | -------------------------------------------------------------------------------- /utility/matrix_util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ===================================================================================== 3 | * 4 | * Filename: matrix_util.h 5 | * 6 | * Description: Utility function for working with blas matrices. 7 | * 8 | * Version: 1.0 9 | * Created: 05/10/2016 05:26:06 PM 10 | * Revision: none 11 | * Compiler: gcc 12 | * 13 | * Author: Dilawar Singh (), dilawars@ncbs.res.in 14 | * Organization: NCBS Bangalore 15 | * 16 | * ===================================================================================== 17 | */ 18 | 19 | #ifndef matrix_util_INC 20 | #define matrix_util_INC 21 | 22 | #ifdef USE_BOOST_ODE 23 | 24 | #include 25 | #include "boost/numeric/bindings/lapack/lapack.hpp" 26 | #include "boost/numeric/bindings/lapack/geev.hpp" 27 | typedef double value_type; 28 | using namespace boost::numeric; 29 | 30 | /** 31 | * @brief Swap row r1 and r2. 32 | */ 33 | void swapRows( ublas::matrix< value_type >& mat, unsigned int r1, unsigned int r2); 34 | 35 | int reorderRows( ublas::matrix< value_type >& U, int start, int leftCol ); 36 | 37 | void eliminateRowsBelow( ublas::matrix< value_type >& U, int start, int leftCol ); 38 | 39 | unsigned int rankUsingBoost( ublas::matrix& U ); 40 | 41 | #endif 42 | #endif /* ----- #ifndef matrix_util_INC ----- */ 43 | -------------------------------------------------------------------------------- /utility/meson.build: -------------------------------------------------------------------------------- 1 | # Author: Subhasis Ray 2 | # Date: Sun Jul 7 3 | 4 | utility_src = ['strutil.cpp', 5 | 'types.cpp', 6 | 'setupenv.cpp', 7 | 'numutil.cpp', 8 | 'Annotator.cpp', 9 | 'Vec.cpp', 10 | 'utility.cpp', 11 | 'cnpy.cpp' 12 | ] 13 | 14 | utility_lib = static_library('utility', utility_src) 15 | -------------------------------------------------------------------------------- /utility/simple_test.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================== 3 | * 4 | * Filename: simpletest.hpp 5 | * 6 | * Description: Main header file containing all definitions and macros. 7 | * 8 | * Version: 1.0 9 | * Created: 05/20/2014 09:22:42 PM 10 | * Revision: none 11 | * Compiler: gcc 12 | * 13 | * Author: Dilawar Singh (), dilawars@ncbs.res.in 14 | * Organization: 15 | * 16 | * ============================================================================== 17 | */ 18 | 19 | #ifndef SIMPLETEST_INC 20 | #define SIMPLETEST_INC 21 | 22 | #include "print_function.hpp" 23 | #include "testing_macros.hpp" 24 | #include "simple_assert.hpp" 25 | 26 | #endif /* ----- #ifndef SIMPLETEST_INC ----- */ 27 | -------------------------------------------------------------------------------- /utility/test_util.cpp: -------------------------------------------------------------------------------- 1 | /*** 2 | * Description: Test utility functions. 3 | * 4 | * Created: 2020-04-14 5 | 6 | * Author: Dilawar Singh 7 | */ 8 | 9 | #include 10 | 11 | #include "utility.h" 12 | #include "strutil.h" 13 | #include "testing_macros.hpp" 14 | 15 | using namespace std; 16 | 17 | void test_normalize_path() 18 | { 19 | string p1("//a/./b"); 20 | auto p1fixes = moose::normalizePath(p1); 21 | std::cout << p1 << " " << p1fixes << std::endl; 22 | 23 | string p2("//a/./././///b"); 24 | auto p2fixes = moose::normalizePath(p2); 25 | std::cout << p2 << " " << p2fixes << std::endl; 26 | ASSERT_EQ( p2fixes, "/a/b", "PATH"); 27 | } 28 | 29 | int main(int argc, const char *argv[]) 30 | { 31 | test_normalize_path(); 32 | return 0; 33 | } 34 | 35 | -------------------------------------------------------------------------------- /utility/utility.cpp: -------------------------------------------------------------------------------- 1 | /*** 2 | * Description: Utility functions. 3 | * 4 | * Created: 2020-02-23 5 | 6 | * Author: Dilawar Singh 7 | * 8 | * Organization: NCBS Bangalore 9 | * License: MIT License 10 | */ 11 | 12 | #include "utility.h" 13 | 14 | namespace moose { 15 | 16 | void splitIntervalInNParts(size_t max, size_t n, std::vector>& result) 17 | { 18 | size_t start = 0; 19 | size_t stop = 0; 20 | while(n > 0) 21 | { 22 | size_t f = (size_t) (max / n); 23 | stop += f; 24 | result.push_back({start, stop}); 25 | start = stop; 26 | n -= 1; 27 | max -= f; 28 | } 29 | assert(max == 0); 30 | } 31 | } // namespace moose 32 | --------------------------------------------------------------------------------