Skip to content

Commit

Permalink
k
Browse files Browse the repository at this point in the history
  • Loading branch information
ksagiyam committed Apr 19, 2024
1 parent 01a919e commit e07f9fa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
5 changes: 2 additions & 3 deletions ufl/algorithms/apply_derivatives.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,13 +625,12 @@ def reference_value(self, o):
if esh == ():
esh = (1, )
rdim, gdim = K.ufl_shape
assert rdim == ref_dim
assert gdim == self._var_shape[0]
assert rdim == ref_dim, f"{rdim} != {ref_dim}"
assert gdim == self._var_shape[0], f"{gdim} != {self._var_shape[0]}"
for idx in range(int(numpy.prod(esh))):
for i in range(gdim):
temp = Zero()
for j in range(rdim):
g[(dofoffset + idx, ) + (j, )]
temp += g[(dofoffset + idx, ) + (j, )] * K[j, i]
components.append(temp)
dofoffset += int(numpy.prod(esh))
Expand Down
28 changes: 12 additions & 16 deletions ufl/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,29 +135,25 @@ def __init__(self, *meshes, ufl_id=None, cargo=None):
self._ufl_cargo = cargo
if cargo is not None and cargo.ufl_id() != self._ufl_id:
raise ValueError("Expecting cargo object (e.g. dolfin.Mesh) to have the same ufl_id.")
coordinate_element = meshes[0]._ufl_coordinate_element
self._ufl_coordinate_element = coordinate_element
gdim, = coordinate_element.value_shape
tdim = coordinate_element.cell.topological_dimension()
if any(isinstance(m, MixedMesh) for m in meshes):
raise NotImplementedError("Currently component meshes can not include MixedMesh instances")
# TODO: Should make a "MixedCell" object here:
# currently only support single cell type.
self._ufl_cell, = set(m.ufl_cell() for m in meshes)
gdim, = set(m.geometric_dimension() for m in meshes)
# ReferenceGrad requires topological_dimension of the mixed mesh:
# set tdim to max topological dim for a general mixed mesh (currently not implemented).
tdim = max(m.topological_dimension() for m in meshes)
AbstractDomain.__init__(self, tdim, gdim)
self._meshes = tuple(meshes)

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

def ufl_coordinate_element(self):
"""Get the coordinate element."""
return self._ufl_coordinate_element

def ufl_cell(self):
"""Get the cell."""
return self._ufl_coordinate_element.cell

def is_piecewise_linear_simplex_domain(self):
"""Check if the domain is a piecewise linear simplex."""
ce = self._ufl_coordinate_element
return ce.embedded_superdegree <= 1 and ce in H1 and self.ufl_cell().is_simplex()
return self._ufl_cell

def __repr__(self):
"""Representation."""
Expand All @@ -170,15 +166,15 @@ def __str__(self):

def _ufl_hash_data_(self):
"""UFL hash data."""
return (type(self), self._ufl_id, self._ufl_coordinate_element)
return ("MixedMesh", self._ufl_id)

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

def _ufl_sort_key_(self):
"""UFL sort key."""
typespecific = (self._ufl_id, self._ufl_coordinate_element)
typespecific = (self._ufl_id, )
return (self.geometric_dimension(), self.topological_dimension(),
"MixedMesh", typespecific)

Expand Down

0 comments on commit e07f9fa

Please sign in to comment.