Anders Logg wrote:
> On Sat, Oct 17, 2009 at 01:54:57PM +0100, Garth N. Wells wrote:
>>
>> Johan Hake wrote:
>>> On Saturday 17 October 2009 12:32:54 Garth N. Wells wrote:
>>>> Will
>>>>
>>>>      uh = U[1]
>>>>
>>>> return a deep or shallow copy of the sub-Function?
>>> To avoid confusion with the ufl interface we have limited the interface for
>>> SubFunctions in PyDOLFIN to split. split returns a shallow copy by default.
>>> pass True to split and it will return a deepcopy. In your case it would be:
>>>
>>>   uh = U.split()[0]
>>>
>>> and
>>>
>>>   uh = U.split(True)[0]
>>>
>>> operator[] is used when you define forms. We have not yet managed to merge 
>>> the
>>> two operations into one.
>>>
>> OK. Do we still have the function 'sub'?
>>
>>
>>>> Where is the operator [] define for sub-Functions?
>>> The operator you are using is the ufl one, which is defined in
>>> ufl.exproperators.py.
>>>
>> OK, but it's not clear to me then what's happing with this extract of my
>> code:
>>
>>   problem = VariationalProblem(a, L, bcs)
>>   Uh = problem.solve()
>>
>>   u = Expression("epx(x[0])", V = Vexact)
>>
>>   uh = Uh[1]
>>   M = (uh-u)*(uh-u)*dx
>>   error = sqrt(assemble(M, mesh=mesh))
> 
> This should work fine since uh will be a component of the coefficient
> Uh in the UFL form.
> 
> Same as when you write say inner(v, u)*dx or anything else that
> accesses components.
> 
> So in summary [] can be used for any purpose in forms. It can also be
> used for plotting, but extracting the vector etc will not work.
> 

It works as expected, but what's going on behind the scenes? Who is 
creating the dof map and is the vector being copied?

Garth

> --
> Anders
> 
> 
>> Garth
>>
>>
>>> Johan
>>
>> _______________________________________________
>> DOLFIN-dev mailing list
>> DOLFIN-dev@fenics.org
>> http://www.fenics.org/mailman/listinfo/dolfin-dev
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> DOLFIN-dev mailing list
>> DOLFIN-dev@fenics.org
>> http://www.fenics.org/mailman/listinfo/dolfin-dev


_______________________________________________
DOLFIN-dev mailing list
DOLFIN-dev@fenics.org
http://www.fenics.org/mailman/listinfo/dolfin-dev

Reply via email to