Skip to content

Commit

Permalink
New python bindings using pybind11 (#410)
Browse files Browse the repository at this point in the history
* not a bug.

* Turned scripts recieved from harsha into a test case. open #402.

* Renamed wrapper.Neutral to __Wrapper__. With new API, this functionality
can be built in.

* closes #401

* Fixed another bug: -DWTIH_BOOST=ON could not override GSL after WITH_GSL
was cached by cmake. Ie, if once built with default options, there was
no way to use BOOST without cleaning up the old build completely.

* check is made if solver has space while reading/writing SBML files,small change to port the code to py3

* Squashed commit of the following:

commit b313f8d72537b6d8218857d0f0ef81268bc05f81
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sun Apr 12 19:03:24 2020 +0530

    moved __init__.py and moose.py to pybind folder.

commit 77afafd49dc6e99b1c00c060b00181d1190e1c7b
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sun Apr 12 18:03:28 2020 +0530

    Use not gui backend.

commit 6ad911c73c5f9d01846c5869263c12ee82e1bdf8
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sun Apr 12 13:23:33 2020 +0530

    Variable and Cinfo need not be exposed.

commit 5fec8497593a9d77b5ed5832336747c6cd8fb33c
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sun Apr 12 12:27:13 2020 +0530

    Create moose element from vec and field.

commit ab3d85dc0f023a4cda2a9cf7ecfae97d860567b2
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sun Apr 12 11:21:21 2020 +0530

    Added support for ["string", double] valueFinfoItem.

commit 9c967c02abd565c90d452d200f778e1d2ed78349
Author: Anushree Narjala <anushree.narjala@gmail.com>
Date:   Sun Apr 12 10:03:17 2020 +0530

    seed is an int and can't be empty.

commit cc7ea95
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Apr 11 15:46:11 2020 +0530

    This is a really good commit.  `.num` is supported now.

commit 2185c65
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Apr 11 12:28:39 2020 +0530

    Added doxygen target.

commit 32c3fc7
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Fri Apr 10 13:09:09 2020 +0530

    Finfo is also vectorised.

commit d716124
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Fri Apr 10 12:03:53 2020 +0530

    Negative indexing is allowed. Fixes one more moose-examples neuroml/LIF/twoLIFxml_firing.py

commit a2d6a38
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Thu Apr 9 21:07:04 2020 +0530

    Use old PyRun code. Pybind11 does not have subterpreter support.

commit 2587c0d
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Thu Apr 9 13:58:16 2020 +0530

    Added a test for testing pyrun.

commit f3a4925
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Thu Apr 9 11:25:11 2020 +0530

    when `-DWITH_BOOST=ON` is passed to cmake, it now overrides `WITH_GSL`
    option. Also fixes build failure.

commit 2127c3a
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Thu Apr 9 11:15:01 2020 +0530

    Fixes https://gitlab.com/dilawar/moose-core/-/issues/7

commit 31f2b8f
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Wed Apr 8 23:16:37 2020 +0530

    If Function is not valid_, return quietly.

commit b91a0ef
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Wed Apr 8 22:25:06 2020 +0530

    All tests are passing now.

commit 0ce71ac
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Wed Apr 8 20:13:39 2020 +0530

    genesis and kkit are reverted back to master.

commit 6535c46
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Wed Apr 8 19:03:13 2020 +0530

    isA is working just fine.

commit bf118f4
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Wed Apr 8 14:18:23 2020 +0530

    We can now assign moose.vec to a field which takes Id.
    refactoring. int -> double, bool -> (int, double) coercing is allowed.
    Fixed script /home1/dilawars/Work.HG/GITLAB/moose-examples/snippets/interpol2d.py
    in https://gitlab.com/dilawar/moose-examples/-/issues/1

commit fb57aaf
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Wed Apr 8 13:21:19 2020 +0530

    overloading template function is not so straight-forward when
    typecasting can happen by itslf e.g. int and unsigned int.

commit 22aeb43
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Wed Apr 8 09:52:57 2020 +0530

    moose.element return single ObjId and not vec as I mistakenly assumed.

commit ea81f1c
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Tue Apr 7 21:45:13 2020 +0530

    Vectorize function later.

commit 4624651
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Tue Apr 7 20:48:47 2020 +0530

    name, path, and parent of moose.vec are not vectorised.

commit 6126a64
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Tue Apr 7 19:20:28 2020 +0530

    snippets/savemodel.py is causing problem now.

commit 15eae1d
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Tue Apr 7 18:08:37 2020 +0530

    vec values are returned as numpy array.

commit cc89202
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Tue Apr 7 16:55:00 2020 +0530

    Default parameters in connect is now working. First argument is not
    needed if it is a class member function.

commit 8092a8e
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Tue Apr 7 16:19:16 2020 +0530

    If a Shell function retuns Id, wrap it in a MooseVec. The current API
    has this behaviour.

commit 8ca430c
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Tue Apr 7 13:54:52 2020 +0530

    TODO: Id should be wrapped as moose.vec

commit d6552e6
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Tue Apr 7 12:05:31 2020 +0530

    Passes snippets/synapse.py https://gitlab.com/dilawar/moose-examples/-/issues/1

commit 3ea0a66
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Tue Apr 7 11:23:27 2020 +0530

    Support more return types.

commit 0862930
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Tue Apr 7 10:44:35 2020 +0530

    MooseVec can now handle fieldElement as well.

commit 1d40e74
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Mon Apr 6 21:03:58 2020 +0530

    Needs some major overhaul of API.

commit 3116b05
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Mon Apr 6 15:04:32 2020 +0530

    Removed melement.

commit 8baffdc
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Mon Apr 6 15:00:59 2020 +0530

    Support more fieldType. Fixes one more failing script in moose examples.

commit b3a3e84
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Mon Apr 6 14:01:28 2020 +0530

    Time to run examples now.

commit 731fc47
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Mon Apr 6 13:44:38 2020 +0530

    type checking has been moved to C++ code. its bit tricky here and not as
    readable as it should be. May be I can leave this at the python level.

commit 790efdf
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Mon Apr 6 13:24:30 2020 +0530

    Some more progress. Getting a bit more faster than the current API.

commit 4e24621
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Mon Apr 6 13:17:18 2020 +0530

    Overloaded funtions.

commit bc95f4d
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Mon Apr 6 12:25:23 2020 +0530

    Enabled helper functions.

commit aeecc41
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Mon Apr 6 00:17:06 2020 +0530

    beat the old api in microbenchmarks as well.

commit 6e88eff
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sun Apr 5 23:56:00 2020 +0530

    minor tweaks.

commit 1dd9390
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sun Apr 5 23:46:37 2020 +0530

    moose.create is fast but moose.delete is bit slow.

commit 0eda1b7
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sun Apr 5 22:39:37 2020 +0530

    forward declaration and compile fixes.

commit a3bdd69
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sun Apr 5 20:05:43 2020 +0530

    Added benchmark file.

commit e294eea
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sun Apr 5 19:55:01 2020 +0530

    added micro benchmarks.

commit 5979dc4
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Apr 4 23:25:28 2020 +0530

    Added documentations.

commit 56c12f4
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Apr 4 22:21:40 2020 +0530

    All tests are passing.. needs to add some tests..

commit f039fad
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Apr 4 21:58:28 2020 +0530

    _cmoose to _moose.

commit 9543258
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Apr 4 19:57:21 2020 +0530

    Needs to fix some more API issues.

commit 4d6c147
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Apr 4 17:49:15 2020 +0530

    Added version 2.5

commit f0efd21
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Apr 4 17:41:41 2020 +0530

    Removed a broken test and renamed one. The namedvars tests is moved to
    fixme (not supported).

commit cd3dc5a
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Apr 4 12:11:59 2020 +0530

    Needs final touch.

commit 5262dc4
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Apr 4 12:03:56 2020 +0530

    Added one more missing attribute.

commit 7757643
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Apr 4 11:25:53 2020 +0530

    test commit [skip ci]

commit cb8a970
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Apr 4 10:28:06 2020 +0530

    old test is back.

commit 06e3357
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Apr 4 10:24:53 2020 +0530

    Fixed the issue with isinstance(x, moose.CubeMesh). Now it is working
    fine.

commit 685ab75
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Apr 4 07:26:24 2020 +0530

    One more test is passing.

commit 6188e09
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Apr 4 07:25:25 2020 +0530

    Restored old values in the test.

commit 349f8ea
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Apr 4 05:55:15 2020 +0530

    fixes to one more tests.

commit c90986a
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Apr 4 05:42:22 2020 +0530

    Now do a local testing.

commit e6a6575
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Apr 4 05:37:26 2020 +0530

    numerical assertion of oscillatory tests are hard.

commit 5af49e9
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Apr 4 05:26:34 2020 +0530

    Almost all tests are passing.

commit d7f03bd
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Apr 4 04:54:44 2020 +0530

    remove 'value' attribute from the ObjId, it was conflicting with MString
    'value'.

commit ce79591
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Apr 4 04:43:36 2020 +0530

    Needs to fix doc.

commit 113dddc
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Apr 4 04:36:02 2020 +0530

    more tests are passing. all test_Xreacs are passing now.

commit 29ff41c
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Apr 4 04:31:33 2020 +0530

    Use ObjId instread of Id in buildMeshJunction.

commit 33e9591
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Apr 4 04:27:38 2020 +0530

    Passing ObjId as Id is creating trouble.

commit 537779e
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Apr 4 03:59:30 2020 +0530

    one more test passes.

commit 650309a
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Apr 4 03:05:28 2020 +0530

    delete works.

commit b13e051
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Apr 4 02:13:31 2020 +0530

    Some more tests [skip ci]

commit e518d35
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Apr 4 01:42:15 2020 +0530

    One more test is passed.

commit c783578
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Apr 4 01:37:24 2020 +0530

    isinstance support is added.

commit 2a28f9a
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Fri Apr 3 22:15:46 2020 +0530

    Added tests to normalizepath.

commit 4c2086a
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Fri Apr 3 22:08:30 2020 +0530

    Global random number generator is moved from basecode to randnum.

commit 6a2b7b7
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Fri Apr 3 20:09:21 2020 +0530

    Couple of seg-faults to take care of.

commit 8a90db2
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Fri Apr 3 18:27:52 2020 +0530

    Fixed one more test.

commit 1798a1e
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Fri Apr 3 14:18:47 2020 +0530

    Need to fix rdesignuer now.

commit 0be10c0
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Fri Apr 3 12:59:16 2020 +0530

    Finfo can also return .vec.

commit 226d616
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Fri Apr 3 12:35:32 2020 +0530

    Function is also fixed.

commit b68a97b
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Fri Apr 3 12:22:29 2020 +0530

    SynapseTest is also passing.

commit 8f2a039
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Fri Apr 3 11:38:20 2020 +0530

    Fixes all the c++ tests

commit 173b9d2
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Fri Apr 3 11:28:47 2020 +0530

    ObjId.vec create a vec on the fly.

commit e71fea0
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Thu Apr 2 22:39:02 2020 +0530

    Same problem on OSX. One more test is failing.

commit 47e25f9
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Thu Apr 2 22:08:41 2020 +0530

    Some more fixes. moose.element is not honoring dataIndex.

commit 9de507a
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Thu Apr 2 20:17:29 2020 +0530

    bebug vec and connection list.

commit d7f0a26
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Thu Apr 2 19:22:00 2020 +0530

    Refactoring.

commit 2221410
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Thu Apr 2 16:17:48 2020 +0530

    Added .clang-format file.

commit 7a8437d
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Thu Apr 2 12:44:32 2020 +0530

    more progress. Lets have lunch first now.

commit 0ed8933
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Thu Apr 2 12:25:44 2020 +0530

    Fix Xreacs later.

commit 04d4d2f
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Thu Apr 2 11:52:19 2020 +0530

    Refactoring. If Finfo* is passed, no need to pass rttitype and fname. We
    can get these values from Finfo.

commit 77cc0b1
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Wed Apr 1 21:21:06 2020 +0530

    refacorted codebase...

commit 52cfdf7
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Wed Apr 1 21:06:13 2020 +0530

    Added extra header for Finfo ...

commit b16dd1c
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Wed Apr 1 19:58:56 2020 +0530

    Needs to implement LookupFinfo set.

commit 8199fc0
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Wed Apr 1 18:48:25 2020 +0530

    Disable pybind11.

commit 5c25dad
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Wed Apr 1 18:48:02 2020 +0530

    One more tests seem to pass.

commit 40a4559
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Wed Apr 1 18:22:52 2020 +0530

    Some more fixes.

commit dd9b50e
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Wed Apr 1 17:59:50 2020 +0530

    Perfect. One more test passes.

commit fec019b
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Wed Apr 1 15:41:22 2020 +0530

    Refactoring and some more generic programming.

commit 9eb2308
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Tue Mar 31 20:48:57 2020 +0530

    small fixes. Changes in API requires .id .

commit 7de3228
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Tue Mar 31 19:13:51 2020 +0530

    Minor tweak to a test.

commit c541b91
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Tue Mar 31 19:08:36 2020 +0530

    One more test passed.

commit 5cc3d3b
Merge: ce579ac 1abb6f1
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Tue Mar 31 18:59:23 2020 +0530

    Merge branch 'pybind11_shell' into temp

commit ce579ac
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Tue Mar 31 18:58:59 2020 +0530

    renmaed.

commit 16bbc3e
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Tue Mar 31 18:20:55 2020 +0530

    phew. I made a boo boo before.

commit 1abb6f1
Merge: 24df86a fa06c38
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Tue Mar 31 02:24:30 2020 +0530

    Merge branch 'pybind11_shell' of gitlab.com:dilawar/moose-core into pybind11_shell

commit fa06c38
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Tue Mar 31 02:14:22 2020 +0530

    Id and ObjId are not playing well together...

commit 48832b1
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Tue Mar 31 01:30:34 2020 +0530

    test_synchan is a good example; possible we should return moose.vec
    there.

commit 8667c13
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Tue Mar 31 01:28:02 2020 +0530

    temp commit.

commit 24df86a
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Mon Mar 30 23:39:46 2020 +0530

    Temp commit. Exposing only Id.

commit 448b8b5
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Mon Mar 30 23:14:51 2020 +0530

    more tests are passing...

commit d1b4990
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Mon Mar 30 20:35:39 2020 +0530

    Need to find a solution..

commit 6b5082b
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Mon Mar 30 19:05:44 2020 +0530

    Refactoring and have a working moose.vec API.

commit 98d8d34
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Mon Mar 30 18:05:07 2020 +0530

    [skip ci] needs tweaking in the API.

commit 0f7929c
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Mon Mar 30 14:40:37 2020 +0530

    Support vec. But first need a nap.

commit 93d6e83
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Mon Mar 30 13:33:05 2020 +0530

    refactoring.

commit fd03015
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Mon Mar 30 13:17:31 2020 +0530

    random works.

commit fc34547
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Mon Mar 30 11:49:00 2020 +0530

    Need to polish the API.

commit 6af0f2c
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Mon Mar 30 11:00:03 2020 +0530

    Lets move to DestFinfo.

commit 476d700
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Mon Mar 30 07:53:31 2020 +0530

    Return type.

commit 778208a
Merge: dab5af4 dd65791
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Mon Mar 30 07:42:04 2020 +0530

    Merge branch 'pybind11_shell' of gitlab.com:dilawar/moose-core into pybind11_shell

commit dd65791
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Mon Mar 30 06:54:42 2020 +0530

    Updated [skip ci]

commit 76ec2a1
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sun Mar 29 23:00:02 2020 +0530

    [skip ci] some more changes.

commit c4d7bc6
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sun Mar 29 22:24:57 2020 +0530

    We go both API integrated.

commit f0ac785
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sun Mar 29 21:48:18 2020 +0530

    LookupField is a function.

commit aee928e
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sun Mar 29 21:11:48 2020 +0530

    Do the rest tomorrow.

commit e118e12
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sun Mar 29 20:45:21 2020 +0530

    Retuning binding to std::function which return the Finfo value.

commit dab5af4
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sun Mar 29 18:01:12 2020 +0530

    isA is method. Time to make it a subscriptable dictionary.

commit c7a7b24
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sun Mar 29 15:34:42 2020 +0530

    Lets handle LookupField::set and get.

commit a06e478
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sun Mar 29 01:13:46 2020 +0530

    Deal with it tomorrow.

commit bb1cae5
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sun Mar 29 00:28:22 2020 +0530

    Getting there. [skip ci]

commit 5cccf8b
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Mar 28 22:33:21 2020 +0530

    Some refactoring. Back to same functionality [skip ci].

commit a979de6
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Mar 28 20:46:01 2020 +0530

    Updated a bit more ..

commit b43c617
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Mar 28 19:47:58 2020 +0530

    New API works fantastic.

commit 0deb291
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Mar 28 19:40:19 2020 +0530

    Incremental change. Dynamic attributes.

commit 7f2539c
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Mar 28 19:31:31 2020 +0530

    Subclassing _ObjId now.

commit 0f64cd0
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Mar 28 18:12:57 2020 +0530

    Dynamic attributes are needed now.

commit eff08b2
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Mar 28 16:16:13 2020 +0530

    All test passes. Needs to work on the API now.

commit 8791df7
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Mar 28 15:40:35 2020 +0530

    Blazingly fast.

commit 070f735
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Mar 28 14:06:47 2020 +0530

    Perfect. The base API works now. Not time to do a profiling.

commit 07a1348
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Mar 28 00:28:22 2020 +0530

    This is for tomorow.

commit 72f7b62
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Fri Mar 27 21:43:33 2020 +0530

    Work from home.

commit 4ea29e9
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Fri Mar 27 20:32:19 2020 +0530

    May be later.

commit eff6f90
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Fri Mar 27 17:57:40 2020 +0530

    Not sure about the testKsolve.cpp tests.

commit bef104c
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Fri Mar 27 17:11:34 2020 +0530

    Do testing with master branch.

commit 0078af1
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Fri Mar 27 14:45:40 2020 +0530

    get can not overloaded pretty well. Use different name for getting
    different value. It is verbose now but we can override later.

commit 915e10f
Merge: 911bd03 bf2d609
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Fri Mar 27 13:56:46 2020 +0530

    Merge branch 'pybind11_shell' of gitlab.com:dilawar/moose-core into pybind11_shell

commit bf2d609
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Fri Mar 27 14:11:18 2020 +0530

    add test function.

commit 911bd03
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Fri Mar 27 13:56:12 2020 +0530

    local changes.

commit cc7144f
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Fri Mar 27 13:50:40 2020 +0530

    Move to gulgula.

commit d41e7eb
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Fri Mar 27 04:18:44 2020 +0530

    Allmost there.

commit d913ceb
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Fri Mar 27 01:50:18 2020 +0530

    addMsg -> connect .

commit 8793d33
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Fri Mar 27 01:10:24 2020 +0530

    get/set are on ObjId .

commit d99115c
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Fri Mar 27 00:47:20 2020 +0530

    Ok. Vector and numpy are working.

commit 2f3bc04
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Thu Mar 26 23:02:03 2020 +0530

    move to bebinca for fast compilation.

commit a94fec9
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Thu Mar 26 18:29:50 2020 +0530

    children and parent is not working.

commit 756ec3a
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Wed Mar 25 14:53:17 2020 +0530

    Some more fixes. It will be too much debugging to get it right.

commit 77451f1
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Tue Mar 24 15:07:09 2020 +0530

    All the learning experience is over. Pybind11 is great.

commit 6edda7a
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Tue Mar 24 00:55:13 2020 +0530

    Add a bit more fields.

commit e32c468
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Mon Mar 23 23:30:19 2020 +0530

    I can complete this API tomorrow.

commit 7aaddf7
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Mon Mar 23 22:54:35 2020 +0530

    added more functions [skip ci]

commit 7f1b709
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Mon Mar 23 16:38:34 2020 +0530

    disable build for now on gitlab ci

commit ae2739d
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Mon Mar 23 15:05:22 2020 +0530

    pybind11 module is named _cmoose and it different from _moose.

commit 0c33684
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Mon Mar 23 14:45:32 2020 +0530

    I got wildcardFind to function.

commit 65b307c
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Mon Mar 23 13:33:22 2020 +0530

    Fixed the bug I caused by using smart pointer. I am so silly...

commit fe596e3
Merge: d5d29bb f4070da
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Mon Mar 23 12:45:01 2020 +0530

    Merge branch 'issue_397' of gitlab.com:dilawar/moose-core into pybind11

commit d5d29bb
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sun Mar 22 23:12:58 2020 +0530

    Time to support / in path.

commit 270ea8c
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sun Mar 22 22:50:21 2020 +0530

    empty element()

commit a1eed3a
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sun Mar 22 22:39:55 2020 +0530

    temp commit.

commit a70b5fe
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sun Mar 22 15:44:56 2020 +0530

    Great. Lets try cython as well.

commit 038490f
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sun Mar 22 15:44:27 2020 +0530

    Try cython now.

commit 8bbf900
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sun Mar 22 13:43:02 2020 +0530

    _moose goes to python/moose directory.

commit 014bde2
Merge: 8f60899 ad58dc5
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sun Mar 22 13:18:20 2020 +0530

    Merge branch 'issue_397' into pybind11

commit f4070da
Merge: ad58dc5 5e660e9
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Mar 21 22:21:16 2020 +0530

    Merge branch 'refactoring' into issue_397

commit 5e660e9
Author: dilawars <dilawars@nargis.ncbs.res.in>
Date:   Sat Mar 21 21:24:21 2020 +0530

    include cmath in Pool.cpp as well. Failed compilation with gcc5.3

commit ad58dc5
Author: dilawars <dilawars@nargis.ncbs.res.in>
Date:   Sat Mar 21 21:24:21 2020 +0530

    include cmath in Pool.cpp as well. Failed compilation with gcc5.3

commit c4d55aa
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Mar 21 15:45:16 2020 +0530

    Minor cleanup in macros and loggers.
    numCores now use thread library to determine number of available
    threads.

commit f8dcb12
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Mar 21 15:32:02 2020 +0530

    NUMPY is essential dependency; therefore numpy code is no longer
    included conditionally. USE_NUMPY is implied and have been removed from
    cmake.

commit 9ef658e
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sat Mar 21 15:15:43 2020 +0530

    Fix to #397

commit 8f60899
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Tue Mar 17 18:27:54 2020 +0530

    Perfecto. Create works.

commit aa95a0c
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sun Mar 15 22:10:07 2020 +0530

    pybind11 bindings.

commit da9d1d9
Merge: 0e85a57 36c0026
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sun Mar 15 15:40:06 2020 +0530

    Merge commit '36c0026886c70e39c505f8715e65a7c3cf1e6ade' as 'external/pybind11'

commit 36c0026
Author: Dilawar Singh <dilawars@ncbs.res.in>
Date:   Sun Mar 15 15:40:06 2020 +0530

    Squashed 'external/pybind11/' content from commit 4f72ef846

    git-subtree-dir: external/pybind11
    git-subtree-split: 4f72ef846fe8453596230ac285eeaa0ce3278bb4

* Minor fixes to pybind11.

* Fix #409

When `moose.Function('abc')` is created, set expression to "0".
Expression is not empty by default. This is to mimic the old behaviour.
Note that at this point, derivative is not defined and is `nan` (old
behaviour: derivative is 0.0).

* Ready for a draft PR and initial disucssion.

* Return numpy array instead of vector.

Probably not the most memory efficient way for returning vector<double> but
since most pyMOOSE scripts assume that returned data is numpy array, we
return the numpy array. TODO: benchmarking.

* Fixed: moose.le can caused segfault  when used on moose.vec

This also fixes script mgblock.py BhallaLab/moose-examples#71

* Fixed: moose.le can caused segfault  when used on moose.vec

This also fixes script mgblock.py BhallaLab/moose-examples#71

* removed mkdoc.py from pybind11.

* Fixed a pylint error as well python2/python3 compatibility

* wildcard -> reacSystemPath

Stoic::path is depreacted bcause it collides with Neutral::path.

* Fixed another set.

* Travis fix: Install pytest on OSX as well.

* fix gitlab pipeline

install pytest

* isinstance is replace to isA added to this, validation.py: error msg is sent back, writeKkit.py: while writting genesis file if any object is not written then errorlog is send/printed which is usefull durning command line

* fix test py_run.

Relax the matching to 90% using difflib (from 95%).

* grenerate documentation on the fly.

* Work in progress: __doc__ string from cWork in progress: __doc__ string
from cWork in progress: __doc__ string from cWork in progress:
__doc__ string from c++

* Keeping the C++ type and Python's type name same.

* Cleanup

* pydoc support

moved moose.py content to __init__.py. This way pydoc works great also
fixed travis build.

* moose.doc is working now.

_moose.generateDoc is the underlying function. Needs to cleanup
documentation a bit now.

Fixed regression.

* update to docs

Disabled C++ signature in Python documentations. Added docstring to
__init__.py

* more docstring are added [skip ci]

* Added datetime and other string to version_info.

* All functions have docstring.

* loadmodel docstring is added.

* temp commit.

* showmsg is ported to c++.

* added more docstring and moved some functions to public api.

* Merged hrani changes and mine from new bindings.

removed 'basestring'

* # This is a combination of 2 commits.
# This is the 1st commit message:

python2 support.

Added python2 support as well. It will be easy to remove later.

_moose.element is a good way to convert string/objid/id to melement.

# This is the commit message #2:

writeKkit

* python2 support.

Added python2 support as well. It will be easy to remove later.

_moose.element is a good way to convert string/objid/id to melement.

writeKkit

python2 support.

Added python2 support as well. It will be easy to remove later.

python2 support.

Added python2 support as well. It will be easy to remove later.

_moose.element is a good way to convert string/objid/id to melement.

writeKkit

python2 support.

Added python2 support as well. It will be easy to remove later.

* basestring -> str

* fixes to `pip install`

Added missing folders.

* Fixed pylint error.

* moose.getField accepts two argument instead of 3. Updated rmogul.py
file.

* fix: compiles with clang++

typeid(X) when X is an incomplete type is not supported by C++ standard.
Suprisingly this was compiling fine with gcc but not with clang++.

version is set to 3.2.0.dev$(today)

* travis fixes: OSX

PyRun tests compares last 50 lines rather than whole text. This way we
can ignore lines with different timestamp.

* builds on osx locally.

* tests passes with 3.8 as well.

* On OSX, stream does not flush properly?

Using difflib to test the ratio between got and expected string.

* flush the streams before calling tests...

* Don't run the trvais/osx

Not sure why but only on travis+OSX, pyrun test does not pass. It fails
because whole buffer is not dumped to the tty.

* Fixes to pyrun tests.

* Time to post the API.

* listmsg has been moved to C++.

* docstring to writeNML2

* Fixed typo in docstring. Ready to be reviewed.

* showfield and showfields are both supported.

`moose.showfield` is an alias for `moose.showfields`.

* Added back moose.ce

Co-authored-by: Dilawar Singh <dilawars@ncbs.res.in>
Co-authored-by: HarshaRani <hrani@ncbs.res.in>
Co-authored-by: Anushree Narjala <anushree.narjala@gmail.com>
  • Loading branch information
4 people committed May 1, 2020
1 parent 17e1dd1 commit b4aac15
Show file tree
Hide file tree
Showing 300 changed files with 46,180 additions and 13,999 deletions.
1 change: 1 addition & 0 deletions .ci/travis_prepare_osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ $PYTHON3 -m pip install matplotlib --user --upgrade
$PYTHON3 -m pip install pyNeuroML libNeuroML --user
$PYTHON3 -m pip install scipy --user
$PYTHON3 -m pip install pylint --user
$PYTHON3 -m pip install pytest --user
49 changes: 49 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
AccessModifierOffset: -4
SortIncludes: false
ConstructorInitializerIndentWidth: 4
AlignEscapedNewlinesLeft: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortFunctionsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakTemplateDeclarations: true
AlwaysBreakBeforeMultilineStrings: true
BreakBeforeBinaryOperators: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BinPackParameters: true
ColumnLimit: 80
ConstructorInitializerAllOnOneLineOrOnePerLine: true
DerivePointerBinding: true
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: true
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCSpaceBeforeProtocolList: false
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 60
PenaltyBreakString: 1000
PenaltyBreakFirstLessLess: 120
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerBindsToType: true
SpacesBeforeTrailingComments: 2
Cpp11BracedListStyle: true
Standard: Auto
IndentWidth: 4
TabWidth: 4
UseTab: Never
BreakBeforeBraces: Stroustrup
IndentFunctionDeclarationAfterType: true
SpacesInParentheses: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpaceAfterControlStatementKeyword: false
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 4
Standard : C++11
...

8 changes: 7 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ build:
- python3 -m pip install python-libsbml --user --upgrade
- python3 -m pip install pyneuroml --user --upgrade
- python3 -m pip install sympy scipy --user --upgrade
- python3 -m pip install pytest --user --upgrade
- python3 setup.py build test
- python3 setup.py install --user
- python3 -c "import moose; moose.test()"
- python3 -c "import moose.tests; moose.tests.test()"

except:
- pybind11
- devel

182 changes: 37 additions & 145 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
cmake_minimum_required(VERSION 3.2.3 FATAL_ERROR)

# Project to build MOOSE's python module.
project(PyMOOSE)
Expand All @@ -18,11 +18,7 @@ if(NOT PYTHONINTERP_FOUND)
find_package(PythonInterp 2.7)
endif()

# Disable rpath on OSX.
if(APPLE)
set(CMAKE_MACOSX_RPATH OFF)
endif()

set(CMAKE_MACOSX_RPATH OFF)

# NOTE: version should be changed in setup.py file.
# If moose version is not given, use setup.py file to get the default version.
Expand Down Expand Up @@ -55,19 +51,20 @@ if( CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE )
endif()

################################ CMAKE OPTIONS ##################################
option(WITH_NSDF "Enable NSDF support. Requires hdf5" OFF )

option(DEBUG "Build with debug support" OFF)
option(GPROF "Build for profiling using gprof" OFF)
option(ENABLE_UNIT_TESTS "Enable unit tests (DEBUG should also be ON)" OFF)
option(WITH_MPI "Enable Openmpi support" OFF)

option(WITH_BOOST "Enable boost. Prefer boost over stl" OFF)
option(WITH_BOOST_ODE "Use boost library ode2 library instead of GSL" OFF)
option(WITH_GSL "Use gsl-library. Alternative is WITH_BOOST" ON)
option(PARALLELIZED_CLOCK "High level parallelization of moose::Clock (alpha)" OFF )
option(USE_PRIVATE_RNG "Stochastic Objects use their private RNG" ON)

option(WITH_ASAN "Use AddressSanitizer in DEBUG mode." OFF)

option(WITH_NSDF "Enable NSDF support. Requires hdf5" OFF )

option(WITH_LEGACY_BINDING "Use legacy python-bindings" OFF)

############################ BUILD CONFIGURATION #################################

Expand Down Expand Up @@ -102,10 +99,8 @@ if(WITH_ASAN AND "${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=address")
endif()

if(WITH_GSL)
set(WITH_BOOST OFF)
set(WITH_BOOST_ODE OFF)
elseif(WITH_BOOST)
# Override default GSL solvers when BOOST is enabled.
if(WITH_BOOST OR WITH_BOOST_ODE)
set(WITH_BOOST_ODE ON)
set(WITH_GSL OFF)
endif()
Expand All @@ -114,19 +109,16 @@ endif()

link_directories(${CMAKE_BINARY_DIR})
add_library(libmoose SHARED basecode/main.cpp)
set_target_properties(libmoose PROPERTIES PREFIX "")
add_executable(moose.bin basecode/main.cpp)


################################### SETUP BUILD ################################
# default include paths.
include_directories( ${CMAKE_CURRENT_SOURCE_DIR} )
set_target_properties(libmoose PROPERTIES COMPILE_DEFINITIONS "MOOSE_LIB")
set_target_properties(libmoose PROPERTIES PREFIX "")

## Variable to collect all static libraries.
# Variable to collect all static libraries.
set(STATIC_LIBRARIES "" )
# Collect all shared libraries here.
set(SYSTEM_SHARED_LIBS ${LibXML2_LIBRARIES})
set(SYSTEM_SHARED_LIBS "")

# BOOST ode library performs better than GSL and ideally should be made default.
# Unfortunately Boost does not have a very good matrix library; it has ublas
Expand Down Expand Up @@ -231,7 +223,7 @@ add_subdirectory(device)
add_subdirectory(kinetics)
add_subdirectory(synapse)
add_subdirectory(intfire)
add_subdirectory(external/libsoda)
add_subdirectory(external)

# development related.
add_subdirectory(devel)
Expand Down Expand Up @@ -271,7 +263,7 @@ endif( )
# especially section 'Mac OS X and the RPATH'
# Switching is OFF since all libraries are statically linked in module.
if(APPLE)
set_target_properties( libmoose PROPERTIES MACOSX_RPATH OFF)
set_target_properties(libmoose PROPERTIES MACOSX_RPATH OFF)
endif(APPLE)

# MAC linker does not understand many of gnu-ld options.
Expand Down Expand Up @@ -304,12 +296,16 @@ if( WITH_BOOST )
target_link_libraries( moose.bin ${Boost_LIBRARIES} )
endif( WITH_BOOST )


######################### BUILD PYMOOSE ########################################

if(NOT WITH_LEGACY_BINDING)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/pybind11)
add_subdirectory(pybind11)
else()
message(STATUS "Building legacy python binding.")
add_subdirectory(pymoose)
endif()

# This target is built by pymoose/CMakeLists.txt file.
add_subdirectory(pymoose)

# always override debian default installation directory. It will be installed in
# site-packages instead of dist-packages.
Expand Down Expand Up @@ -338,9 +334,6 @@ endif()
install(TARGETS moose.bin DESTINATION bin CONFIGURATIONS Debug)
install(TARGETS libmoose DESTINATION lib CONFIGURATIONS Debug)

# NOTE: Install macro for _moose (pymoose) has been moved to
# pymoose/CMakeLists.txt file.

# Print message to start build process
if(${CMAKE_BUILD_TOOL} MATCHES "make")
message(
Expand All @@ -353,123 +346,8 @@ endif()


############################ CTEST ######################################
include( CTest )
set(CTEST_NIGHTLY_START_TIME "05:30:00 UTC")
set(CTEST_SUBMIT_URL "http://my.cdash.org/submit.php?project=moose")

if(DEBUG OR "${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
# Run this test in debug mode. In Release mode, this does not do anything.
set(MOOSE_BIN_LOCATION $<TARGET_FILE:moose.bin>)
message(STATUS "Executable moose.bin will be at ${MOOSE_BIN_LOCATION}" )

add_test(NAME moose.bin-raw-run COMMAND moose.bin -u -q)
endif()

# Core tests.
set(PYMOOSE_TEST_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests/py_moose)
file(GLOB PY_TEST_SCRIPTS "${PYMOOSE_TEST_DIRECTORY}/test_*.py" )
foreach(_test_script ${PY_TEST_SCRIPTS} )
get_filename_component(_name_we ${_test_script} NAME_WE)
set(_test_name "core_${_name_we}")
add_test(NAME ${_test_name}
COMMAND ${PYTHON_EXECUTABLE} ${_test_script}
WORKING_DIRECTORY ${PYMOOSE_TEST_DIRECTORY})
set_tests_properties(${_test_name}
PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/python"
)
endforeach()

# Tests for supported formats such as neuroml, sbml etc.
set(SUPPORT_TEST_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests/support)
file(GLOB PY_TEST_SCRIPTS "${SUPPORT_TEST_DIRECTORY}/test_*.py" )
foreach(_test_script ${PY_TEST_SCRIPTS} )
get_filename_component(_name_we ${_test_script} NAME_WE)
set(_test_name "support_${_name_we}")
add_test(NAME ${_test_name}
COMMAND ${PYTHON_EXECUTABLE} ${_test_script}
WORKING_DIRECTORY ${SUPPORT_TEST_DIRECTORY})
set_tests_properties(${_test_name}
PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/python"
)
endforeach()

# rdesigneur tests. These tests require matplotlib.
set(RDES_TEST_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests/py_rdesigneur)
file(GLOB RDES_TEST_SCRIPTS "${RDES_TEST_DIRECTORY}/test_*.py" )
foreach(_test_script ${RDES_TEST_SCRIPTS})
get_filename_component(_name_we ${_test_script} NAME_WE)
set(_test_name "rdes_${_name_we}")
add_test(NAME ${_test_name}
COMMAND ${PYTHON_EXECUTABLE} ${_test_script}
WORKING_DIRECTORY ${RDES_TEST_DIRECTORY}
)
set_tests_properties(${_test_name} PROPERTIES
ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/python;MOOSE_NUM_THREADS=4"
)
endforeach()

# FIXME TESTS. These should not run by default. We need to fix them.
set(PYMOOSE_FIXME_TEST_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/devel/fixme)
file(GLOB PY_FIXME_TEST_SCRIPTS "${PYMOOSE_FIXME_TEST_DIRECTORY}/*.py" )
foreach( _test_script ${PY_FIXME_TEST_SCRIPTS} )
get_filename_component( _name_we ${_test_script} NAME_WE)
set(_test_name "alpha_${_name_we}")
add_test( NAME ${_test_name}
COMMAND ${PYTHON_EXECUTABLE} ${_test_script}
CONFIGURATIONS alpha
WORKING_DIRECTORY ${PYMOOSE_ALPHA_TEST_DIRECTORY}
)
set_tests_properties( ${_test_name}
PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/python"
)
endforeach( )

# Regression and github issues. These should not run by default.
set(PYMOOSE_ISSUES_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/devel/issues)
file(GLOB PY_ISSUES_SCRIPTS "${PYMOOSE_ISSUES_DIRECTORY}/*.py" )
foreach(_test_script ${PY_ISSUES_SCRIPTS})
get_filename_component( _test_name ${_test_script} NAME_WE)
add_test(NAME ${_test_name}
COMMAND ${PYTHON_EXECUTABLE} ${_test_script}
CONFIGURATIONS Devel
WORKING_DIRECTORY ${PYMOOSE_ISSUES_DIRECTORY}
)
set_tests_properties(${_test_name}
PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/python"
)
endforeach()

################################# COVERAGE ###################################

add_custom_target(coverage)
set(PYTEST_TEST_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests)
file(GLOB_RECURSE PYTEST_TEST_SCRIPTS ${PYTEST_TEST_DIRECTORY}/test_*.py)

foreach(_test_script ${PYTEST_TEST_SCRIPTS})
get_filename_component(_name_we ${_test_script} NAME_WE)
set(_test_name "pytest_${_name_we}")
# message(STATUS "Adding test ${_test_name}")
add_custom_target(${_test_name}
# We collect coverage data but do not show report during each test.
# We show report at the end of all tests. Set `--cov-report=`
COMMAND ${PYTHON_EXECUTABLE} -m pytest
--cov=moose --cov=rdesigneur --cov-append --cov-report=
${_test_script}
DEPENDS _moose
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Executing ${_test_script} using pytest"
VERBATIM)
add_dependencies(coverage ${_test_name})
endforeach()

# Generate report at the end.
add_custom_command(TARGET coverage POST_BUILD
COMMAND ${PYTHON_EXECUTABLE} -m coverage report
COMMAND ${PYTHON_EXECUTABLE} -m coverage html
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Genearting coverage report"
VERBATIM)

include(CTest)
add_subdirectory(tests)

########################### RELEASE #########################################
set(PYMOOSE_SDIST_FILE ${CMAKE_BINARY_DIR}/pymoose-${VERSION_MOOSE}.tar.gz)
Expand Down Expand Up @@ -519,3 +397,17 @@ foreach(_py_script ${PY_SCRIPTS})
add_dependencies(pylint ${TGT_NAME} )
endforeach( )

######################## DOCS ###############################################
find_package(Doxygen)
if(DOXYGEN_FOUND)
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/devel/Doxyfile.in)
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
add_custom_target(doc
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation using Doxygen."
VERBATIM)
else()
message(STATUS "Doxygen needs to be installed to generate API docs")
endif()
7 changes: 3 additions & 4 deletions CheckCXXCompiler.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Compiler check.
# Must support c++11
# Must support c++14
# If python2 is supported then we can not use c++17.
if(COMPILER_IS_TESTED)
return()
Expand All @@ -20,12 +20,11 @@ add_definitions(-Wall
)

if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# gcc-4.9.0 has regex supports though moose will compile with 4.8.x;
# <regex> won't work.
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9")
message(FATAL_ERROR "Insufficient gcc version. Minimum requried 4.9")
endif()
add_definitions( -Wno-unused-local-typedefs )
add_definitions( -fmax-errors=5 )
elseif(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"))
add_definitions( -Wno-unused-local-typedef )
endif()
Expand All @@ -50,7 +49,7 @@ if(COMPILER_SUPPORTS_CXX11)
endif(APPLE)
else(COMPILER_SUPPORTS_CXX11)
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} is too old. \n"
"Please use a compiler which has c++11 support."
"Please use a compiler which has full c++11 support."
)
endif(COMPILER_SUPPORTS_CXX11)

Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ recursive-include signeur *
recursive-include synapse *
recursive-include tests *
recursive-include utility *
recursive-include pybind11 *
recursive-include devel *
7 changes: 6 additions & 1 deletion basecode/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
cmake_minimum_required(VERSION 2.8)
include( ${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake )
add_library(basecode
consts.cpp
Element.cpp
DataElement.cpp
GlobalDataElement.cpp
Expand All @@ -26,3 +25,9 @@ add_library(basecode
doubleEq.cpp
testAsync.cpp
)

add_executable(test_globals testGlobals.cpp global.cpp)

enable_testing()
add_test(NAME cpp_test_globals COMMAND $<TARGET_FILE:test_globals>)

0 comments on commit b4aac15

Please sign in to comment.