Update your repo and try! The ufc::cell version of evaluate_basis_all is not usable in Python. You need a dolfin::Cell version, which I just added ;)
We should probably ignore all the ufc::cell versions, and add unit test for the one we do expose... Johan On Wednesday April 20 2011 15:55:30 Neilen Marais wrote: > Hi, > > I'm trying to access the elemental basis functions directly through > dolfin in python. I think I've managed it, but for some reason I can't > get evaluate_basis_all() to work. In the code below the commented > for-loop calling evaluate_basis() works fine, but the > evaluate_basis_all() form doesn't work. As far as I can tell the only > difference between the two calls should be the shape of the value > array and omission of the basis function number from > evaluate_basis_all()'s signature. What am I doing wrong here? > > Thanks > Neilen > > from __future__ import division > > import numpy as N > import dolfin as dol > from dolfin import Point, PointSource > > # Define mesh > mesh = dol.UnitCube(1,1,1) > # Define function space > order = 1 > V = dol.FunctionSpace(mesh, "Nedelec 1st kind H(curl)", order) > > # Define basis and bilinear form > u = dol.TrialFunction(V) > v = dol.TestFunction(V) > source_coords = N.array([1/1.5, 1/1.5, 1/2], dtype='d') > source_pt = Point(*source_coords) > > cell_index = 0 > c = dol.Cell(mesh, cell_index) > # Check that the source point is in this element > assert(c.intersects_exactly(source_pt)) > > finite_element = V.element() > no_basis_fns = finite_element.space_dimension() > # Vector valued elements have rank of 1 > assert(finite_element.value_rank() == 1) > # Vector valued elements have only one rank (i.e. 0) along which > # dimensions are defined. This is the dimension that the basis > # function value vector is. Since we have 3D Nedelec elements here > # this should be 3 > bf_value_dimension = finite_element.value_dimension(0) > el_basis_vals = N.zeros((no_basis_fns, bf_value_dimension), dtype='d') > > ## calling evaluate_basis() in loop below works > # for i in range(no_basis_fns): > # finite_element.evaluate_basis(i, el_basis_vals[i,:], source_coords, > c) finite_element.evaluate_basis_all(el_basis_vals, source_coords, c) > > Running this gives me the following error: > > /tmp/python-1810o1R.py in <module>() > 32 bf_value_dimension = finite_element.value_dimension(0) > 33 el_basis_vals = N.zeros((no_basis_fns, bf_value_dimension), > dtype='d') 34 # for i in range(no_basis_fns): > > 35 # finite_element.evaluate_basis(i, el_basis_vals[i,:], > source_coords, c) > > ---> 36 finite_element.evaluate_basis_all(el_basis_vals, source_coords, c) > > TypeError: in method 'FiniteElement_evaluate_basis_all', argument 4 of > type 'ufc::cell const &' > > _______________________________________________ > Mailing list: https://launchpad.net/~dolfin > Post to : [email protected] > Unsubscribe : https://launchpad.net/~dolfin > More help : https://help.launchpad.net/ListHelp _______________________________________________ Mailing list: https://launchpad.net/~dolfin Post to : [email protected] Unsubscribe : https://launchpad.net/~dolfin More help : https://help.launchpad.net/ListHelp

