Anders Logg wrote:
> 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.
>

Interpolate is tricky because not all functions (e.g. DG) are 
interpolated sensibly. This issue pops up in the VTK io.

Garth

> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> DOLFIN-dev mailing list
> [email protected]
> http://www.fenics.org/mailman/listinfo/dolfin-dev


_______________________________________________
DOLFIN-dev mailing list
[email protected]
http://www.fenics.org/mailman/listinfo/dolfin-dev

Reply via email to