← Back to team overview

dolfin team mailing list archive

Using errornorm() in C++

 

This is the .ufl file that I wrote so that I could evaluate an error norm in my main():


element = FiniteElement("Lagrange", triangle, 1)

v = TestFunction(element)
u = TrialFunction(element)
f = Function(element)

a = inner(grad(v), grad(u))*dx
L = v*f*dx

uh = Function(element)
u   = Function(element)
e   = uh - u

errorSqr = dot(e, e)*dx


It compiles, but that doesn't mean its right. I am only interested in the L2 norm at the moment.

Assuming this does what I think it does, how do I access this code from my main. I included ENorm.h and I can do regular VariationalProblem solutions using this .h file. I tried doing ENorm::e, ENorm::errorSqr, L.e, L.errorSqr. I am obviously missing something basic here. 

I was thinking of doing Function.vector() and directly manupulating the GenericVectors in my main() but then I realised that I probably can't use dot() inside main()

Thanks for your help, with this and previously,

Phil

Follow ups