:py:mod:`FELiCS.Equation.UflDecorator` ====================================== .. py:module:: FELiCS.Equation.UflDecorator Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: FELiCS.Equation.UflDecorator.UflDecorator Attributes ~~~~~~~~~~ .. autoapisummary:: FELiCS.Equation.UflDecorator.logger .. py:data:: logger .. py:class:: UflDecorator(inputUfl=None) Decorator for handling UFL (Unified Form Language) expressions. This class wraps and extends functionality for UFL expressions. It provides methods for symbolic manipulation, analysis, and assembling into finite element matrices, vectors, or scalars. **Initialize the UflDecorator object** :param inputUfl: Initial UFL expression to wrap. If None, the decorator starts without an expression. :type inputUfl: :py:class:`ufl.Form` or :py:obj:`None`, *optional* :ivar lhs: The left-hand side form of the expression. :vartype lhs: :py:class:`ufl.Form` :ivar rhs: The right-hand side form of the expression. :vartype rhs: :py:class:`ufl.Form` :ivar form: The complete form from the expression. :vartype form: :py:class:`ufl.Form` :ivar expression: The underlying UFL expression. :vartype expression: :py:class:`ufl.Form` .. admonition:: Notes Operator overloading is supported (+, +=, -, -=). .. py:property:: expression Return the current UFL expression. :returns: The stored UFL expression. :rtype: :py:class:`ufl.Form` .. py:property:: lhs Return the left-hand side of the UFL expression. :returns: The left-hand side form of the expression. :rtype: :py:class:`ufl.Form` .. py:property:: rhs Return the right-hand side of the UFL expression. :returns: The right-hand side form of the expression. :rtype: :py:class:`ufl.Form` .. py:property:: form Return the general form representation of the UFL expression. :returns: The UFL form of the expression. :rtype: :py:class:`ufl.Form` .. py:method:: add(input_ufl) Add a UFL expression to the current expression. :param input_ufl: The UFL expression to be added. :type input_ufl: :py:class:`ufl.Form` .. admonition:: Notes If no expression has been set yet, this initializes the expression. .. py:method:: subtract(input_ufl) Subtract a UFL expression from the current expression. :param input_ufl: The UFL expression to be subtracted. :type input_ufl: :py:class:`ufl.Form` .. admonition:: Notes If no expression has been set yet, this initializes the expression to the negative of the input. .. py:method:: getAssembledMatrix(mesh, bcs=[]) Assemble the left-hand side form into a matrix. :param mesh: The mesh on which to assemble. :type mesh: :py:class:`FELiCS.SpaceDisc.FELiCSMesh` :param bcs: List of boundary conditions to apply. :type bcs: :py:class:`list` of :py:class:`dolfinx.fem.dirichletbc.DirichletBC`, *optional* :returns: The assembled PETSc matrix. :rtype: :py:class:`petsc4py.PETSc.Mat` .. py:method:: getAssembledVector(mesh, bcs=[]) Assemble the right-hand side form into a vector. :param mesh: The mesh on which to assemble. :type mesh: :py:class:`FELiCS.SpaceDisc.FELiCSMesh` :param bcs: List of boundary conditions to apply. :type bcs: :py:class:`list` of :py:class:`dolfinx.fem.dirichletbc.DirichletBC`, *optional* :returns: The assembled PETSc vector. :rtype: :py:class:`petsc4py.PETSc.Vec` .. py:method:: getAssembledScalar(mesh) Assemble the expression into a scalar. :param mesh: The mesh on which to assemble. :type mesh: :py:class:`FELiCS.SpaceDisc.FELiCSMesh` :returns: The scalar result of the assembly. :rtype: :py:class:`float` .. py:method:: lhsIsZero() Check whether the left-hand side of the expression is effectively zero. :returns: True if lhs is zero or has insufficient arguments; otherwise, False. :rtype: :py:class:`bool` .. py:method:: rhsIsZero() Check whether the right-hand side of the expression is effectively zero. :returns: True if rhs is zero or has insufficient arguments; otherwise, False. :rtype: :py:class:`bool` .. py:method:: isZero() Check whether the expression has been initialized. :returns: True if the expression is not set; False otherwise. :rtype: :py:class:`bool` .. py:method:: printExpression() Print a summary of the current UFL expression. Prints the expression, its arguments, and number of arguments.