← Back to team overview

dolfin team mailing list archive

[Bug 778622] [NEW] Lacking check of input for function evaluation

 

Public bug reported:

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

** Affects: dolfin
     Importance: Undecided
         Status: New

-- 
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:
  New

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



Follow ups

References