← Back to team overview

dolfin team mailing list archive

Re: Python sun functions

 



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))

Garth


Johan




Follow ups

References