Mercurial > fem-fenics-eugenio
changeset 30:eaf8a1e8f377
The eval method now use a for cycle for the initialization of octave_value_list
author | gedeone-octave <marco.vassallo@outlook.com> |
---|---|
date | Mon, 15 Jul 2013 17:02:28 +0200 |
parents | 798ff8c0041d |
children | 74cbe97f55af |
files | src/expression.h |
diffstat | 1 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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<double>& values, const dolfin::Array<double>& 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; };