Debian Codegraph @

demo/AlgebraOperators.ufl

raw
1 # Copyright (C) 2010 Kristian B. Oelgaard
2 #
3 # This file is part of FFC.
4 #
5 # FFC is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Lesser General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # FFC is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU Lesser General Public License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with FFC. If not, see <http://www.gnu.org/licenses/>.
17 #
18 # Test all algebra operators on Coefficients.
19 #
20 # Compile this form with FFC: ffc AlgebraOperators.ufl
21
22 element = FiniteElement("Lagrange", triangle, 1)
23
24 c0 = Coefficient(element)
25 c1 = Coefficient(element)
26
27 s0 = 3*c0 - c1
28 p0 = c0*c1
29 f0 = c0/c1
30
31 integrand = 5*c0 + 5*p0 + 5*f0\
32 + s0*c0 + s0*p0 + s0*f0\
33 + 5/c0 + 5/p0 + 5/f0\
34 + s0/c0 + s0/p0 + s0/f0\
35 + s0/5 + s0/5 + s0/5\
36 + c0**2 + s0**2 + p0**2 + f0**2\
37 + c1**2.2 + s0**2.2 + p0**2.2 + f0**2.2\
38 + c0**c1 + s0**c0 + p0**c0 + f0**c0\
39 + c0**s0 + s0**p0 + p0**f0 + f0**p0\
40 + abs(c0) + abs(s0) + abs(p0) + abs(f0)
41
42 a = integrand*dx
43