Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #111 from firedrakeproject/fix-ffc-issue-144
Browse files Browse the repository at this point in the history
Fix FFC issue #144
  • Loading branch information
miklos1 authored Apr 21, 2017
2 parents 59d7b3a + d96268b commit ee5670a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
15 changes: 10 additions & 5 deletions tsfc/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from functools import reduce
from itertools import chain

import ufl
from ufl.algorithms import extract_arguments, extract_coefficients
from ufl.algorithms.analysis import has_type
from ufl.classes import Form, CellVolume
Expand Down Expand Up @@ -134,6 +135,7 @@ def compile_integral(integral_data, form_data, prefix, parameters,
mode_irs.setdefault(mode, collections.OrderedDict())

integrand = ufl_utils.replace_coordinates(integral.integrand(), coordinates)
integrand = ufl.replace(integrand, form_data.function_replace_map)
integrand = ufl_utils.split_coefficients(integrand, builder.coefficient_split)

# Check if the integral has a quad degree attached, otherwise use
Expand Down Expand Up @@ -338,24 +340,27 @@ def lower_integral_type(fiat_cell, integral_type):
:arg fiat_cell: FIAT reference cell
:arg integral_type: integral type (string)
"""
vert_facet_types = ['exterior_facet_vert', 'interior_facet_vert']
horiz_facet_types = ['exterior_facet_bottom', 'exterior_facet_top', 'interior_facet_horiz']

dim = fiat_cell.get_dimension()
if integral_type == 'cell':
integration_dim = dim
elif integral_type in ['exterior_facet', 'interior_facet']:
integration_dim = dim - 1
elif integral_type == 'vertex':
integration_dim = 0
else:
elif integral_type in vert_facet_types + horiz_facet_types:
# Extrusion case
basedim, extrdim = dim
assert extrdim == 1

if integral_type in ['exterior_facet_vert', 'interior_facet_vert']:
if integral_type in vert_facet_types:
integration_dim = (basedim - 1, 1)
elif integral_type in ['exterior_facet_bottom', 'exterior_facet_top', 'interior_facet_horiz']:
elif integral_type in horiz_facet_types:
integration_dim = (basedim, 0)
else:
raise NotImplementedError("integral type %s not supported" % integral_type)
else:
raise NotImplementedError("integral type %s not supported" % integral_type)

if integral_type == 'exterior_facet_bottom':
entity_ids = [0]
Expand Down
5 changes: 4 additions & 1 deletion tsfc/finatinterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ def __init__(self, element, degree=None):

@property
def degree(self):
return self._degree or super(FiatElementWrapper, self).degree
if self._degree is not None:
return self._degree
else:
return super(FiatElementWrapper, self).degree


def fiat_compat(element):
Expand Down
2 changes: 1 addition & 1 deletion tsfc/kernel_interface/firedrake.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def set_coefficients(self, integral_data, form_data):
# of reduced_coefficients the integral requires.
for i in range(len(integral_data.enabled_coefficients)):
if integral_data.enabled_coefficients[i]:
coefficient = form_data.reduced_coefficients[i]
coefficient = form_data.function_replace_map[form_data.reduced_coefficients[i]]
if type(coefficient.ufl_element()) == ufl_MixedElement:
split = [Coefficient(FunctionSpace(coefficient.ufl_domain(), element))
for element in coefficient.ufl_element().sub_elements()]
Expand Down
2 changes: 1 addition & 1 deletion tsfc/kernel_interface/ufc.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def set_coefficients(self, integral_data, form_data):
if not integral_data.enabled_coefficients[n]:
continue

coeff = form_data.reduced_coefficients[n]
coeff = form_data.function_replace_map[form_data.reduced_coefficients[n]]
if type(coeff.ufl_element()) == ufl_MixedElement:
coeffs = [Coefficient(FunctionSpace(coeff.ufl_domain(), element))
for element in coeff.ufl_element().sub_elements()]
Expand Down

0 comments on commit ee5670a

Please sign in to comment.