13.07.2015 Views

UFL Specification and User Manual 0.3 - FEniCS Project

UFL Specification and User Manual 0.3 - FEniCS Project

UFL Specification and User Manual 0.3 - FEniCS Project

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>UFL</strong> <strong>Specification</strong> <strong>and</strong> <strong>User</strong> <strong>Manual</strong> <strong>0.3</strong>Martin S. Alnæs, Anders LoggSubclasses of Terminal represent atomic quantities which terminate the expressiontree, e.g. they have no subexpressions. Subclasses of Operatorrepresent operations on one or more other expressions, which may usually beExpr subclasses of arbitrary type. Different Operators may have restrictionson some properties of their arguments.All the types mentioned here are conceptually immutable, i.e. they shouldnever be modified over the course of their entire lifetime. When a modifiedexpression, measure, integral, or form is needed, a new instance must becreated, possibly sharing some data with the old one. Since the shared datais also immutable, sharing can cause no problems.4.2 General properties of expressionsAny <strong>UFL</strong> expression has certain properties, defined by functions that everyExpr subclass must implement. In the following, u represents an arbitrary<strong>UFL</strong> expression, i.e. an instance of an arbitrary Expr subclass.4.2.1 oper<strong>and</strong>su.oper<strong>and</strong>s() returns a tuple with all the oper<strong>and</strong>s of u, which should allbe Expr instances.4.2.2 reconstructu.reconstruct(oper<strong>and</strong>s) returns a new Expr instance representing thesame operation as u but with other oper<strong>and</strong>s. Terminal objects may simplyreturn self since all Expr instance are immutable. An important invariantis that u.reconstruct(u.oper<strong>and</strong>s()) == u.76

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!