# HG changeset patch # User gedeone-octave # Date 1373900548 -7200 # Node ID eaf8a1e8f377033f99da4fe39b490334a3ff558c # Parent 798ff8c0041d3f76dea0ec781d1cf9ff3a6e38ce The eval method now use a for cycle for the initialization of octave_value_list diff -r 798ff8c0041d -r eaf8a1e8f377 src/expression.h --- a/src/expression.h Mon Jul 15 17:00:16 2013 +0200 +++ b/src/expression.h Mon Jul 15 17:02:28 2013 +0200 @@ -30,23 +30,25 @@ { public: + expression() : dolfin::Expression() {} + expression (octave_fcn_handle & _f) : dolfin::Expression (), f (new octave_fcn_handle (_f)) {} ~expression (void) { delete f; } + void eval (dolfin::Array& values, const dolfin::Array& xy) const { - double x = xy[0]; - double y = xy[1]; octave_value_list b; - b.resize (2); - b(0) = x; - b(1) = y; + b.resize (xy.size ()); + for (int i = 0; i < xy.size (); ++i) + b(i) = xy[i]; octave_value_list res = feval (f->function_value (), b); values[0] = res(0).double_value (); } + private: octave_fcn_handle * f; };