Skip to content

Commit 1abb6f1

Browse files
author
Dilawar Singh
committed
Merge branch 'pybind11_shell' of gitlab.com:dilawar/moose-core into pybind11_shell
2 parents 24df86a + fa06c38 commit 1abb6f1

File tree

6 files changed

+13
-6
lines changed

6 files changed

+13
-6
lines changed

pybind11/helper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ bool mooseDelete(const string& path)
230230
return getShellPtr()->doDelete(ObjId(path));
231231
}
232232

233-
ObjId mooseCreate(const string type, const string& path, size_t numdata)
233+
Id mooseCreate(const string type, const string& path, size_t numdata)
234234
{
235235
auto p = moose::splitPath(path);
236236
return getShellPtr()->doCreate2(type, ObjId(p.first), p.second, numdata);

pybind11/helper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ ObjId mooseConnect(const ObjId& src, const string& srcField, const ObjId& tgt,
4747
bool mooseDelete(const ObjId& oid);
4848
bool mooseDelete(const string& path);
4949

50-
ObjId mooseCreate(const string type, const string& path, size_t numdata = 1);
50+
Id mooseCreate(const string type, const string& path, size_t numdata = 1);
5151

5252
Id mooseCopy(const Id& orig, ObjId newParent, string newName,
5353
unsigned int n, bool toGlobal, bool copyExtMsgs);

pybind11/pymoose.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ PYBIND11_MODULE(_cmoose, m)
9191
.def("__repr__", [](const Id& id) {
9292
return "<Id id=" + std::to_string(id.value()) + " path=" +
9393
id.path() + " class=" + id.element()->cinfo()->name() + ">";
94-
});
94+
});
9595

9696
py::class_<ObjId>(m, "_ObjId")
9797
.def(py::init<>())
@@ -138,6 +138,7 @@ PYBIND11_MODULE(_cmoose, m)
138138
.def("__setattr__", &setProperty<vector<double>>)
139139
.def("__setattr__", &setProperty<std::string>)
140140
.def("__setattr__", &setProperty<ObjId>)
141+
.def("__setattr__", &setProperty<Id>)
141142
.def("__setattr__", &setProperty<bool>)
142143

143144
//---------------------------------------------------------------------

pybind11/pymoose.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@
1717
#ifndef PYMOOSE_H
1818
#define PYMOOSE_H
1919

20+
#include "../external/prettyprint.hpp"
21+
2022
template <typename T = double>
21-
void setProperty(const ObjId& id, const string& fname, T val)
23+
bool setProperty(const ObjId& id, const string& fname, T val)
2224
{
23-
Field<T>::set(id, fname, val);
25+
// MOOSE_DEBUG( "Setting " << fname << " on " << id.path() << " with value " << val);
26+
return Field<T>::set(id, fname, val);
2427
}
2528

2629
template <typename T = double>

tests/py_moose/test_Xreacs2.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ def test_xreac2():
2828
ks1 = moose.Ksolve( '/model/kinetics/ksolve' )
2929
ds1 = moose.Dsolve( '/model/kinetics/dsolve' )
3030
s1 = moose.Stoich( '/model/kinetics/stoich' )
31+
print('xx', s1, type(s1), ks1)
3132
s1.compartment = moose.element( '/model/kinetics' )
3233
s1.ksolve = ks1
34+
print('yyy', s1.ksolve)
3335
s1.dsolve = ds1
3436
s1.path = '/model/kinetics/##'
3537

tests/py_moose/test_synchan.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ def make_synapse(path):
2424
# IN new implementation, there is SimpleSynHandler class which takes cares
2525
# of multiple synapses. Class SynChan does not have any .synapse field.
2626
synH = moose.SimpleSynHandler( '%s/SynHandler' % path)
27-
synH.synapse.num = 1
27+
print(synH)
28+
#synH.synapse.num = 1
2829
## syn.bufferTime = 1.0 # ms
2930
synH.synapse.delay = 1.0
3031
synH.synapse.weight = 1.0

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy