Skip to content

Commit

Permalink
Add a bit more fields.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dilawar Singh committed Mar 23, 2020
1 parent e32c468 commit 6edda7a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pybind11/pymoose.cpp
Expand Up @@ -24,6 +24,7 @@
#include "../external/pybind11/include/pybind11/stl.h"

#include "../basecode/header.h"
#include "../basecode/global.h"
#include "../basecode/Cinfo.h"

#include "../shell/Shell.h"
Expand Down Expand Up @@ -89,8 +90,25 @@ PYBIND11_MODULE(_cmoose, m)
.def("findFinfo", &Cinfo::findFinfoWrapper);

m.def("create", &createIdFromPath);

m.def("move", [](Id o, ObjId oid){ getShellPtr()->doMove(o, oid); });
m.def("copy", [](Id o, ObjId newP, string newName="", size_t n=1, bool toGlobal=false, bool copyExtMsg=false){
if(newName.empty())
newName = o.element()->getName();
getShellPtr()->doCopy(o, newP, newName, n, toGlobal, copyExtMsg);
});

m.def("setCwe", [](Id id) { getShellPtr()->setCwe(id); });
m.def("getCwe", []() { return getShellPtr()->getCwe(); });
m.def("delete", [](ObjId oid) { return getShellPtr()->doDelete(oid);});
m.def("reinit", []() { return getShellPtr()->doReinit();});
m.def("stop", []() { return getShellPtr()->doStop();});

m.def("seed", [](int seed) { return moose::setGlobalSeed(seed);});

m.def("start", [](double runtime, bool notify=false) {
getShellPtr()->doStart(runtime, notify);
});

m.def("getCinfo", [](const string& name) { return Cinfo::find(name); },
py::return_value_policy::reference);
Expand Down
1 change: 1 addition & 0 deletions python/moose/__init__.py
Expand Up @@ -84,6 +84,7 @@ def wildcardFind(pattern):
paths.append(__toMooseObject(p))
return paths

from moose._cmoose import *

# Bring everything from moose.py to global namespace.
# IMP: It will overwrite any c++ function with the same name. We can override
Expand Down

0 comments on commit 6edda7a

Please sign in to comment.