The problem is that you set the parameter too late, before the
function space is generated. Try this, and note that the values array
must be flattened and larger to contain all first derivatives:

from dolfin import *
import numpy as np

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

mesh = UnitSquareMesh(8,8)

Q = FunctionSpace(mesh, "CG", 2)

element = Q.dolfin_element()

basis =
np.zeros(2*element.space_dimension()*element.value_dimension(0))

coords = np.array((0.0,0.0))
cell = Cell(mesh, 0)
vc = cell.get_vertex_coordinates()

element.evaluate_basis_derivatives_all(1,basis, coords, vc, 0)

print basis

PS: To mailing list. The UFC manual needs to be (1) integrated into
the FFC manual, (2) updated and improved, and (3) published on the web
page.

--
Anders


On Mon, Mar 10, 2014 at 04:35:16PM -0700, Michael Wathen wrote:
> Here is a simple example
>
>
>
> from dolfin import *
> import numpy as np
>
> mesh = UnitSquareMesh(8,8)
>
> Q = FunctionSpace(mesh, "CG", 2)
>
> element = Q.dolfin_element()
>
> basis = np.zeros((element.space_dimension(), element.value_dimension(0)))
> coords = np.array((0.0,0.0))
> cell = Cell(mesh, 0)
> parameters["form_compiler"]["no-evaluate_basis_derivatives"] = False
> vc = cell.get_vertex_coordinates()
>
> element.evaluate_basis_derivatives_all(1,basis, coords, vc, 0)
>
>
>
>
>
> On Mon, Mar 10, 2014 at 3:34 PM, Anders Logg <[email protected]> wrote:
>
>     Can you post a minimal example?
>
>
>
>     On Mon, Mar 10, 2014 at 02:33:33PM -0700, Michael Wathen wrote:
>     > I tried setting that parameter to true and then run the code again and I
>     still
>     > get the same error as before.
>     >
>     >
>     > On Mon, Mar 10, 2014 at 2:08 PM, Anders Logg <[email protected]> wrote:
>     >
>     >     ok. That explains it. Check your global parameters:
>     >
>     >       info(parameters, True)
>     >
>     >     It is likely the parameter "no-evaluate_basis_derivatives" is set to
>     >     True. Change it by
>     >
>     >       parameters.form_compiler.no-evaluate_basis_derivatives = False
>     >
>     >     Then try again.
>     >
>     >
>     >
>     >     On Mon, Mar 10, 2014 at 02:03:53PM -0700, Michael Wathen wrote:
>     >     > I am trying to use the evaluate_basis_derivatives function from
>     python.
>     >     >
>     >     >
>     >     > On Mon, Mar 10, 2014 at 1:59 PM, Anders Logg <[email protected]>
>     wrote:
>     >     >
>     >     >     Are you trying to use evaluate_basis_derivatives from C++ or
>     from
>     >     >     Python?
>     >     >
>     >     >
>     >     >
>     >     >     On Mon, Mar 10, 2014 at 11:42:54AM -0700, Michael Wathen 
> wrote:
>     >     >     > I checked the file demo/documented/poisson/cpp/Poisson.h and
>     it
>     >     does seem
>     >     >     that
>     >     >     > there is the function body
>     >     >     ufc::finite_element::evaluate_basis_derivatives is
>     >     >     > generated. I'm guessing this means that I am not quite using
>     the
>     >     function
>     >     >     > correctly....
>     >     >     >
>     >     >     >
>     >     >     > On Mon, Mar 10, 2014 at 11:24 AM, Garth N. Wells <
>     [email protected]>
>     >     wrote:
>     >     >     >
>     >     >     >
>     >     >     >
>     >     >     >     On Thu, 6 Mar, 2014 at 5:25 PM, Michael Wathen <
>     >     [email protected]>
>     >     >     wrote:
>     >     >     >
>     >     >     >         Hi,
>     >     >     >
>     >     >     >         I am trying to use the function
>     evaluate_basis_derivatives
>     >     but
>     >     >     when I
>     >     >     >         try and call it I get
>     >     >     >         Function evaluate_basis_derivatives not generated
>     (compiled
>     >     with
>     >     >     >         -fno-evaluate_basis_derivatives)
>     >     >     >
>     >     >     >
>     >     >     >
>     >     >     >     How did you compile the UFL files? The function(s) for
>     >     evaluating
>     >     >     >     derivatives are created by default by FFC, but can be
>     turned
>     >     off via
>     >     >     a FFC
>     >     >     >     option (to reduce the size of the generated code).
>     >     >     >
>     >     >     >     Looking at the generated file 
> demo/documented/poisson/cpp
>     /
>     >     Poisson.h,
>     >     >     the
>     >     >     >     function body of
>     >     ufc::finite_element::evaluate_basis_derivatives is
>     >     >     >     generated.
>     >     >     >
>     >     >     >     Garth
>     >     >     >
>     >     >     >
>     >     >     >
>     >     >     >         The function evaluate_basis works fine. I installed
>     FEniCS
>     >     using
>     >     >     >         dorsal.
>     >     >     >
>     >     >     >         Michael
>     >     >     >
>     >     >     >
>     >     >     >
>     >     >     >
>     >     >
>     >     >     > _______________________________________________
>     >     >     > fenics-support mailing list
>     >     >     > [email protected]
>     >     >     > http://fenicsproject.org/mailman/listinfo/fenics-support
>     >     >
>     >     >
>     >     >
>     >
>     >
>     >
>
>
>
_______________________________________________
fenics mailing list
[email protected]
http://fenicsproject.org/mailman/listinfo/fenics

Reply via email to