@@ -29,23 +29,24 @@ __Finfo__::__Finfo__(const ObjId& oid, const Finfo* f, const string& finfoType)
2929{
3030 // cout << " __Finfo__ type " << finfoType << endl;
3131
32- if (finfoType == " DestFinfo" )
32+ if (finfoType == " DestFinfo" )
3333 func_ = [oid, f, this ](const py::object& key) {
3434 return getLookupValueFinfoItem (oid, f, key);
3535 };
36- else if (finfoType == " FieldElementFinfo" )
36+ else if (finfoType == " FieldElementFinfo" )
3737 func_ = [oid, f, this ](const py::object& index) {
3838 // this is essential of make this function static.
3939 return getElementFinfoItem (oid, f, py::cast<unsigned int >(index));
4040 };
41- else if (finfoType == " LookupValueFinfo" )
41+ else if (finfoType == " LookupValueFinfo" )
4242 func_ = [oid, f, this ](const py::object& key) {
4343 // Assigning is essential or make these functions static.
4444 return this ->getLookupValueFinfoItem (oid, f, key);
4545 };
4646 else
4747 func_ = [this ](const py::object& key) {
48- throw runtime_error (" Not supported for Finfo type '" +finfoType_+" '" );
48+ throw runtime_error (" Not supported for Finfo type '" + finfoType_ +
49+ " '" );
4950 return py::none ();
5051 };
5152}
@@ -84,7 +85,8 @@ bool __Finfo__::setLookupValueFinfoItem(const ObjId& oid, const py::object& key,
8485 return true ;
8586}
8687
87- py::object __Finfo__::getLookupValueFinfoItem (const ObjId& oid, const Finfo* f, const py::object& key)
88+ py::object __Finfo__::getLookupValueFinfoItem (const ObjId& oid, const Finfo* f,
89+ const py::object& key)
8890{
8991 auto rttType = f->rttiType ();
9092 auto fname = f->name ();
@@ -130,8 +132,7 @@ py::cpp_function __Finfo__::getDestFinfoSetterFunc(const ObjId& oid,
130132 vector<string> types;
131133 moose::tokenize (rttType, " ," , types);
132134
133- if (types.size () == 1 )
134- return getDestFinfoSetterFunc1 (oid, finfo, types[0 ]);
135+ if (types.size () == 1 ) return getDestFinfoSetterFunc1 (oid, finfo, types[0 ]);
135136
136137 assert (types.size () == 2 );
137138 return getDestFinfoSetterFunc2 (oid, finfo, types[0 ], types[1 ]);
@@ -147,11 +148,18 @@ py::cpp_function __Finfo__::getDestFinfoSetterFunc2(const ObjId& oid,
147148 if (ftype1 == " double" ) {
148149 if (ftype2 == " unsigned int" ) {
149150 std::function<bool (double , unsigned int )> func = [oid, fname](
150- const double a, const long b) {
151+ const double a, const unsigned int b) {
151152 return SetGet2<double , unsigned int >::set (oid, fname, a, b);
152153 };
153154 return func;
154155 }
156+ if (ftype2 == " long" ) {
157+ std::function<bool (double , long )> func = [oid, fname](
158+ const double a, const long b) {
159+ return SetGet2<double , long >::set (oid, fname, a, b);
160+ };
161+ return func;
162+ }
155163 }
156164 throw runtime_error (" getFieldPropertyDestFinfo2::NotImplemented " + fname +
157165 " for rttType " + finfo->rttiType () + " for oid " +
@@ -251,10 +259,11 @@ py::list __Finfo__::getElementFinfo(const ObjId& objid, const Finfo* f)
251259 return py::cast (res);
252260}
253261
254- py::object __Finfo__::getElementFinfoItem (const ObjId& oid, const Finfo* f, unsigned int index)
262+ py::object __Finfo__::getElementFinfoItem (const ObjId& oid, const Finfo* f,
263+ unsigned int index)
255264{
256265 // cout << "Fetching at index " << index << " " << getNumField() << endl ;
257- if (index >= getNumFieldStatic (oid, f)) {
266+ if (index >= getNumFieldStatic (oid, f)) {
258267 throw py::index_error (" Index " + to_string (index) + " out of range." );
259268 }
260269 auto o = ObjId (oid.path () + ' /' + f->name ());
@@ -268,18 +277,17 @@ string __Finfo__::type() const
268277
269278// py::object __Finfo__::getAttr(const string& key)
270279// {
271- // std::cout << "Accessing " << key << std::endl;
280+ // std::cout << "Accessing " << key << std::endl;
272281// }
273282
274- unsigned int __Finfo__::getNumField ()
283+ unsigned int __Finfo__::getNumField ()
275284{
276285 return __Finfo__::getNumFieldStatic (oid_, f_);
277286}
278287
279- unsigned int __Finfo__::getNumFieldStatic (const ObjId& oid, const Finfo* f)
288+ unsigned int __Finfo__::getNumFieldStatic (const ObjId& oid, const Finfo* f)
280289{
281290 auto o = ObjId (oid.path () + ' /' + f->name ());
282291 return Field<unsigned int >::get (o, " numField" );
283292}
284293
285-
0 commit comments