evaluate_basis_derivatives in python

Asked by Roberto Alessi

I cannot figure out how to use evaluate_basis_derivatives in python.
In particular I have understood that now there is available a typemap for ufc-cell in order to use directly a dolfin-cell in functions requiring a ufc-cell but running the following python code:

import numpy as np
from dolfin import *

mesh = Rectangle(0,0,1,1,1,1,"crossed")
V = VectorFunctionSpace(mesh, "CG", 1,2)
v = Function(V)
v_element= V.element()
geo_dim = mesh.geometry().dim()
num_ip = V.split()[0].element().space_dimension()
cell_derivatives = np.zeros(geo_dim, dtype = "d")
ip_coordinates = np.array([[0 for i in range(geo_dim)] for i in range(num_ip)], dtype = "d")

element_cells = []
for cel in cells(mesh):
    element_cells.append(cel)

v_element.evaluate_basis_derivatives(0, 1, cell_derivatives, ip_coordinates[0,:], element_cells[0])

leads to the following RuntimeError:
RuntimeError: // Function evaluate_basis_derivatives not generated (compiled with -fno-evaluate_basis_derivatives)

Maybe I have to change the ufc compile options? But how in/from python? Will it then work?

Thanks a lot in advance,
Sincerly

Roberto Alessi

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Anders Logg
Solved:
Last query:
Last reply:
Revision history for this message
Best Anders Logg (logg) said :
#1

Try adding this at the beginning of your code:

parameters["form_compiler"]["no-evaluate_basis_derivatives"] = False

--
Anders

On Mon, Nov 28, 2011 at 12:15:43PM -0000, Roberto Alessi wrote:
> New question #180258 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/180258
>
> I cannot figure out how to use evaluate_basis_derivatives in python.
> In particular I have understood that now there is available a typemap for ufc-cell in order to use directly a dolfin-cell in functions requiring a ufc-cell but running the following python code:
>
> import numpy as np
> from dolfin import *
>
> mesh = Rectangle(0,0,1,1,1,1,"crossed")
> V = VectorFunctionSpace(mesh, "CG", 1,2)
> v = Function(V)
> v_element= V.element()
> geo_dim = mesh.geometry().dim()
> num_ip = V.split()[0].element().space_dimension()
> cell_derivatives = np.zeros(geo_dim, dtype = "d")
> ip_coordinates = np.array([[0 for i in range(geo_dim)] for i in range(num_ip)], dtype = "d")
>
> element_cells = []
> for cel in cells(mesh):
> element_cells.append(cel)
>
> v_element.evaluate_basis_derivatives(0, 1, cell_derivatives, ip_coordinates[0,:], element_cells[0])
>
> leads to the following RuntimeError:
> RuntimeError: // Function evaluate_basis_derivatives not generated (compiled with -fno-evaluate_basis_derivatives)
>
> Maybe I have to change the ufc compile options? But how in/from python? Will it then work?
>
> Thanks a lot in advance,
> Sincerly
>
> Roberto Alessi
>

Revision history for this message
Roberto Alessi (alessi-roberto) said :
#2

Thanks Anders Logg, that solved my question.