def modified_terminal(self, o): mt = analyse_modified_terminal(o) terminal = mt.terminal if not isinstance(terminal, Coefficient): # Only split coefficients return o if type(terminal.ufl_element()) != MixedElement: # Only split mixed coefficients return o # Reference value expected assert mt.reference_value # Derivative indices beta = indices(mt.local_derivatives) components = [] for subcoeff in self._split[terminal]: # Apply terminal modifiers onto the subcoefficient component = construct_modified_terminal(mt, subcoeff) # Collect components of the subcoefficient for alpha in numpy.ndindex(subcoeff.ufl_element().reference_value_shape()): # New modified terminal: component[alpha + beta] components.append(component[alpha + beta]) # Repack derivative indices to shape c, = indices(1) return ComponentTensor(as_tensor(components)[c], MultiIndex((c,) + beta))
def modified_terminal(self, o): mt = analyse_modified_terminal(o) t = mt.terminal r = mt.restriction if isinstance(t, Argument) and r != self.restrictions[t.number()]: return Zero(o.ufl_shape, o.ufl_free_indices, o.ufl_index_dimensions) else: return o
def modified_terminal(self, o): """Overrides the modified terminal handler from :class:`ModifiedTerminalMixin`.""" mt = analyse_modified_terminal(o) return translate(mt.terminal, mt, self.context)