/usr/lib/python2.7/dist-packages/ffc/enrichedelement.py is in python-ffc 2016.2.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | # -*- coding: utf-8 -*-
# Copyright (C) 2010 Marie E. Rognes
#
# This file is part of FFC.
#
# FFC is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# FFC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with FFC. If not, see <http://www.gnu.org/licenses/>.
#
# First added: 2010-03-07
# Last changed: 2010-03-07
import numpy
from .utils import pick_first
from .mixedelement import _combine_entity_dofs, _num_components
class EnrichedElement:
"Create the space spanned by a list of ffc elements."
def __init__(self, elements):
self._elements = elements
self._entity_dofs = _combine_entity_dofs(elements)
def elements(self):
return self._elements
def space_dimension(self):
return sum(e.space_dimension() for e in self._elements)
def value_shape(self):
return pick_first([e.value_shape() for e in self._elements])
def degree(self):
return max(e.degree() for e in self._elements)
def entity_dofs(self):
return self._entity_dofs
def mapping(self):
return [m for e in self._elements for m in e.mapping()]
def dual_basis(self):
# NOTE: dual basis is not sum of subelements basis; it needs to be
# recomputed so that \psi_j(\phi_i) = \delta_{ij} for
# \phi_i basis functions and \psi_j dual basis functions
return [None for e in self._elements for L in e.dual_basis()]
def tabulate(self, order, points):
num_components = _num_components(self)
table_shape = (self.space_dimension(), num_components, len(points))
table = {}
irange = (0, 0)
for element in self._elements:
etable = element.tabulate(order, points)
irange = (irange[1], irange[1] + element.space_dimension())
# Insert element table into table
for dtuple in etable.keys():
if dtuple not in table:
if num_components == 1:
table[dtuple] = numpy.zeros((self.space_dimension(), len(points)))
else:
table[dtuple] = numpy.zeros(table_shape)
table[dtuple][irange[0]:irange[1]][:] = etable[dtuple]
return table
class SpaceOfReals:
def __init__(self, element):
self._element = element
self._entity_dofs = element.entity_dofs()
def space_dimension(self):
return 1
def value_shape(self):
return ()
def degree(self):
return 0
def entity_dofs(self):
return self._entity_dofs
def mapping(self):
return ["affine"]
def dual_basis(self):
return self._element.dual_basis()
def tabulate(self, order, points):
return self._element.tabulate(order, points)
def get_coeffs(self):
return self._element.get_coeffs()
def dmats(self):
return self._element.dmats()
def get_num_members(self, arg):
return self._element.get_num_members(arg)
|