← Back to team overview

dolfin team mailing list archive

Re: [Question #129296]: defining a discrete function

 

Andi!

You can just access the vector directly and fill it with what ever values you 
want:
 
  FunctionSpace V(mesh);
  Function f(V);
  Vector& v = V.vector();
  
  for (int i; i<v.size(); i++)
    v[i] = somevalue(i);

Johan

On Wednesday October 13 2010 11:18:48 andi wrote:
> New question #129296 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/129296
> 
> Hello, I would like to ask how someone can define a discrete function using
> a vector  which contains the values of the function at the nodes. The demo
> 'advection-diffusion' shows how the values at the nodes can be read  from
> an .xml file, but I couldn't find any relevant example on how you can
> define in C++ a vector containing these values. I would be grateful if
> anyone can suggest a solution.
> 
> Andi



Follow ups

References