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 Logg| \ / || Sum Product -- IntValue(-1)| | || Product || | ||---------- Sum ------|The expression tree is a directed acyclic graph (DAG) where the vertices areExpr instances <strong>and</strong> each edge represents a direct dependency between twovertices, i.e. that one vertex is among the oper<strong>and</strong>s of another. A graph canalso be represented in a linearized data structure, consisting of an array ofvertices <strong>and</strong> an array of edges. This representation is convenient for manyalgorithms. An example to illustrate this graph representation:G = V, EV = [a, b, a+b, c, d, c+d, (a+b)*(c+d)]E = [(6,2), (6,5), (5,3), (5,4), (2,0), (2,1)]In the following this representation of an expression will be called the computationalgraph. To construct this graph from a <strong>UFL</strong> expression, simplydoG = Graph(expression)V, E = GThe Graph class can build some useful data structures for use in algorithms.Vin = G.Vin() # Vin[i] = list of vertex indices j such that there is an edgVout = G.Vout() # Vout[i] = list of vertex indices j such that there is an edgEin = G.Ein() # Ein[i] = list of edge indices j such that E[j] is an edge tEout = G.Eout() # Eout[i] = list of edge indices j such that E[j] is an edge f90

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

Saved successfully!

Ooh no, something went wrong!