Skip to content

Commit fd03015

Browse files
author
Dilawar Singh
committed
random works.
1 parent fc34547 commit fd03015

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

pybind11/pymoose.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,15 @@
3737
#include "../shell/Shell.h"
3838
#include "../shell/Wildcard.h"
3939
#include "../utility/strutil.h"
40+
41+
#include "../basecode/global.h"
42+
4043
#include "helper.h"
4144
#include "pymoose.h"
4245

4346
using namespace std;
4447
namespace py = pybind11;
48+
using namespace pybind11::literals;
4549

4650
Id initModule(py::module& m)
4751
{
@@ -343,31 +347,30 @@ PYBIND11_MODULE(_cmoose, m)
343347
.def("setClock", &Shell::doSetClock)
344348
.def("reinit", &Shell::doReinit)
345349
.def("delete", &Shell::doDelete)
346-
.def("start", &Shell::doStart, py::arg("runtime"),
347-
py::arg("notify") = false)
350+
.def("start", &Shell::doStart, "runtime"_a, "notify"_a = false)
348351
.def("quit", &Shell::doQuit);
349352

350353
// Module functions.
351354
m.def("getShell",
352355
[]() { return reinterpret_cast<Shell*>(Id().eref().data()); },
353356
py::return_value_policy::reference);
354357

358+
m.def("seed", [](size_t a){ moose::mtseed(a);});
359+
m.def("rand", [](double a, double b){ return moose::mtrand(a, b);}, "a"_a=0, "b"_a=1);
355360
m.def("wildcardFind", &wildcardFind2);
356361
m.def("delete", &mooseDelete);
357362
m.def("create", &mooseCreate);
358363
m.def("reinit", &mooseReinit);
359-
m.def("start", &mooseStart, py::arg("runtime"), py::arg("notify") = false);
364+
m.def("start", &mooseStart, "runtime"_a, "notify"_a = false);
360365
m.def("element", &mooseElement);
361366
m.def("exists", &doesExist);
362367
m.def("connect", &mooseConnect);
363368
m.def("getCwe", &mooseGetCwe);
364369
m.def("setClock", &mooseSetClock);
365370
m.def("loadModelInternal", &loadModelInternal);
366-
m.def("getFieldDict", &mooseGetFieldDict, py::arg("className"),
367-
py::arg("finfoType") = "");
368-
m.def("copy", &mooseCopy, py::arg("orig"), py::arg("newParent"),
369-
py::arg("newName"), py::arg("num") = 1, py::arg("toGlobal") = false,
370-
py::arg("copyExtMsgs") = false);
371+
m.def("getFieldDict", &mooseGetFieldDict, "className"_a, "finfoType"_a = "");
372+
m.def("copy", &mooseCopy, "orig"_a, "newParent"_a, "newName"_a
373+
, "num"_a = 1, "toGlobal"_a = false, "copyExtMsgs"_a = false);
371374
// Attributes.
372375
m.attr("NA") = NA;
373376
m.attr("PI") = PI;

0 commit comments

Comments
 (0)