← Back to team overview

dolfin team mailing list archive

Re: Behaviour of Function::vector() on instance of Function subclass

 

On Tue, Dec 16, 2008 at 02:20:22PM +0100, Martin Sandve Alnæs wrote:
> If I subclass Function and implement eval, then
> call vector() on an object of my class, a vector
> is created but initialized to zero. I would rather
> expect that the function is evaluated in the function space:
> 
> GenericVector& Function::vector()
>  {
>    // Initialize vector of dofs if not initialized
>    if (!_vector)
> +  {
>      init();
> +    interpolate(*_vector, *_function_space);
> +  }
> 
>    dolfin_assert(_vector);
>    return *_vector;
> }

Looks like a good idea. Can you add it?

> But I'm not sure what kind of side effects this can have on other code?
> 
> Martin

I don't think it will have more side effects than what we have now
when we just create a zero vector.

-- 
Anders

Attachment: signature.asc
Description: Digital signature


Follow ups

References