Debian Codegraph @

test/unit/symbolics/test_real_examples.py

raw
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2010 Kristian B. Oelgaard
3 #
4 # This file is part of FFC.
5 #
6 # FFC is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU Lesser General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # FFC is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU Lesser General Public License for more details.
15 #
16 # You should have received a copy of the GNU Lesser General Public License
17 # along with FFC. If not, see <http://www.gnu.org/licenses/>.
18
19 import pytest
20 import time
21
22 # FFC modules
23 from ffc.quadrature.symbolics import *
24 from ffc.quadrature.cpp import format, set_float_formatting
25 from ffc.parameters import FFC_PARAMETERS
26 set_float_formatting(FFC_PARAMETERS['precision'])
27
28
29 def testRealExamples():
30 p = Product([Symbol('FE0_C1_D01[ip][k]', BASIS),
31 Sum([
32 Symbol('Jinv_10', GEO),
33 Symbol('w[4][0]', GEO)
34 ]),
35 Sum([
36 Symbol('Jinv_10', GEO),
37 Symbol('w[4][0]', GEO)
38 ])
39 ])
40
41 br = p.reduce_vartype(BASIS)
42 be = p.expand().reduce_vartype(BASIS)
43
44 if len(be) == 1:
45 if be[0][0] == br[0]:
46 if be[0][1] != br[1].expand():
47 print("\nbe: ", repr(be[0][1]))
48 print("\nbr: ", repr(br[1].expand()))
49 print("\nbe: ", be[0][1])
50 print("\nbr: ", br[1].expand())
51 RuntimeError("Should not be here")