Actually, I'm now less sure where the problem is.

If I do this, in the state object
...
self.V_elt[2] = V2t_elt
...

and then later,
Vtdg_elt = BrokenElement(state.V_elt[2])
Vtdg = FunctionSpace(mesh, Vtdg_elt)

then I get the same error.

--cjc

On 5 July 2016 at 09:31, Mitchell, Lawrence <lawrence.mitchell@imperial.ac.uk> wrote:

> On 5 Jul 2016, at 09:23, Colin Cotter <colin.cotter@imperial.ac.uk> wrote:
>
> Dear Firedrakers,
>   I have a bit of code where I want to construct a broken function space corresponding to a given function space.
>
> My code is:
> Vdg_elt = BrokenElement(V.ufl_element())
> Vdg = FunctionSpace(state.mesh, Vdg_elt)
>
> This returns an error:
>   File "/home/cjc1/repositories/dcore/gusto/advection.py", line 199, in __init__
>     Vdg = FunctionSpace(state.mesh, Vdg_elt)
>   File "<decorator-gen-291>", line 2, in FunctionSpace
>   File "/home/cjc1/firedrake/src/PyOP2/pyop2/profiling.py", line 59, in wrapper
>     return f(*args, **kwargs)
>   File "/home/cjc1/firedrake/src/firedrake/firedrake/functionspace.py", line 131, in FunctionSpace
>     new = impl.FunctionSpace(topology, element, name=name)
>   File "/home/cjc1/firedrake/src/firedrake/firedrake/functionspaceimpl.py", line 245, in __init__
>     sdata = get_shared_data(mesh, fiat_element)
>   File "/home/cjc1/firedrake/src/firedrake/firedrake/functionspacedata.py", line 558, in get_shared_data
>     return FunctionSpaceData(mesh, fiat_element)
>   File "/home/cjc1/firedrake/src/firedrake/firedrake/functionspacedata.py", line 310, in __init__
>     self.bt_masks = get_bt_masks(mesh, edofs_key, fiat_element)
>   File "<decorator-gen-281>", line 2, in get_bt_masks
>   File "/home/cjc1/firedrake/src/firedrake/firedrake/functionspacedata.py", line 56, in cached
>     result = f(mesh, key, *args, **kwargs)
>   File "/home/cjc1/firedrake/src/firedrake/firedrake/functionspacedata.py", line 205, in get_bt_masks
>     facet_dofs = horiz_facet_support_dofs(fiat_element)
>   File "/home/cjc1/firedrake/src/fiat/FIAT/tensor_product.py", line 355, in horiz_facet_support_dofs
>     assert isinstance(elem.ref_el, TensorProductCell)
> AttributeError: DiscontinuousElement instance has no attribute 'ref_el'
>
> What is the right way to do this?


Patch FIAT/tensor_product.py to use elem.get_reference_element() rather than using internal implementation details.

Lawrence



--
http://www.imperial.ac.uk/people/colin.cotter

www.cambridge.org/9781107663916