Anders Logg wrote:
> On Tue, Dec 16, 2008 at 02:19:38PM +0000, Garth N. Wells wrote:
>>
>> 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
> 
> I don't think that's a problem here. The interpolation will be into
> the appropriate function space, which for a DG function is a DG space,
> so for DG0, the vector will contain one value for each cell.
>

DG(k), k > 0 is the problem.

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