1
# Written by Robert C. Kirby
2
# Copyright 2005 by The University of Chicago
3
# Distributed under the LGPL license
4
# This work is partially supported by the US Department of Energy
5
# under award number DE-FG02-04ER25650
7
# last edited 16 May 2005
8
import shapes, dualbasis, polynomial, Numeric, points, functional
11
class P0Dual( dualbasis.DualBasis ):
12
def __init__( self , shape , U ):
14
vs = shapes.vertices[shape]
15
bary = Numeric.average( Numeric.array( map( Numeric.array , \
18
self.pts = ( tuple(bary) , )
19
ls = [ functional.PointEvaluation( U , bary ) ]
21
d = shapes.dims[ shape ]
24
for j in shapes.entity_range(shape,i):
26
entity_ids[d] = { 0 : [ 0 ] }
28
fset = functionalset.FunctionalSet( U , ls )
30
dualbasis.DualBasis.__init__( self , fset , entity_ids )
32
class P0( polynomial.FiniteElement ):
33
def __init__( self , shape ):
34
U = polynomial.OrthogonalPolynomialSet( shape , 0 )
35
Udual = P0Dual( shape , U )
36
polynomial.FiniteElement.__init__( self , Udual , U )
38
class VecP0Dual( dualbasis.DualBasis ):
39
def __init__( self , shape , U ):
41
d = shapes.dimension( shape )
42
nc = U.tensor_shape()[0]
43
vs = shapes.vertices[ shape ]
44
bary = Numeric.average( Numeric.array( map( Numeric.array , \
46
self.pts = ( tuple(bary) , )
47
ls = [ functional.ComponentPointEvaluation( U , c , bary ) \
52
for j in shapes.entity_range( shape , i ):
54
entity_ids[d] = { 0 : range( len(ls) ) }
56
fset = functionalset.FunctionalSet( U , ls )
58
dualbasis.DualBasis.__init__( self , fset , entity_ids , nc )
60
class VecP0( polynomial.FiniteElement ):
61
def __init__( self , shape , nc=None ):
62
U = polynomial.OrthogonalPolynomialArraySet( shape , 0 , nc )
63
Udual = VecP0Dual( shape , U )
64
polynomial.FiniteElement.__init__( self , Udual , U )