def __init__(self, meshes, ufl_id=None): self._ufl_id = self._init_ufl_id(ufl_id) # TODO: Error checking of meshes self._ufl_meshes = meshes # TODO: Is this what we want to do? # Build cell from mesh cells self._ufl_cell = TensorProductCell(*[mesh.ufl_cell() for mesh in meshes]) # TODO: Is this what we want to do? # Build coordinate element from mesh coordinate elements self._ufl_coordinate_element = TensorProductElement([mesh.ufl_coordinate_element() for mesh in meshes]) # Derive dimensions from meshes gdim = sum(mesh.geometric_dimension() for mesh in meshes) tdim = sum(mesh.topological_dimension() for mesh in meshes) AbstractDomain.__init__(self, tdim, gdim)
def __init__(self, *elements, **kwargs): "Create TensorProductElement from a given list of elements." if not elements: error("Cannot create TensorProductElement from empty list.") keywords = list(kwargs.keys()) if keywords and keywords != ["cell"]: raise ValueError( "TensorProductElement got an unexpected keyword argument '%s'" % keywords[0]) cell = kwargs.get("cell") family = "TensorProductElement" if cell is None: # Define cell as the product of each elements cell cell = TensorProductCell(*[e.cell() for e in elements]) else: cell = as_cell(cell) # Define polynomial degree as a tuple of sub-degrees degree = tuple(e.degree() for e in elements) # No quadrature scheme defined quad_scheme = None # match FIAT implementation value_shape = tuple(chain(*[e.value_shape() for e in elements])) reference_value_shape = tuple( chain(*[e.reference_value_shape() for e in elements])) if len(value_shape) > 1: error("Product of vector-valued elements not supported") if len(reference_value_shape) > 1: error("Product of vector-valued elements not supported") FiniteElementBase.__init__(self, family, cell, degree, quad_scheme, value_shape, reference_value_shape) self._sub_elements = elements self._cell = cell self._repr = "TensorProductElement(%s, cell=%s)" % (", ".join( repr(e) for e in elements), repr(cell))