← Back to team overview

dolfin team mailing list archive

recompute& evaluate a function/vector

 

hi all

i'm stuck on the following problem:

i'd like to compute a term as

eta = (gamma)^(-2/3), or general eta = gamma^(n) and n is real


in my code, gamma is dependent on a velocity function from a previous interation, so gamma = gamma(u0), and how to compute gamma stems from a form-file, so i do:

_M_gamma = new gammaFunctional(u0);

Function  f_gamma(&mesh, *M_gamma, 0);


my question is now

how can i create the other function f_eta = f_gamma^(2/3) in a nice way?

what i thought about is to create a derived function class Eta where overload the evaluation function in a way as

double eval(const double* x) const
{
  return (gamma.eval(x)*gamma.eval(x))^(-1/3)
}

please tell me if this is a possible approach, or else advise me how to handle this :-)


thanks a lot for the support,

patrick

(btw i do this together with dolfin-grade2 so i use dolfin0.8.1 )



Follow ups