← Back to team overview

dolfin team mailing list archive

[Bug 778622] Re: Lacking check of input for function evaluation

 

This has definitely been part of the interface from the beginning. I
think the sharing of __call__ code between Function and Expression,
together with the move of removing the Element from an Expression, made
these checks disappear.

I can take a look at it if you have not already done it. I goes one way
is to split the __call__ logic into two distinct methods for each class.

Johan

** Changed in: dolfin
       Status: New => Confirmed

-- 
You received this bug notification because you are a member of DOLFIN
Team, which is subscribed to DOLFIN.
https://bugs.launchpad.net/bugs/778622

Title:
  Lacking check of input for function evaluation

Status in DOLFIN:
  Confirmed

Bug description:
  When calling f(...) on a Function f, the input arguments seem poorly
  checked. This is error-prone. It would be good to check that the
  coordinates input match the geometrical dimension of the mesh

  Example:

  from dolfin import *

  mesh = UnitSquare(4, 4)
  V = FunctionSpace(mesh, "CG", 1)
  f = Function(V)
  for i in range(len(f.vector())):
      f.vector()[i] = i + 1

  print f(1.0)
  print f(1.0, 1.0)
  print f(1.0, 1.0, 1.0)
  print f(1.0, 1.0, 1.0, 1.0)
  print
  print f((1.0,))
  print f((1.0, 1.0))
  print f((1.0, 1.0, 1.0))



References