Thread Previous • Date Previous • Date Next • Thread Next |
Here is a patch which adds LGL and CGL to the possible Lagrange LINE nodes. Someone else can extend it to simplices if desired. I didn't add plumbing up to the user interface, but it's a one line change to choose a different set of nodes. Jed
diff -r bf2daae56306 FIAT/shapes.py --- a/FIAT/shapes.py Thu Apr 24 09:57:46 2008 -0500 +++ b/FIAT/shapes.py Mon May 26 10:11:41 2008 +0200 @@ -17,7 +17,7 @@ from factorial import factorial from math import sqrt import numbering, reference # UFC vs. FIAT modules. - +import jacobi def strike_col( A , j ): m,n = A.shape @@ -216,7 +216,7 @@ td = td * ( n + i + 1 ) return td / factorial( d ) -def make_lattice_line( n , interior = 0 ): +def make_lattice_line_evenly_spaced( n , interior = 0 ): if n == 0: return tuple( ) v0 = vertices[ LINE ][0][0] @@ -224,6 +224,29 @@ h = abs( v1 - v0 ) return tuple( [ ( v0 + ( h * jj ) / n , ) \ for jj in xrange( interior , n + 1 - interior ) ] ) + +def compute_lgl_points( n, interior = 0 ): + if n == 0: + return [] + xi = jacobi.compute_gauss_jacobi_points(1,1,n-2) + return interior and xi or [-1] + xi + [1] + +def compute_cgl_points( n, interior = 0 ): + if n == 0: + return [] + xi = n == 1 and [] or [ numpy.cos(i * numpy.pi / (n-1)) for i in xrange(1,n-1) ] + return interior and xi or [-1] + xi + [1] + +def make_lattice_line_gen( n , interior = 0 , pointgen = compute_lgl_points ): + if n == 0: + return tuple( ) + v0 = vertices[ LINE ][0][0] + v1 = vertices[ LINE ][1][0] + h = ( v1 - v0 ) / 2 + return tuple( [ (v0 + h * (x + 1),) for x in pointgen(n+1, interior) ] ) + +def make_lattice_line( n , interior = 0 ): + return make_lattice_line_gen( n, interior, compute_lgl_points ) def make_lattice_triangle( n , interior = 0 ): if n == 0: return tuple( )
Attachment:
pgpS4Im3kIeIt.pgp
Description: PGP signature
Thread Previous • Date Previous • Date Next • Thread Next |