1
2 """
3 This module contains the representation class for cell integrals.
4 """
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 from sfc.common import sfc_assert, sfc_debug
27 from sfc.representation.integralrepresentation import IntegralRepresentation
28
32
34 "Compute expression for A[iota]. Overload in subclasses!"
35
36 if data.integration_method == "quadrature":
37
38 if self.options.safemode:
39 integrand = data.integral.integrand()
40 data.evaluator.update(iota)
41 integrand = data.evaluator.visit(integrand)
42 else:
43 n = len(data.G.V())
44 integrand = data.vertex_data_set[iota][n-1]
45
46 D = self.formrep.D_sym
47 A = integrand * D
48
49 if self.formrep.options.output.enable_debug_prints:
50 sfc_debug("In compute_A(", iota, "):")
51 sfc_debug(" data.integral.integrand() = ", data.integral.integrand())
52 sfc_debug(" integrand = ", integrand)
53 sfc_debug(" A = ", A)
54
55 elif data.integration_method == "symbolic":
56 integrand = data.integral.integrand()
57 data.evaluator.update(iota)
58 integrand = data.evaluator.visit(integrand)
59 detG = self.formrep.detG_sym
60 polygon = self.formrep.cell.polygon
61 A = polygon.integrate(integrand) * detG
62
63 if self.formrep.options.output.enable_debug_prints:
64 sfc_debug("In compute_A(", iota, "):")
65 sfc_debug(" data.integral.integrand() = ", data.integral.integrand())
66 sfc_debug(" integrand = ", integrand)
67 sfc_debug(" A = ", A)
68
69 return A
70