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

Source Code for Module sfc.representation.integralrep_uflacs

 1  # -*- coding: utf-8 -*- 
 2  """ 
 3  This module contains representation classes for integrals. 
 4  """ 
 5   
 6  # Copyright (C) 2012-2012 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:  2012-05-29 
24  # Last changed: 2012-05-29 
25   
26  #import SyFi 
27  import swiginac 
28  #import uflacs 
29   
30  from sfc.common import sfc_assert, sfc_warning, sfc_debug, sfc_error 
31  from ufl.permutation import compute_indices 
32  #from sfc.common.utilities import indices_subset 
33   
34  from sfc.representation.integralrepresentationbase import IntegralRepresentationBase 
35   
36 -class UflacsIntegralRepresentation(IntegralRepresentationBase):
37 - def __init__(self, integrals, formrep, on_facet):
38 IntegralRepresentationBase.__init__(self, integrals, formrep, on_facet) 39 40 # Shape of element tensor 41 A_shape = [] 42 for i in range(self.formrep.rank): 43 element = self.formrep.formdata.elements[i] 44 rep = self.formrep.element_reps[element] 45 A_shape.append(rep.local_dimension) 46 self.A_shape = tuple(A_shape) 47 48 # All permutations of element tensor indices 49 # TODO: Not same for interior_facet_integrals, move to subclasses 50 self.indices = compute_indices(self.A_shape) 51 52 self.num_quadrature_points = (formrep.facet_quad_rules[0].num_points 53 if on_facet 54 else formrep.quad_rule.num_points)
55
56 -class UflacsCellIntegralRepresentation(UflacsIntegralRepresentation):
57 - def __init__(self, integrals, formrep):
58 UflacsIntegralRepresentation.__init__(self, integrals, formrep, False)
59
60 -class UflacsExteriorFacetIntegralRepresentation(UflacsIntegralRepresentation):
61 - def __init__(self, integrals, formrep):
62 UflacsIntegralRepresentation.__init__(self, integrals, formrep, True)
63
64 -class UflacsInteriorFacetIntegralRepresentation(UflacsIntegralRepresentation):
65 - def __init__(self, integrals, formrep):
66 UflacsIntegralRepresentation.__init__(self, integrals, formrep, True)
67 68 69 CellIntegralRepresentation = UflacsCellIntegralRepresentation 70 ExteriorFacetIntegralRepresentation = UflacsExteriorFacetIntegralRepresentation 71 InteriorFacetIntegralRepresentation = UflacsInteriorFacetIntegralRepresentation 72