Skip to content

Commit 6edda7a

Browse files
author
Dilawar Singh
committed
Add a bit more fields.
1 parent e32c468 commit 6edda7a

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

pybind11/pymoose.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "../external/pybind11/include/pybind11/stl.h"
2525

2626
#include "../basecode/header.h"
27+
#include "../basecode/global.h"
2728
#include "../basecode/Cinfo.h"
2829

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

9192
m.def("create", &createIdFromPath);
93+
94+
m.def("move", [](Id o, ObjId oid){ getShellPtr()->doMove(o, oid); });
95+
m.def("copy", [](Id o, ObjId newP, string newName="", size_t n=1, bool toGlobal=false, bool copyExtMsg=false){
96+
if(newName.empty())
97+
newName = o.element()->getName();
98+
getShellPtr()->doCopy(o, newP, newName, n, toGlobal, copyExtMsg);
99+
});
100+
92101
m.def("setCwe", [](Id id) { getShellPtr()->setCwe(id); });
93102
m.def("getCwe", []() { return getShellPtr()->getCwe(); });
103+
m.def("delete", [](ObjId oid) { return getShellPtr()->doDelete(oid);});
104+
m.def("reinit", []() { return getShellPtr()->doReinit();});
105+
m.def("stop", []() { return getShellPtr()->doStop();});
106+
107+
m.def("seed", [](int seed) { return moose::setGlobalSeed(seed);});
108+
109+
m.def("start", [](double runtime, bool notify=false) {
110+
getShellPtr()->doStart(runtime, notify);
111+
});
94112

95113
m.def("getCinfo", [](const string& name) { return Cinfo::find(name); },
96114
py::return_value_policy::reference);

python/moose/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ def wildcardFind(pattern):
8484
paths.append(__toMooseObject(p))
8585
return paths
8686

87+
from moose._cmoose import *
8788

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

0 commit comments

Comments
 (0)