diff --git a/tsfc/driver.py b/tsfc/driver.py index 448789f3..14a93325 100644 --- a/tsfc/driver.py +++ b/tsfc/driver.py @@ -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 @@ -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 @@ -338,6 +340,9 @@ 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 @@ -345,17 +350,17 @@ def lower_integral_type(fiat_cell, integral_type): 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] diff --git a/tsfc/finatinterface.py b/tsfc/finatinterface.py index f2d19f9a..f36df957 100644 --- a/tsfc/finatinterface.py +++ b/tsfc/finatinterface.py @@ -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): diff --git a/tsfc/kernel_interface/firedrake.py b/tsfc/kernel_interface/firedrake.py index 85cddf26..9b28bd4a 100644 --- a/tsfc/kernel_interface/firedrake.py +++ b/tsfc/kernel_interface/firedrake.py @@ -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()] diff --git a/tsfc/kernel_interface/ufc.py b/tsfc/kernel_interface/ufc.py index 965dd5ef..bd717d06 100644 --- a/tsfc/kernel_interface/ufc.py +++ b/tsfc/kernel_interface/ufc.py @@ -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()]