File tree Expand file tree Collapse file tree 4 files changed +16
-1
lines changed Expand file tree Collapse file tree 4 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -285,9 +285,20 @@ unsigned int __Finfo__::getNumField()
285
285
return __Finfo__::getNumFieldStatic (oid_, f_);
286
286
}
287
287
288
+ bool __Finfo__::setNumField (unsigned int num)
289
+ {
290
+ return __Finfo__::setNumFieldStatic (oid_, f_, num);
291
+ }
292
+
288
293
unsigned int __Finfo__::getNumFieldStatic (const ObjId& oid, const Finfo* f)
289
294
{
290
295
auto o = ObjId (oid.path () + ' /' + f->name ());
291
296
return Field<unsigned int >::get (o, " numField" );
292
297
}
293
298
299
+ bool __Finfo__::setNumFieldStatic (const ObjId& oid, const Finfo* f,
300
+ unsigned int num)
301
+ {
302
+ auto o = ObjId (oid.path () + ' /' + f->name ());
303
+ return Field<unsigned int >::set (o, " numField" , num);
304
+ }
Original file line number Diff line number Diff line change @@ -58,8 +58,11 @@ class __Finfo__ {
58
58
59
59
// Get attribute (python api);
60
60
unsigned int getNumField ();
61
+ bool setNumField (unsigned int );
61
62
62
63
static unsigned int getNumFieldStatic (const ObjId& oid, const Finfo* f);
64
+ static bool setNumFieldStatic (const ObjId& oid, const Finfo* f,
65
+ unsigned int i);
63
66
64
67
// Exposed to python as __setitem__
65
68
bool setItem (const py::object& key, const py::object& val);
Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ PYBIND11_MODULE(_cmoose, m)
149
149
py::class_<__Finfo__>(m, " _Finfo" , py::dynamic_attr ())
150
150
.def (py::init<const ObjId &, const Finfo *, const char *>())
151
151
.def_property_readonly (" type" , &__Finfo__::type)
152
- .def_property_readonly (" num" , &__Finfo__::getNumField) // Only for FieldElementFinfos
152
+ .def_property (" num" , &__Finfo__::getNumField, &__Finfo__::setNumField ) // Only for FieldElementFinfos
153
153
.def (" __call__" , &__Finfo__::operator ())
154
154
.def (" __call__" , &__Finfo__::operator ())
155
155
.def (" __getitem__" , &__Finfo__::getItem)
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ def test_var_order():
29
29
dt = 1.0
30
30
# fn0 = moose.Function('/fn0')
31
31
fn1 = moose .Function ('/fn1' )
32
+ print (fn1 .x .num )
32
33
fn1 .x .num = 2
33
34
fn1 .expr = 'y1+y0+x1+x0'
34
35
fn1 .mode = 1
You can’t perform that action at this time.
0 commit comments