Skip to content

Commit e07f9fa

Browse files
committed
k
1 parent 01a919e commit e07f9fa

File tree

2 files changed

+14
-19
lines changed

2 files changed

+14
-19
lines changed

ufl/algorithms/apply_derivatives.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -625,13 +625,12 @@ def reference_value(self, o):
625625
if esh == ():
626626
esh = (1, )
627627
rdim, gdim = K.ufl_shape
628-
assert rdim == ref_dim
629-
assert gdim == self._var_shape[0]
628+
assert rdim == ref_dim, f"{rdim} != {ref_dim}"
629+
assert gdim == self._var_shape[0], f"{gdim} != {self._var_shape[0]}"
630630
for idx in range(int(numpy.prod(esh))):
631631
for i in range(gdim):
632632
temp = Zero()
633633
for j in range(rdim):
634-
g[(dofoffset + idx, ) + (j, )]
635634
temp += g[(dofoffset + idx, ) + (j, )] * K[j, i]
636635
components.append(temp)
637636
dofoffset += int(numpy.prod(esh))

ufl/domain.py

+12-16
Original file line numberDiff line numberDiff line change
@@ -135,29 +135,25 @@ def __init__(self, *meshes, ufl_id=None, cargo=None):
135135
self._ufl_cargo = cargo
136136
if cargo is not None and cargo.ufl_id() != self._ufl_id:
137137
raise ValueError("Expecting cargo object (e.g. dolfin.Mesh) to have the same ufl_id.")
138-
coordinate_element = meshes[0]._ufl_coordinate_element
139-
self._ufl_coordinate_element = coordinate_element
140-
gdim, = coordinate_element.value_shape
141-
tdim = coordinate_element.cell.topological_dimension()
138+
if any(isinstance(m, MixedMesh) for m in meshes):
139+
raise NotImplementedError("Currently component meshes can not include MixedMesh instances")
140+
# TODO: Should make a "MixedCell" object here:
141+
# currently only support single cell type.
142+
self._ufl_cell, = set(m.ufl_cell() for m in meshes)
143+
gdim, = set(m.geometric_dimension() for m in meshes)
144+
# ReferenceGrad requires topological_dimension of the mixed mesh:
145+
# set tdim to max topological dim for a general mixed mesh (currently not implemented).
146+
tdim = max(m.topological_dimension() for m in meshes)
142147
AbstractDomain.__init__(self, tdim, gdim)
143148
self._meshes = tuple(meshes)
144149

145150
def ufl_cargo(self):
146151
"""Return carried object that will not be used by UFL."""
147152
return self._ufl_cargo
148153

149-
def ufl_coordinate_element(self):
150-
"""Get the coordinate element."""
151-
return self._ufl_coordinate_element
152-
153154
def ufl_cell(self):
154155
"""Get the cell."""
155-
return self._ufl_coordinate_element.cell
156-
157-
def is_piecewise_linear_simplex_domain(self):
158-
"""Check if the domain is a piecewise linear simplex."""
159-
ce = self._ufl_coordinate_element
160-
return ce.embedded_superdegree <= 1 and ce in H1 and self.ufl_cell().is_simplex()
156+
return self._ufl_cell
161157

162158
def __repr__(self):
163159
"""Representation."""
@@ -170,15 +166,15 @@ def __str__(self):
170166

171167
def _ufl_hash_data_(self):
172168
"""UFL hash data."""
173-
return (type(self), self._ufl_id, self._ufl_coordinate_element)
169+
return ("MixedMesh", self._ufl_id)
174170

175171
def _ufl_signature_data_(self, renumbering):
176172
"""UFL signature data."""
177173
return ("MixedMesh", tuple(m._ufl_signature_data_(renumbering) for m in self._meshes))
178174

179175
def _ufl_sort_key_(self):
180176
"""UFL sort key."""
181-
typespecific = (self._ufl_id, self._ufl_coordinate_element)
177+
typespecific = (self._ufl_id, )
182178
return (self.geometric_dimension(), self.topological_dimension(),
183179
"MixedMesh", typespecific)
184180

0 commit comments

Comments
 (0)