Skip to content

Commit b6121f4

Browse files
committed
k
1 parent 5e7da03 commit b6121f4

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

tsfc/fem.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,13 @@ def fiat_cell(self):
7474

7575
@cached_property
7676
def integration_dim(self):
77-
domain, integral_type = tuple(self.domain_integral_type_map.items())[0]
78-
cell = domain.ufl_cell()
79-
fiat_cell = as_fiat_cell(cell)
80-
integration_dim, _ = lower_integral_type(fiat_cell, integral_type)
77+
integration_dims = set()
78+
for domain, integral_type in self.domain_integral_type_map.items():
79+
cell = domain.ufl_cell()
80+
fiat_cell = as_fiat_cell(cell)
81+
integration_dim, _ = lower_integral_type(fiat_cell, integral_type)
82+
integration_dims.add(integration_dim)
83+
integration_dim, = integration_dims
8184
return integration_dim
8285

8386
@cached_property
@@ -121,22 +124,20 @@ def use_canonical_quadrature_point_ordering(self):
121124
# Directly set use_canonical_quadrature_point_ordering = False in context
122125
# for translation of special nodes, e.g., CellVolume, FacetArea, CellOrigin, and CellVertices,
123126
# as quadrature point ordering is not relevant for those node types.
124-
cell_integral_type_map = {
125-
as_fiat_cell(domain.ufl_cell()): integral_type
126-
for domain, integral_type in self.domain_integral_type_map.items()
127-
if integral_type is not None
128-
}
129-
if all(integral_type == 'cell' for integral_type in cell_integral_type_map.values()):
127+
def _any(cell_type, integral_types):
128+
for d, it in self.domain_integral_type_map.items():
129+
if it is None:
130+
continue
131+
c = as_fiat_cell(d.ufl_cell())
132+
if isinstance(c, cell_type) and it in integral_types:
133+
return True
130134
return False
131-
elif all(integral_type in ['exterior_facet', 'interior_facet'] for integral_type in cell_integral_type_map.values()):
132-
if all(isinstance(cell, UFCHexahedron) for cell in cell_integral_type_map):
133-
return True
134-
elif len(set(cell_integral_type_map)) > 1: # mixed cell types
135-
return True
136-
elif any(isinstance(cell, UFCHexahedron) for cell in cell_integral_type_map) and \
137-
any(isinstance(cell, UFCQuadrilateral) for cell in cell_integral_type_map):
135+
if _any(UFCHexahedron, ['exterior_facet', 'interior_facet']):
138136
return True
139-
return False
137+
elif _any(UFCQuadrilateral, ['exterior_facet', 'interior_facet']) and _any(UFCSimplex, ['cell', 'exterior_facet', 'interior_facet']):
138+
return True
139+
else:
140+
return False
140141

141142

142143
class CellKernelInterface(ProxyKernelInterface):

0 commit comments

Comments
 (0)