← Back to team overview

dolfin team mailing list archive

Re: from userdefined function to Vector

 



Vuk.Milisic@xxxxxxx wrote:
What is the c++ code to convert the result of interpolation
on a discrete vector ?


Try projecting onto the finite element space. Perhaps it's not very efficient for continuous Lagrange elements, but it does generalise to any finite element basis.

Garth

  class IdentityDef : public Function
   {
   public:

     IdentityDef(Mesh& mesh) : Function(mesh) {

     }

     void eval(real* values, const real* x) const
     {
       values[0] = x[0];
       values[1] = x[1];
       values[2] = 0;
       values[3] = 0;
     }

   };

   IdentityDef phi(mesh);
  uBlasVector phiv(phi.vector().size());
   phiv=phi.vector();


the compilation is ok but
it fails to run cause the .vector() function
works only on discrete function,

I tried also to heritate DiscreteFunction on IdentityDef
that doesn't work the same. Sorry I'm used to freefem++
where these distinction between variable does not exist.





References