DUNE-FEM (unstable)

orthonormalbase_1d.hh
1// original implementation done by Christian Engwer
2#ifndef DUNE_ORTHONORMALBASE_1D_HH
3#define DUNE_ORTHONORMALBASE_1D_HH
4
5#include <stdlib.h>
6#include <stdio.h>
7#include <cassert>
8
9namespace Dune
10{
11 namespace Fem
12 {
13 template <class DomainField, class RangeField>
14 class OrthonormalBase_1D
15 {
16 typedef const DomainField* DomainType;
17 typedef RangeField* JacobianRangeType;
18
19 public:
20 /****************************************************************************/
21 /* functions */
22 /****************************************************************************/
23 /* \phi_i(x,y) for lines */
24 static RangeField
25 eval_line ( const int i, DomainType xi )
26 {
27 const RangeField &x = xi[0];
28
29 switch (i)
30 {
31 case ( 0 ):
32 return 1.;
33 case ( 1 ):
34 return 3.46410161513775458705489268300*x
35 -1.73205080756887729352744634150;
36 case ( 2 ):
37 return x*( 13.4164078649987381784550420124*x
38 -13.4164078649987381784550420124)
39 +2.23606797749978969640917366874;
40 case ( 3 ):
41 return x*(x*(52.9150262212918118100323150728*x
42 -79.3725393319377177150484726092)
43 +31.7490157327750870860193890437)
44 -2.64575131106459059050161575364;
45 case ( 4 ):
46 return x*(x*(x*( 210.000000000000000000000000000*x
47 -420.000000000000000000000000000)
48 +270.000000000000000000000000000)
49 -60.0000000000000000000000000000)
50 +3.00000000000000000000000000000;
51 case ( 5 ):
52 return x*(x*(x*(x*( 835.789447169560761976963049642*x
53 -2089.47361792390190494240762410)
54 +1857.30988259902391550436233253)
55 -696.491205974633968314135874699)
56 +99.498743710661995473447982101)
57 -3.31662479035539984911493273666;
58 case ( 6 ):
59 return x*(x*(x*(x*(x*( 3331.52937852872610684216045114*x
60 -9994.58813558617832052648135341)
61 +11357.4865177115662733255469926)
62 -6057.32614277950201244029172934)
63 +1514.33153569487550311007293234)
64 -151.433153569487550311007293234)
65 +3.60555127546398929311922126752;
66
67 case ( 7 ):
68 return x*(x*(x*(x*(x*(x*( 13292.0788441838547499352388521*x
69 -46522.2759546434916247733359823)
70 +64415.4590141217576343015421294)
71 -44732.9576486956650238205153677)
72 +16266.5300540711509177529146793)
73 -2927.97540973280716519552464227)
74 +216.88706738761534557003886240)
75 -3.87298334620741688517926540018;
76
77 case ( 8 ):
78 return x*(x*(x*(x*(x*(x*(x* (53064.3694016992912762015448463*x
79 -212257.477606797165104806179385)
80 +346687.213424435369671183426329)
81 -297160.468649516031146728651139)
82 +142865.609927651938051311851510)
83 -38097.4959807071834803498270695)
84 +5195.11308827825229277497641852)
85 -296.86360504447155958714150963)
86 +4.12310562561766054982140985569;
87 case ( 9 ):
88 return x*(x*(x*(x*(x*(x*(x*(x*( 211929.666634947548109762064055*x
89 -953683.499857263966493929288249)
90 +1795168.94090779099575327866024)
91 -1832568.29384336997483147196565)
92 +1099540.97630602198489888317940)
93 -392693.205823579280321029706926)
94 +80552.4524766316472453394270618)
95 -8630.61990821053363342922432814)
96 +392.3009049186606197013283786)
97 -4.3588989435406735522369819839;
98
99 case(10):
100 return x*(x*(x*(x*(x*(x*(x*(x*(x*(
101 846658.355097261176257181247326*x
102 -4233291.77548630588128590623663)
103 +9023595.62669449411537258960966)
104 -10694631.8538601411737749210189)
105 +7706425.89469333702227898720481)
106 -3467891.65261200166002554424214)
107 +963303.236836667127784873400597)
108 -157273.997850884429026101779690)
109 +13610.249814018844819566500166)
110 -504.0833264451424007246851913)
111 +4.58257569495584000658804719352 ;
112 }
113
114 printf("Error eval_line: There is no shape function %d.\n",i);
115 assert(false); abort();
116 return 0.0;
117 }
118
119 /* \nabla\phi_i(x,y) for triangle */
120 static void
121 grad_line ( const int i, DomainType xi, JacobianRangeType grad )
122 {
123 const RangeField &x = xi[0];
124
125 switch (i) {
126 case ( 0 ):
127 grad[0]= 0;
128 return;
129 case ( 1 ):
130 grad[0]= 3.46410161513775458705489268300;
131 return;
132 case ( 2 ):
133 grad[0]=26.8328157299974763569100840248*x
134 -13.4164078649987381784550420124 ;
135 return;
136 case (3):
137 grad[0]=x*( 158.745078663875435430096945218*x
138 -158.745078663875435430096945218)
139 +31.7490157327750870860193890437;
140 return;
141 case (4):
142 grad[0]=x*(x*(840.000000000000000000000000000*x
143 -1260.00000000000000000000000000)
144 +540.000000000000000000000000000)
145 -60.0000000000000000000000000000;
146 return;
147
148 case (5):
149 grad[0]=x*(x*(x*(4178.94723584780380988481524820*x
150 -8357.89447169560761976963049640)
151 +5571.92964779707174651308699762)
152 -1392.98241194926793662827174940)
153 +99.4987437106619954734479821001;
154 return;
155
156 case (6):
157 grad[0]=x*(x*(x*(x*(19989.1762711723566410529627068*x
158 -49972.9406779308916026324067670)
159 +45429.9460708462650933021879700)
160 -18171.9784283385060373208751880)
161 +3028.66307138975100622014586466)
162 -151.433153569487550311007293233;
163 return;
164 case (7):
165 grad[0]=x*(x*(x*(x*(x*( 93044.5519092869832495466719640*x
166 -279133.655727860949748640015893)
167 +322077.295070608788171507710646)
168 -178931.830594782660095282061470)
169 +48799.5901622134527532587440373)
170 -5855.95081946561433039104928446)
171 +216.887067387615345570038862388;
172 return;
173
174 case(8):
175 grad[0]=x*(x*(x*(x*(x*(x*(+424514.955213594330209612358772*x
176 -1485802.34324758015573364325570)
177 +2080123.28054661221802710055798)
178 -1485802.34324758015573364325570)
179 +571462.439710607752205247406040)
180 -114292.487942121550441049481208)
181 +10390.2261765565045855499528371)
182 -296.863605044471559587141509631;
183 return;
184 case(9):
185 grad[0 ]=x*(x*(x*(x*(x*(x*(x*(1907366.99971452793298785857650*x
186 -7629467.99885811173195143430599)
187 +12566182.5863545369702729506216)
188 -10995409.7630602198489888317939)
189 +5497704.88153010992449441589695)
190 -1570772.82329431712128411882770)
191 +241657.357429894941736018281185)
192 -17261.2398164210672668584486561)
193 +392.300904918660619701328378547;
194 return;
195 case(10):
196 grad[0]=x*(x*(x*(x*(x*(x*(x*(x*(8466583.55097261176257181247327*x
197 -38099625.9793767529315731561297)
198 +72188765.0135559529229807168774)
199 -74862422.9770209882164244471323)
200 +46238555.3681600221336739232286)
201 -17339458.2630600083001277212108)
202 +3853212.94734666851113949360238)
203 -471821.993552653287078305339067)
204 +27220.4996280376896391330003308)
205 -504.083326445142400724685191311;
206 }
207 }
208
209 }; // end struct OrthonormalBase_1d
210
211 } // end namespace Fem
212} // end namespace Dune
213#endif
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 13, 23:29, 2024)