:py:mod:`symfem.piecewise_functions` ==================================== .. py:module:: symfem.piecewise_functions .. autoapi-nested-parse:: Piecewise basis function classes. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: symfem.piecewise_functions.PiecewiseFunction Functions ~~~~~~~~~ .. autoapisummary:: symfem.piecewise_functions._piece_reference .. py:class:: PiecewiseFunction(pieces: Dict[symfem.geometry.SetOfPointsInput, symfem.functions.FunctionInput], tdim: int) Bases: :py:obj:`symfem.functions.AnyFunction` A piecewise function. .. py:property:: pieces :type: Dict[symfem.geometry.SetOfPoints, symfem.functions.AnyFunction] Get the pieces of the function. :returns: The function pieces .. py:property:: shape :type: Tuple[int, Ellipsis] Get the value shape of the function. :returns: The value shape .. py:attribute:: _pieces :type: Dict[symfem.geometry.SetOfPoints, symfem.functions.AnyFunction] .. py:method:: __len__() Get the length of the vector. .. py:method:: as_sympy() -> symfem.functions.SympyFormat Convert to a sympy expression. :returns: A Sympy expression .. py:method:: as_tex() -> str Convert to a TeX expression. :returns: A TeX string .. py:method:: get_piece(point: symfem.geometry.PointType) -> symfem.functions.AnyFunction Get a piece of the function. :param point: The point to get the piece at :returns: The piece of the function that is valid at that point .. py:method:: __getitem__(key) -> PiecewiseFunction Get a component or slice of the function. .. py:method:: __eq__(other: Any) -> bool Check if two functions are equal. .. py:method:: __add__(other: Any) -> PiecewiseFunction Add. .. py:method:: __radd__(other: Any) -> PiecewiseFunction Add. .. py:method:: __sub__(other: Any) -> PiecewiseFunction Subtract. .. py:method:: __rsub__(other: Any) -> PiecewiseFunction Subtract. .. py:method:: __truediv__(other: Any) -> PiecewiseFunction Divide. .. py:method:: __rtruediv__(other: Any) -> PiecewiseFunction Divide. .. py:method:: __mul__(other: Any) -> PiecewiseFunction Multiply. .. py:method:: __rmul__(other: Any) -> PiecewiseFunction Multiply. .. py:method:: __matmul__(other: Any) -> PiecewiseFunction Multiply. .. py:method:: __rmatmul__(other: Any) -> PiecewiseFunction Multiply. .. py:method:: __pow__(other: Any) -> PiecewiseFunction Raise to a power. .. py:method:: __neg__() -> PiecewiseFunction Negate. .. py:method:: subs(vars: symfem.symbols.AxisVariables, values: symfem.functions.ValuesToSubstitute) -> PiecewiseFunction Substitute values into the function. :param vars: The variables to substitute out :param values: The value to substitute in :returns: The substituted function .. py:method:: diff(variable: sympy.core.symbol.Symbol) -> PiecewiseFunction Differentiate the function. :param variable: The variable to differentiate with respect to :returns: The differentiated function .. py:method:: directional_derivative(direction: symfem.geometry.PointType) -> PiecewiseFunction Compute a directional derivative. :param direction: The diection :returns: The directional derivative .. py:method:: jacobian_component(component: Tuple[int, int]) -> PiecewiseFunction Compute a component of the jacobian. :param component: The component :returns: The component of the jacobian .. py:method:: jacobian(dim: int) -> PiecewiseFunction Compute the jacobian. :param dim: The topological dimension of the cell :returns: The jacobian .. py:method:: dot(other_in: symfem.functions.FunctionInput) -> PiecewiseFunction Compute the dot product with another function. :param other_in: The function to multiply with :returns: The product .. py:method:: cross(other_in: symfem.functions.FunctionInput) -> PiecewiseFunction Compute the cross product with another function. :param other_in: The function to multiply with :returns: The cross product .. py:method:: div() -> PiecewiseFunction Compute the div of the function. :returns: The divergence .. py:method:: grad(dim: int) -> PiecewiseFunction Compute the grad of the function. :returns: The gradient .. py:method:: curl() -> PiecewiseFunction Compute the curl of the function. :returns: The curl .. py:method:: norm() -> PiecewiseFunction Compute the norm of the function. :returns: The norm .. py:method:: integral(domain: symfem.references.Reference, vars: symfem.symbols.AxisVariablesNotSingle = x, dummy_vars: symfem.symbols.AxisVariablesNotSingle = t) -> symfem.functions.ScalarFunction Compute the integral of the function. :param domain: The domain of the integral :param vars: The variables to integrate with respect to :param dummy_vars: The dummy variables to use inside the integral :returns: The integral .. py:method:: det() -> PiecewiseFunction Compute the determinant. :returns: The deteminant .. py:method:: transpose() -> PiecewiseFunction Compute the transpose. :returns: The transpose .. py:method:: map_pieces(fwd_map: symfem.geometry.PointType) Map the function's pieces. :param fwd_map: The map from the reference cell to a physical cell :returns: The mapped pieces .. py:method:: plot_values(reference: symfem.references.Reference, img: Any, value_scale: sympy.core.expr.Expr = sympy.Integer(1), n: int = 6) Plot the function's values. :param reference: The reference cell :param img: The image to plot on :param value_scale: The scale factor for the function values :param n: The number of points per side for plotting .. py:method:: with_floats() -> symfem.functions.AnyFunction Return a version the function with floats as coefficients. :returns: A version the function with floats as coefficients .. py:method:: maximum_degree(cell: symfem.references.Reference) -> int :abstractmethod: Return the maximum degree of the function on a reference cell. This function returns the order of the lowerst order Lagrange space on the input cell that includes this function. :param cell: The cell :returns: A version the function with floats as coefficients .. py:function:: _piece_reference(tdim, shape) Create a reference element for a single piece.