~chaffra/fiat/main

« back to all changes in this revision

Viewing changes to FIAT/CrouzeixRaviart.py

  • Committer: kirby
  • Date: 2005-05-31 15:03:57 UTC
  • Revision ID: devnull@localhost-20050531150357-n7ka5987yo6ylpaz
[project @ 2005-05-31 15:03:57 by kirby]
Initial revision

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
6
 
 
7
# Last modified 9 may 2005
 
8
 
 
9
 
 
10
import shapes, points, dualbasis, polynomial, functional, functionalset
 
11
 
 
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
 
17
        # entities
 
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 )
 
22
        entity_ids = {}
 
23
        for i in range(d-1):
 
24
            entity_ids[i] = {}
 
25
            for j in shapes.entity_range(shape,i):
 
26
                entity_ids[i][j] = []
 
27
        entity_ids[d-1] = {}
 
28
        for i in shapes.entity_range(shape,d-1):
 
29
            entity_ids[d-1][i] = [i]
 
30
        entity_ids[d] = { 0: [] }
 
31
 
 
32
        fset = functionalset.FunctionalSet( U , ls )
 
33
        
 
34
        dualbasis.DualBasis.__init__( self , fset , entity_ids )
 
35
 
 
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 )
 
41
        return
 
42
 
 
43
        
 
44
                
 
45
        
 
46