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 modified 9 may 2005
10
import shapes, points, dualbasis, polynomial, functional, functionalset
12
class CrouzeixRaviartDual( dualbasis.DualBasis ):
13
"""Dual basis for Crouzeix-Raviart element (linears continuous at
14
boundary midpoints)"""
15
def __init__( self , shape , U ):
16
# in d dimensions, evaluate at midpoints of (d-1)-dimensional
18
d = shapes.dims[ shape ]
19
pts = [ pt for i in shapes.entity_range(shape,d-1) \
20
for pt in points.make_points( shape , d-1 , i , d ) ]
21
ls = functional.make_point_evaluations( U , pts )
25
for j in shapes.entity_range(shape,i):
28
for i in shapes.entity_range(shape,d-1):
29
entity_ids[d-1][i] = [i]
30
entity_ids[d] = { 0: [] }
32
fset = functionalset.FunctionalSet( U , ls )
34
dualbasis.DualBasis.__init__( self , fset , entity_ids )
36
class CrouzeixRaviart( polynomial.FiniteElement ):
37
def __init__( self , shape ):
38
U = polynomial.OrthogonalPolynomialSet( shape , 1 )
39
Udual = CrouzeixRaviartDual( shape , U )
40
polynomial.FiniteElement.__init__( self , Udual , U )