Package sfc :: Package representation :: Module cellintegralrepresentation
[hide private]
[frames] | no frames]

Source Code for Module sfc.representation.cellintegralrepresentation

 1  # -*- coding: utf-8 -*- 
 2  """ 
 3  This module contains the representation class for cell integrals. 
 4  """ 
 5   
 6  # Copyright (C) 2008-2009 Martin Sandve Alnes and Simula Resarch Laboratory 
 7  # 
 8  # This file is part of SyFi. 
 9  # 
10  # SyFi is free software: you can redistribute it and/or modify 
11  # it under the terms of the GNU General Public License as published by 
12  # the Free Software Foundation, either version 2 of the License, or 
13  # (at your option) any later version. 
14  # 
15  # SyFi is distributed in the hope that it will be useful, 
16  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
17  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
18  # GNU General Public License for more details. 
19  # 
20  # You should have received a copy of the GNU General Public License 
21  # along with SyFi. If not, see <http://www.gnu.org/licenses/>. 
22  # 
23  # First added:  2008-08-13 
24  # Last changed: 2009-03-17 
25   
26  from sfc.common import sfc_assert, sfc_debug 
27  from sfc.representation.integralrepresentation import IntegralRepresentation 
28   
29 -class CellIntegralRepresentation(IntegralRepresentation):
30 - def __init__(self, integrals, formrep):
31 IntegralRepresentation.__init__(self, integrals, formrep, False)
32
33 - def compute_A(self, data, iota, facet=None):
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