MFEM v4.10.0
Finite element discretization library
Loading...
Searching...
No Matches
fe_fixed_order.cpp
Go to the documentation of this file.
1// Copyright (c) 2010-2026, Lawrence Livermore National Security, LLC. Produced
2// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3// LICENSE and NOTICE for details. LLNL-CODE-806117.
4//
5// This file is part of the MFEM library. For more information and source code
6// availability visit https://mfem.org.
7//
8// MFEM is free software; you can redistribute it and/or modify it under the
9// terms of the BSD-3 license. We welcome feedback and contributions, see file
10// CONTRIBUTING.md for details.
11
12// Fixed Order Finite Element classes
13
14#include "fe_fixed_order.hpp"
15#include "../coefficient.hpp"
16
17namespace mfem
18{
19
20using namespace std;
21
29
31 Vector &shape) const
32{
33 shape(0) = 1.;
34}
35
37 DenseMatrix &dshape) const
38{
39 // dshape is (1 x 0) - nothing to compute
40}
41
43 : NodalFiniteElement(1, Geometry::SEGMENT, 2, 1)
44{
45 Nodes.IntPoint(0).x = 0.0;
46 Nodes.IntPoint(1).x = 1.0;
47}
48
50 Vector &shape) const
51{
52 shape(0) = 1. - ip.x;
53 shape(1) = ip.x;
54}
55
57 DenseMatrix &dshape) const
58{
59 dshape(0,0) = -1.;
60 dshape(1,0) = 1.;
61}
62
64 DenseMatrix &h) const
65{
66 h = 0.0;
67}
68
70 : NodalFiniteElement(2, Geometry::TRIANGLE, 3, 1)
71{
72 Nodes.IntPoint(0).x = 0.0;
73 Nodes.IntPoint(0).y = 0.0;
74 Nodes.IntPoint(1).x = 1.0;
75 Nodes.IntPoint(1).y = 0.0;
76 Nodes.IntPoint(2).x = 0.0;
77 Nodes.IntPoint(2).y = 1.0;
78}
79
81 Vector &shape) const
82{
83 shape(0) = 1. - ip.x - ip.y;
84 shape(1) = ip.x;
85 shape(2) = ip.y;
86}
87
89 DenseMatrix &dshape) const
90{
91 dshape(0,0) = -1.; dshape(0,1) = -1.;
92 dshape(1,0) = 1.; dshape(1,1) = 0.;
93 dshape(2,0) = 0.; dshape(2,1) = 1.;
94}
95
97 DenseMatrix &h) const
98{
99 h = 0.0;
100}
101
103 : NodalFiniteElement(2, Geometry::SQUARE, 4, 1, FunctionSpace::Qk)
104{
105 Nodes.IntPoint(0).x = 0.0;
106 Nodes.IntPoint(0).y = 0.0;
107 Nodes.IntPoint(1).x = 1.0;
108 Nodes.IntPoint(1).y = 0.0;
109 Nodes.IntPoint(2).x = 1.0;
110 Nodes.IntPoint(2).y = 1.0;
111 Nodes.IntPoint(3).x = 0.0;
112 Nodes.IntPoint(3).y = 1.0;
113}
114
116 Vector &shape) const
117{
118 shape(0) = (1. - ip.x) * (1. - ip.y) ;
119 shape(1) = ip.x * (1. - ip.y) ;
120 shape(2) = ip.x * ip.y ;
121 shape(3) = (1. - ip.x) * ip.y ;
122}
123
125 DenseMatrix &dshape) const
126{
127 dshape(0,0) = -1. + ip.y; dshape(0,1) = -1. + ip.x ;
128 dshape(1,0) = 1. - ip.y; dshape(1,1) = -ip.x ;
129 dshape(2,0) = ip.y ; dshape(2,1) = ip.x ;
130 dshape(3,0) = -ip.y ; dshape(3,1) = 1. - ip.x ;
131}
132
134 const IntegrationPoint &ip, DenseMatrix &h) const
135{
136 h(0,0) = 0.; h(0,1) = 1.; h(0,2) = 0.;
137 h(1,0) = 0.; h(1,1) = -1.; h(1,2) = 0.;
138 h(2,0) = 0.; h(2,1) = 1.; h(2,2) = 0.;
139 h(3,0) = 0.; h(3,1) = -1.; h(3,2) = 0.;
140}
141
142
144 : NodalFiniteElement(2, Geometry::TRIANGLE, 3, 1, FunctionSpace::Pk)
145{
146 Nodes.IntPoint(0).x = 1./6.;
147 Nodes.IntPoint(0).y = 1./6.;
148 Nodes.IntPoint(1).x = 2./3.;
149 Nodes.IntPoint(1).y = 1./6.;
150 Nodes.IntPoint(2).x = 1./6.;
151 Nodes.IntPoint(2).y = 2./3.;
152}
153
155 Vector &shape) const
156{
157 const real_t x = ip.x, y = ip.y;
158
159 shape(0) = 5./3. - 2. * (x + y);
160 shape(1) = 2. * (x - 1./6.);
161 shape(2) = 2. * (y - 1./6.);
162}
163
165 DenseMatrix &dshape) const
166{
167 dshape(0,0) = -2.; dshape(0,1) = -2.;
168 dshape(1,0) = 2.; dshape(1,1) = 0.;
169 dshape(2,0) = 0.; dshape(2,1) = 2.;
170}
171
173{
174 dofs(vertex) = 2./3.;
175 dofs((vertex+1)%3) = 1./6.;
176 dofs((vertex+2)%3) = 1./6.;
177}
178
179
180// 0.5-0.5/sqrt(3) and 0.5+0.5/sqrt(3)
181const real_t GaussBiLinear2DFiniteElement::p[] =
182{ 0.2113248654051871177454256, 0.7886751345948128822545744 };
183
185 : NodalFiniteElement(2, Geometry::SQUARE, 4, 1, FunctionSpace::Qk)
186{
187 Nodes.IntPoint(0).x = p[0];
188 Nodes.IntPoint(0).y = p[0];
189 Nodes.IntPoint(1).x = p[1];
190 Nodes.IntPoint(1).y = p[0];
191 Nodes.IntPoint(2).x = p[1];
192 Nodes.IntPoint(2).y = p[1];
193 Nodes.IntPoint(3).x = p[0];
194 Nodes.IntPoint(3).y = p[1];
195}
196
198 Vector &shape) const
199{
200 const real_t x = ip.x, y = ip.y;
201
202 shape(0) = 3. * (p[1] - x) * (p[1] - y);
203 shape(1) = 3. * (x - p[0]) * (p[1] - y);
204 shape(2) = 3. * (x - p[0]) * (y - p[0]);
205 shape(3) = 3. * (p[1] - x) * (y - p[0]);
206}
207
209 DenseMatrix &dshape) const
210{
211 const real_t x = ip.x, y = ip.y;
212
213 dshape(0,0) = 3. * (y - p[1]); dshape(0,1) = 3. * (x - p[1]);
214 dshape(1,0) = 3. * (p[1] - y); dshape(1,1) = 3. * (p[0] - x);
215 dshape(2,0) = 3. * (y - p[0]); dshape(2,1) = 3. * (x - p[0]);
216 dshape(3,0) = 3. * (p[0] - y); dshape(3,1) = 3. * (p[1] - x);
217}
218
220{
221#if 1
222 dofs(vertex) = p[1]*p[1];
223 dofs((vertex+1)%4) = p[0]*p[1];
224 dofs((vertex+2)%4) = p[0]*p[0];
225 dofs((vertex+3)%4) = p[0]*p[1];
226#else
227 dofs = 1.0;
228#endif
229}
230
231
233 : NodalFiniteElement(2, Geometry::SQUARE, 3, 1, FunctionSpace::Qk)
234{
235 Nodes.IntPoint(0).x = 0.0;
236 Nodes.IntPoint(0).y = 0.0;
237 Nodes.IntPoint(1).x = 1.0;
238 Nodes.IntPoint(1).y = 0.0;
239 Nodes.IntPoint(2).x = 0.0;
240 Nodes.IntPoint(2).y = 1.0;
241}
242
244 Vector &shape) const
245{
246 shape(0) = 1. - ip.x - ip.y;
247 shape(1) = ip.x;
248 shape(2) = ip.y;
249}
250
252 DenseMatrix &dshape) const
253{
254 dshape(0,0) = -1.; dshape(0,1) = -1.;
255 dshape(1,0) = 1.; dshape(1,1) = 0.;
256 dshape(2,0) = 0.; dshape(2,1) = 1.;
257}
258
259
261 : NodalFiniteElement(1, Geometry::SEGMENT, 3, 2)
262{
263 Nodes.IntPoint(0).x = 0.0;
264 Nodes.IntPoint(1).x = 1.0;
265 Nodes.IntPoint(2).x = 0.5;
266}
267
269 Vector &shape) const
270{
271 real_t x = ip.x;
272 real_t l1 = 1.0 - x, l2 = x, l3 = 2. * x - 1.;
273
274 shape(0) = l1 * (-l3);
275 shape(1) = l2 * l3;
276 shape(2) = 4. * l1 * l2;
277}
278
280 DenseMatrix &dshape) const
281{
282 real_t x = ip.x;
283
284 dshape(0,0) = 4. * x - 3.;
285 dshape(1,0) = 4. * x - 1.;
286 dshape(2,0) = 4. - 8. * x;
287}
288
289
291 : NodalFiniteElement(2, Geometry::TRIANGLE, 6, 2)
292{
293 Nodes.IntPoint(0).x = 0.0;
294 Nodes.IntPoint(0).y = 0.0;
295 Nodes.IntPoint(1).x = 1.0;
296 Nodes.IntPoint(1).y = 0.0;
297 Nodes.IntPoint(2).x = 0.0;
298 Nodes.IntPoint(2).y = 1.0;
299 Nodes.IntPoint(3).x = 0.5;
300 Nodes.IntPoint(3).y = 0.0;
301 Nodes.IntPoint(4).x = 0.5;
302 Nodes.IntPoint(4).y = 0.5;
303 Nodes.IntPoint(5).x = 0.0;
304 Nodes.IntPoint(5).y = 0.5;
305}
306
308 Vector &shape) const
309{
310 real_t x = ip.x, y = ip.y;
311 real_t l1 = 1.-x-y, l2 = x, l3 = y;
312
313 shape(0) = l1 * (2. * l1 - 1.);
314 shape(1) = l2 * (2. * l2 - 1.);
315 shape(2) = l3 * (2. * l3 - 1.);
316 shape(3) = 4. * l1 * l2;
317 shape(4) = 4. * l2 * l3;
318 shape(5) = 4. * l3 * l1;
319}
320
322 DenseMatrix &dshape) const
323{
324 real_t x = ip.x, y = ip.y;
325
326 dshape(0,0) =
327 dshape(0,1) = 4. * (x + y) - 3.;
328
329 dshape(1,0) = 4. * x - 1.;
330 dshape(1,1) = 0.;
331
332 dshape(2,0) = 0.;
333 dshape(2,1) = 4. * y - 1.;
334
335 dshape(3,0) = -4. * (2. * x + y - 1.);
336 dshape(3,1) = -4. * x;
337
338 dshape(4,0) = 4. * y;
339 dshape(4,1) = 4. * x;
340
341 dshape(5,0) = -4. * y;
342 dshape(5,1) = -4. * (x + 2. * y - 1.);
343}
344
346 DenseMatrix &h) const
347{
348 h(0,0) = 4.;
349 h(0,1) = 4.;
350 h(0,2) = 4.;
351
352 h(1,0) = 4.;
353 h(1,1) = 0.;
354 h(1,2) = 0.;
355
356 h(2,0) = 0.;
357 h(2,1) = 0.;
358 h(2,2) = 4.;
359
360 h(3,0) = -8.;
361 h(3,1) = -4.;
362 h(3,2) = 0.;
363
364 h(4,0) = 0.;
365 h(4,1) = 4.;
366 h(4,2) = 0.;
367
368 h(5,0) = 0.;
369 h(5,1) = -4.;
370 h(5,2) = -8.;
371}
372
373void Quad2DFiniteElement::ProjectDelta(int vertex, Vector &dofs) const
374{
375#if 0
376 dofs = 1.;
377#else
378 dofs = 0.;
379 dofs(vertex) = 1.;
380 switch (vertex)
381 {
382 case 0: dofs(3) = 0.25; dofs(5) = 0.25; break;
383 case 1: dofs(3) = 0.25; dofs(4) = 0.25; break;
384 case 2: dofs(4) = 0.25; dofs(5) = 0.25; break;
385 }
386#endif
387}
388
389
390const real_t GaussQuad2DFiniteElement::p[] =
391{ 0.0915762135097707434595714634022015, 0.445948490915964886318329253883051 };
392
394 : NodalFiniteElement(2, Geometry::TRIANGLE, 6, 2), A(6), D(6,2), pol(6)
395{
396 Nodes.IntPoint(0).x = p[0];
397 Nodes.IntPoint(0).y = p[0];
398 Nodes.IntPoint(1).x = 1. - 2. * p[0];
399 Nodes.IntPoint(1).y = p[0];
400 Nodes.IntPoint(2).x = p[0];
401 Nodes.IntPoint(2).y = 1. - 2. * p[0];
402 Nodes.IntPoint(3).x = p[1];
403 Nodes.IntPoint(3).y = p[1];
404 Nodes.IntPoint(4).x = 1. - 2. * p[1];
405 Nodes.IntPoint(4).y = p[1];
406 Nodes.IntPoint(5).x = p[1];
407 Nodes.IntPoint(5).y = 1. - 2. * p[1];
408
409 for (int i = 0; i < 6; i++)
410 {
411 const real_t x = Nodes.IntPoint(i).x, y = Nodes.IntPoint(i).y;
412 A(0,i) = 1.;
413 A(1,i) = x;
414 A(2,i) = y;
415 A(3,i) = x * x;
416 A(4,i) = x * y;
417 A(5,i) = y * y;
418 }
419
420 A.Invert();
421}
422
424 Vector &shape) const
425{
426 const real_t x = ip.x, y = ip.y;
427 pol(0) = 1.;
428 pol(1) = x;
429 pol(2) = y;
430 pol(3) = x * x;
431 pol(4) = x * y;
432 pol(5) = y * y;
433
434 A.Mult(pol, shape);
435}
436
438 DenseMatrix &dshape) const
439{
440 const real_t x = ip.x, y = ip.y;
441 D(0,0) = 0.; D(0,1) = 0.;
442 D(1,0) = 1.; D(1,1) = 0.;
443 D(2,0) = 0.; D(2,1) = 1.;
444 D(3,0) = 2. * x; D(3,1) = 0.;
445 D(4,0) = y; D(4,1) = x;
446 D(5,0) = 0.; D(5,1) = 2. * y;
447
448 Mult(A, D, dshape);
449}
450
451
453 : NodalFiniteElement(2, Geometry::SQUARE, 9, 2, FunctionSpace::Qk)
454{
455 Nodes.IntPoint(0).x = 0.0;
456 Nodes.IntPoint(0).y = 0.0;
457 Nodes.IntPoint(1).x = 1.0;
458 Nodes.IntPoint(1).y = 0.0;
459 Nodes.IntPoint(2).x = 1.0;
460 Nodes.IntPoint(2).y = 1.0;
461 Nodes.IntPoint(3).x = 0.0;
462 Nodes.IntPoint(3).y = 1.0;
463 Nodes.IntPoint(4).x = 0.5;
464 Nodes.IntPoint(4).y = 0.0;
465 Nodes.IntPoint(5).x = 1.0;
466 Nodes.IntPoint(5).y = 0.5;
467 Nodes.IntPoint(6).x = 0.5;
468 Nodes.IntPoint(6).y = 1.0;
469 Nodes.IntPoint(7).x = 0.0;
470 Nodes.IntPoint(7).y = 0.5;
471 Nodes.IntPoint(8).x = 0.5;
472 Nodes.IntPoint(8).y = 0.5;
473}
474
476 Vector &shape) const
477{
478 real_t x = ip.x, y = ip.y;
479 real_t l1x, l2x, l3x, l1y, l2y, l3y;
480
481 l1x = (x - 1.) * (2. * x - 1);
482 l2x = 4. * x * (1. - x);
483 l3x = x * (2. * x - 1.);
484 l1y = (y - 1.) * (2. * y - 1);
485 l2y = 4. * y * (1. - y);
486 l3y = y * (2. * y - 1.);
487
488 shape(0) = l1x * l1y;
489 shape(4) = l2x * l1y;
490 shape(1) = l3x * l1y;
491 shape(7) = l1x * l2y;
492 shape(8) = l2x * l2y;
493 shape(5) = l3x * l2y;
494 shape(3) = l1x * l3y;
495 shape(6) = l2x * l3y;
496 shape(2) = l3x * l3y;
497}
498
500 DenseMatrix &dshape) const
501{
502 real_t x = ip.x, y = ip.y;
503 real_t l1x, l2x, l3x, l1y, l2y, l3y;
504 real_t d1x, d2x, d3x, d1y, d2y, d3y;
505
506 l1x = (x - 1.) * (2. * x - 1);
507 l2x = 4. * x * (1. - x);
508 l3x = x * (2. * x - 1.);
509 l1y = (y - 1.) * (2. * y - 1);
510 l2y = 4. * y * (1. - y);
511 l3y = y * (2. * y - 1.);
512
513 d1x = 4. * x - 3.;
514 d2x = 4. - 8. * x;
515 d3x = 4. * x - 1.;
516 d1y = 4. * y - 3.;
517 d2y = 4. - 8. * y;
518 d3y = 4. * y - 1.;
519
520 dshape(0,0) = d1x * l1y;
521 dshape(0,1) = l1x * d1y;
522
523 dshape(4,0) = d2x * l1y;
524 dshape(4,1) = l2x * d1y;
525
526 dshape(1,0) = d3x * l1y;
527 dshape(1,1) = l3x * d1y;
528
529 dshape(7,0) = d1x * l2y;
530 dshape(7,1) = l1x * d2y;
531
532 dshape(8,0) = d2x * l2y;
533 dshape(8,1) = l2x * d2y;
534
535 dshape(5,0) = d3x * l2y;
536 dshape(5,1) = l3x * d2y;
537
538 dshape(3,0) = d1x * l3y;
539 dshape(3,1) = l1x * d3y;
540
541 dshape(6,0) = d2x * l3y;
542 dshape(6,1) = l2x * d3y;
543
544 dshape(2,0) = d3x * l3y;
545 dshape(2,1) = l3x * d3y;
546}
547
548void BiQuad2DFiniteElement::ProjectDelta(int vertex, Vector &dofs) const
549{
550#if 0
551 dofs = 1.;
552#else
553 dofs = 0.;
554 dofs(vertex) = 1.;
555 switch (vertex)
556 {
557 case 0: dofs(4) = 0.25; dofs(7) = 0.25; break;
558 case 1: dofs(4) = 0.25; dofs(5) = 0.25; break;
559 case 2: dofs(5) = 0.25; dofs(6) = 0.25; break;
560 case 3: dofs(6) = 0.25; dofs(7) = 0.25; break;
561 }
562 dofs(8) = 1./16.;
563#endif
564}
565
566
568 : NodalFiniteElement(2, Geometry::SQUARE, 9, 2, FunctionSpace::Qk)
569{
570 const real_t p1 = 0.5*(1.-sqrt(3./5.));
571
572 Nodes.IntPoint(0).x = p1;
573 Nodes.IntPoint(0).y = p1;
574 Nodes.IntPoint(4).x = 0.5;
575 Nodes.IntPoint(4).y = p1;
576 Nodes.IntPoint(1).x = 1.-p1;
577 Nodes.IntPoint(1).y = p1;
578 Nodes.IntPoint(7).x = p1;
579 Nodes.IntPoint(7).y = 0.5;
580 Nodes.IntPoint(8).x = 0.5;
581 Nodes.IntPoint(8).y = 0.5;
582 Nodes.IntPoint(5).x = 1.-p1;
583 Nodes.IntPoint(5).y = 0.5;
584 Nodes.IntPoint(3).x = p1;
585 Nodes.IntPoint(3).y = 1.-p1;
586 Nodes.IntPoint(6).x = 0.5;
587 Nodes.IntPoint(6).y = 1.-p1;
588 Nodes.IntPoint(2).x = 1.-p1;
589 Nodes.IntPoint(2).y = 1.-p1;
590}
591
593 Vector &shape) const
594{
595 const real_t a = sqrt(5./3.);
596 const real_t p1 = 0.5*(1.-sqrt(3./5.));
597
598 real_t x = a*(ip.x-p1), y = a*(ip.y-p1);
599 real_t l1x, l2x, l3x, l1y, l2y, l3y;
600
601 l1x = (x - 1.) * (2. * x - 1);
602 l2x = 4. * x * (1. - x);
603 l3x = x * (2. * x - 1.);
604 l1y = (y - 1.) * (2. * y - 1);
605 l2y = 4. * y * (1. - y);
606 l3y = y * (2. * y - 1.);
607
608 shape(0) = l1x * l1y;
609 shape(4) = l2x * l1y;
610 shape(1) = l3x * l1y;
611 shape(7) = l1x * l2y;
612 shape(8) = l2x * l2y;
613 shape(5) = l3x * l2y;
614 shape(3) = l1x * l3y;
615 shape(6) = l2x * l3y;
616 shape(2) = l3x * l3y;
617}
618
620 DenseMatrix &dshape) const
621{
622 const real_t a = sqrt(5./3.);
623 const real_t p1 = 0.5*(1.-sqrt(3./5.));
624
625 real_t x = a*(ip.x-p1), y = a*(ip.y-p1);
626 real_t l1x, l2x, l3x, l1y, l2y, l3y;
627 real_t d1x, d2x, d3x, d1y, d2y, d3y;
628
629 l1x = (x - 1.) * (2. * x - 1);
630 l2x = 4. * x * (1. - x);
631 l3x = x * (2. * x - 1.);
632 l1y = (y - 1.) * (2. * y - 1);
633 l2y = 4. * y * (1. - y);
634 l3y = y * (2. * y - 1.);
635
636 d1x = a * (4. * x - 3.);
637 d2x = a * (4. - 8. * x);
638 d3x = a * (4. * x - 1.);
639 d1y = a * (4. * y - 3.);
640 d2y = a * (4. - 8. * y);
641 d3y = a * (4. * y - 1.);
642
643 dshape(0,0) = d1x * l1y;
644 dshape(0,1) = l1x * d1y;
645
646 dshape(4,0) = d2x * l1y;
647 dshape(4,1) = l2x * d1y;
648
649 dshape(1,0) = d3x * l1y;
650 dshape(1,1) = l3x * d1y;
651
652 dshape(7,0) = d1x * l2y;
653 dshape(7,1) = l1x * d2y;
654
655 dshape(8,0) = d2x * l2y;
656 dshape(8,1) = l2x * d2y;
657
658 dshape(5,0) = d3x * l2y;
659 dshape(5,1) = l3x * d2y;
660
661 dshape(3,0) = d1x * l3y;
662 dshape(3,1) = l1x * d3y;
663
664 dshape(6,0) = d2x * l3y;
665 dshape(6,1) = l2x * d3y;
666
667 dshape(2,0) = d3x * l3y;
668 dshape(2,1) = l3x * d3y;
669}
670
672 : NodalFiniteElement (2, Geometry::SQUARE, 16, 3, FunctionSpace::Qk)
673{
674 Nodes.IntPoint(0).x = 0.;
675 Nodes.IntPoint(0).y = 0.;
676 Nodes.IntPoint(1).x = 1.;
677 Nodes.IntPoint(1).y = 0.;
678 Nodes.IntPoint(2).x = 1.;
679 Nodes.IntPoint(2).y = 1.;
680 Nodes.IntPoint(3).x = 0.;
681 Nodes.IntPoint(3).y = 1.;
682 Nodes.IntPoint(4).x = 1./3.;
683 Nodes.IntPoint(4).y = 0.;
684 Nodes.IntPoint(5).x = 2./3.;
685 Nodes.IntPoint(5).y = 0.;
686 Nodes.IntPoint(6).x = 1.;
687 Nodes.IntPoint(6).y = 1./3.;
688 Nodes.IntPoint(7).x = 1.;
689 Nodes.IntPoint(7).y = 2./3.;
690 Nodes.IntPoint(8).x = 2./3.;
691 Nodes.IntPoint(8).y = 1.;
692 Nodes.IntPoint(9).x = 1./3.;
693 Nodes.IntPoint(9).y = 1.;
694 Nodes.IntPoint(10).x = 0.;
695 Nodes.IntPoint(10).y = 2./3.;
696 Nodes.IntPoint(11).x = 0.;
697 Nodes.IntPoint(11).y = 1./3.;
698 Nodes.IntPoint(12).x = 1./3.;
699 Nodes.IntPoint(12).y = 1./3.;
700 Nodes.IntPoint(13).x = 2./3.;
701 Nodes.IntPoint(13).y = 1./3.;
702 Nodes.IntPoint(14).x = 1./3.;
703 Nodes.IntPoint(14).y = 2./3.;
704 Nodes.IntPoint(15).x = 2./3.;
705 Nodes.IntPoint(15).y = 2./3.;
706}
707
709 const IntegrationPoint &ip, Vector &shape) const
710{
711 real_t x = ip.x, y = ip.y;
712
713 real_t w1x, w2x, w3x, w1y, w2y, w3y;
714 real_t l0x, l1x, l2x, l3x, l0y, l1y, l2y, l3y;
715
716 w1x = x - 1./3.; w2x = x - 2./3.; w3x = x - 1.;
717 w1y = y - 1./3.; w2y = y - 2./3.; w3y = y - 1.;
718
719 l0x = (- 4.5) * w1x * w2x * w3x;
720 l1x = ( 13.5) * x * w2x * w3x;
721 l2x = (-13.5) * x * w1x * w3x;
722 l3x = ( 4.5) * x * w1x * w2x;
723
724 l0y = (- 4.5) * w1y * w2y * w3y;
725 l1y = ( 13.5) * y * w2y * w3y;
726 l2y = (-13.5) * y * w1y * w3y;
727 l3y = ( 4.5) * y * w1y * w2y;
728
729 shape(0) = l0x * l0y;
730 shape(1) = l3x * l0y;
731 shape(2) = l3x * l3y;
732 shape(3) = l0x * l3y;
733 shape(4) = l1x * l0y;
734 shape(5) = l2x * l0y;
735 shape(6) = l3x * l1y;
736 shape(7) = l3x * l2y;
737 shape(8) = l2x * l3y;
738 shape(9) = l1x * l3y;
739 shape(10) = l0x * l2y;
740 shape(11) = l0x * l1y;
741 shape(12) = l1x * l1y;
742 shape(13) = l2x * l1y;
743 shape(14) = l1x * l2y;
744 shape(15) = l2x * l2y;
745}
746
748 const IntegrationPoint &ip, DenseMatrix &dshape) const
749{
750 real_t x = ip.x, y = ip.y;
751
752 real_t w1x, w2x, w3x, w1y, w2y, w3y;
753 real_t l0x, l1x, l2x, l3x, l0y, l1y, l2y, l3y;
754 real_t d0x, d1x, d2x, d3x, d0y, d1y, d2y, d3y;
755
756 w1x = x - 1./3.; w2x = x - 2./3.; w3x = x - 1.;
757 w1y = y - 1./3.; w2y = y - 2./3.; w3y = y - 1.;
758
759 l0x = (- 4.5) * w1x * w2x * w3x;
760 l1x = ( 13.5) * x * w2x * w3x;
761 l2x = (-13.5) * x * w1x * w3x;
762 l3x = ( 4.5) * x * w1x * w2x;
763
764 l0y = (- 4.5) * w1y * w2y * w3y;
765 l1y = ( 13.5) * y * w2y * w3y;
766 l2y = (-13.5) * y * w1y * w3y;
767 l3y = ( 4.5) * y * w1y * w2y;
768
769 d0x = -5.5 + ( 18. - 13.5 * x) * x;
770 d1x = 9. + (-45. + 40.5 * x) * x;
771 d2x = -4.5 + ( 36. - 40.5 * x) * x;
772 d3x = 1. + (- 9. + 13.5 * x) * x;
773
774 d0y = -5.5 + ( 18. - 13.5 * y) * y;
775 d1y = 9. + (-45. + 40.5 * y) * y;
776 d2y = -4.5 + ( 36. - 40.5 * y) * y;
777 d3y = 1. + (- 9. + 13.5 * y) * y;
778
779 dshape( 0,0) = d0x * l0y; dshape( 0,1) = l0x * d0y;
780 dshape( 1,0) = d3x * l0y; dshape( 1,1) = l3x * d0y;
781 dshape( 2,0) = d3x * l3y; dshape( 2,1) = l3x * d3y;
782 dshape( 3,0) = d0x * l3y; dshape( 3,1) = l0x * d3y;
783 dshape( 4,0) = d1x * l0y; dshape( 4,1) = l1x * d0y;
784 dshape( 5,0) = d2x * l0y; dshape( 5,1) = l2x * d0y;
785 dshape( 6,0) = d3x * l1y; dshape( 6,1) = l3x * d1y;
786 dshape( 7,0) = d3x * l2y; dshape( 7,1) = l3x * d2y;
787 dshape( 8,0) = d2x * l3y; dshape( 8,1) = l2x * d3y;
788 dshape( 9,0) = d1x * l3y; dshape( 9,1) = l1x * d3y;
789 dshape(10,0) = d0x * l2y; dshape(10,1) = l0x * d2y;
790 dshape(11,0) = d0x * l1y; dshape(11,1) = l0x * d1y;
791 dshape(12,0) = d1x * l1y; dshape(12,1) = l1x * d1y;
792 dshape(13,0) = d2x * l1y; dshape(13,1) = l2x * d1y;
793 dshape(14,0) = d1x * l2y; dshape(14,1) = l1x * d2y;
794 dshape(15,0) = d2x * l2y; dshape(15,1) = l2x * d2y;
795}
796
798 const IntegrationPoint &ip, DenseMatrix &h) const
799{
800 real_t x = ip.x, y = ip.y;
801
802 real_t w1x, w2x, w3x, w1y, w2y, w3y;
803 real_t l0x, l1x, l2x, l3x, l0y, l1y, l2y, l3y;
804 real_t d0x, d1x, d2x, d3x, d0y, d1y, d2y, d3y;
805 real_t h0x, h1x, h2x, h3x, h0y, h1y, h2y, h3y;
806
807 w1x = x - 1./3.; w2x = x - 2./3.; w3x = x - 1.;
808 w1y = y - 1./3.; w2y = y - 2./3.; w3y = y - 1.;
809
810 l0x = (- 4.5) * w1x * w2x * w3x;
811 l1x = ( 13.5) * x * w2x * w3x;
812 l2x = (-13.5) * x * w1x * w3x;
813 l3x = ( 4.5) * x * w1x * w2x;
814
815 l0y = (- 4.5) * w1y * w2y * w3y;
816 l1y = ( 13.5) * y * w2y * w3y;
817 l2y = (-13.5) * y * w1y * w3y;
818 l3y = ( 4.5) * y * w1y * w2y;
819
820 d0x = -5.5 + ( 18. - 13.5 * x) * x;
821 d1x = 9. + (-45. + 40.5 * x) * x;
822 d2x = -4.5 + ( 36. - 40.5 * x) * x;
823 d3x = 1. + (- 9. + 13.5 * x) * x;
824
825 d0y = -5.5 + ( 18. - 13.5 * y) * y;
826 d1y = 9. + (-45. + 40.5 * y) * y;
827 d2y = -4.5 + ( 36. - 40.5 * y) * y;
828 d3y = 1. + (- 9. + 13.5 * y) * y;
829
830 h0x = -27. * x + 18.;
831 h1x = 81. * x - 45.;
832 h2x = -81. * x + 36.;
833 h3x = 27. * x - 9.;
834
835 h0y = -27. * y + 18.;
836 h1y = 81. * y - 45.;
837 h2y = -81. * y + 36.;
838 h3y = 27. * y - 9.;
839
840 h( 0,0) = h0x * l0y; h( 0,1) = d0x * d0y; h( 0,2) = l0x * h0y;
841 h( 1,0) = h3x * l0y; h( 1,1) = d3x * d0y; h( 1,2) = l3x * h0y;
842 h( 2,0) = h3x * l3y; h( 2,1) = d3x * d3y; h( 2,2) = l3x * h3y;
843 h( 3,0) = h0x * l3y; h( 3,1) = d0x * d3y; h( 3,2) = l0x * h3y;
844 h( 4,0) = h1x * l0y; h( 4,1) = d1x * d0y; h( 4,2) = l1x * h0y;
845 h( 5,0) = h2x * l0y; h( 5,1) = d2x * d0y; h( 5,2) = l2x * h0y;
846 h( 6,0) = h3x * l1y; h( 6,1) = d3x * d1y; h( 6,2) = l3x * h1y;
847 h( 7,0) = h3x * l2y; h( 7,1) = d3x * d2y; h( 7,2) = l3x * h2y;
848 h( 8,0) = h2x * l3y; h( 8,1) = d2x * d3y; h( 8,2) = l2x * h3y;
849 h( 9,0) = h1x * l3y; h( 9,1) = d1x * d3y; h( 9,2) = l1x * h3y;
850 h(10,0) = h0x * l2y; h(10,1) = d0x * d2y; h(10,2) = l0x * h2y;
851 h(11,0) = h0x * l1y; h(11,1) = d0x * d1y; h(11,2) = l0x * h1y;
852 h(12,0) = h1x * l1y; h(12,1) = d1x * d1y; h(12,2) = l1x * h1y;
853 h(13,0) = h2x * l1y; h(13,1) = d2x * d1y; h(13,2) = l2x * h1y;
854 h(14,0) = h1x * l2y; h(14,1) = d1x * d2y; h(14,2) = l1x * h2y;
855 h(15,0) = h2x * l2y; h(15,1) = d2x * d2y; h(15,2) = l2x * h2y;
856}
857
858
860 : NodalFiniteElement(1, Geometry::SEGMENT, 4, 3)
861{
862 Nodes.IntPoint(0).x = 0.0;
863 Nodes.IntPoint(1).x = 1.0;
864 Nodes.IntPoint(2).x = 0.33333333333333333333;
865 Nodes.IntPoint(3).x = 0.66666666666666666667;
866}
867
869 Vector &shape) const
870{
871 real_t x = ip.x;
872 real_t l1 = x,
873 l2 = (1.0-x),
874 l3 = (0.33333333333333333333-x),
875 l4 = (0.66666666666666666667-x);
876
877 shape(0) = 4.5 * l2 * l3 * l4;
878 shape(1) = 4.5 * l1 * l3 * l4;
879 shape(2) = 13.5 * l1 * l2 * l4;
880 shape(3) = -13.5 * l1 * l2 * l3;
881}
882
884 DenseMatrix &dshape) const
885{
886 real_t x = ip.x;
887
888 dshape(0,0) = -5.5 + x * (18. - 13.5 * x);
889 dshape(1,0) = 1. - x * (9. - 13.5 * x);
890 dshape(2,0) = 9. - x * (45. - 40.5 * x);
891 dshape(3,0) = -4.5 + x * (36. - 40.5 * x);
892}
893
894
896 : NodalFiniteElement(2, Geometry::TRIANGLE, 10, 3)
897{
898 Nodes.IntPoint(0).x = 0.0;
899 Nodes.IntPoint(0).y = 0.0;
900 Nodes.IntPoint(1).x = 1.0;
901 Nodes.IntPoint(1).y = 0.0;
902 Nodes.IntPoint(2).x = 0.0;
903 Nodes.IntPoint(2).y = 1.0;
904 Nodes.IntPoint(3).x = 0.33333333333333333333;
905 Nodes.IntPoint(3).y = 0.0;
906 Nodes.IntPoint(4).x = 0.66666666666666666667;
907 Nodes.IntPoint(4).y = 0.0;
908 Nodes.IntPoint(5).x = 0.66666666666666666667;
909 Nodes.IntPoint(5).y = 0.33333333333333333333;
910 Nodes.IntPoint(6).x = 0.33333333333333333333;
911 Nodes.IntPoint(6).y = 0.66666666666666666667;
912 Nodes.IntPoint(7).x = 0.0;
913 Nodes.IntPoint(7).y = 0.66666666666666666667;
914 Nodes.IntPoint(8).x = 0.0;
915 Nodes.IntPoint(8).y = 0.33333333333333333333;
916 Nodes.IntPoint(9).x = 0.33333333333333333333;
917 Nodes.IntPoint(9).y = 0.33333333333333333333;
918}
919
921 Vector &shape) const
922{
923 real_t x = ip.x, y = ip.y;
924 real_t l1 = (-1. + x + y),
925 lx = (-1. + 3.*x),
926 ly = (-1. + 3.*y);
927
928 shape(0) = -0.5*l1*(3.*l1 + 1.)*(3.*l1 + 2.);
929 shape(1) = 0.5*x*(lx - 1.)*lx;
930 shape(2) = 0.5*y*(-1. + ly)*ly;
931 shape(3) = 4.5*x*l1*(3.*l1 + 1.);
932 shape(4) = -4.5*x*lx*l1;
933 shape(5) = 4.5*x*lx*y;
934 shape(6) = 4.5*x*y*ly;
935 shape(7) = -4.5*y*l1*ly;
936 shape(8) = 4.5*y*l1*(1. + 3.*l1);
937 shape(9) = -27.*x*y*l1;
938}
939
941 DenseMatrix &dshape) const
942{
943 real_t x = ip.x, y = ip.y;
944
945 dshape(0,0) = 0.5*(-11. + 36.*y - 9.*(x*(-4. + 3.*x) + 6.*x*y + 3.*y*y));
946 dshape(1,0) = 1. + 4.5*x*(-2. + 3.*x);
947 dshape(2,0) = 0.;
948 dshape(3,0) = 4.5*(2. + 9.*x*x - 5.*y + 3.*y*y + 2.*x*(-5. + 6.*y));
949 dshape(4,0) = -4.5*(1. - 1.*y + x*(-8. + 9.*x + 6.*y));
950 dshape(5,0) = 4.5*(-1. + 6.*x)*y;
951 dshape(6,0) = 4.5*y*(-1. + 3.*y);
952 dshape(7,0) = 4.5*(1. - 3.*y)*y;
953 dshape(8,0) = 4.5*y*(-5. + 6.*x + 6.*y);
954 dshape(9,0) = -27.*y*(-1. + 2.*x + y);
955
956 dshape(0,1) = 0.5*(-11. + 36.*y - 9.*(x*(-4. + 3.*x) + 6.*x*y + 3.*y*y));
957 dshape(1,1) = 0.;
958 dshape(2,1) = 1. + 4.5*y*(-2. + 3.*y);
959 dshape(3,1) = 4.5*x*(-5. + 6.*x + 6.*y);
960 dshape(4,1) = 4.5*(1. - 3.*x)*x;
961 dshape(5,1) = 4.5*x*(-1. + 3.*x);
962 dshape(6,1) = 4.5*x*(-1. + 6.*y);
963 dshape(7,1) = -4.5*(1. + x*(-1. + 6.*y) + y*(-8. + 9.*y));
964 dshape(8,1) = 4.5*(2. + 3.*x*x + y*(-10. + 9.*y) + x*(-5. + 12.*y));
965 dshape(9,1) = -27.*x*(-1. + x + 2.*y);
966}
967
969 DenseMatrix &h) const
970{
971 real_t x = ip.x, y = ip.y;
972
973 h(0,0) = 18.-27.*(x+y);
974 h(0,1) = 18.-27.*(x+y);
975 h(0,2) = 18.-27.*(x+y);
976
977 h(1,0) = -9.+27.*x;
978 h(1,1) = 0.;
979 h(1,2) = 0.;
980
981 h(2,0) = 0.;
982 h(2,1) = 0.;
983 h(2,2) = -9.+27.*y;
984
985 h(3,0) = -45.+81.*x+54.*y;
986 h(3,1) = -22.5+54.*x+27.*y;
987 h(3,2) = 27.*x;
988
989 h(4,0) = 36.-81.*x-27.*y;
990 h(4,1) = 4.5-27.*x;
991 h(4,2) = 0.;
992
993 h(5,0) = 27.*y;
994 h(5,1) = -4.5+27.*x;
995 h(5,2) = 0.;
996
997 h(6,0) = 0.;
998 h(6,1) = -4.5+27.*y;
999 h(6,2) = 27.*x;
1000
1001 h(7,0) = 0.;
1002 h(7,1) = 4.5-27.*y;
1003 h(7,2) = 36.-27.*x-81.*y;
1004
1005 h(8,0) = 27.*y;
1006 h(8,1) = -22.5+27.*x+54.*y;
1007 h(8,2) = -45.+54.*x+81.*y;
1008
1009 h(9,0) = -54.*y;
1010 h(9,1) = 27.-54.*(x+y);
1011 h(9,2) = -54.*x;
1012}
1013
1014
1016 : NodalFiniteElement(3, Geometry::TETRAHEDRON, 20, 3)
1017{
1018 Nodes.IntPoint(0).x = 0;
1019 Nodes.IntPoint(0).y = 0;
1020 Nodes.IntPoint(0).z = 0;
1021 Nodes.IntPoint(1).x = 1.;
1022 Nodes.IntPoint(1).y = 0;
1023 Nodes.IntPoint(1).z = 0;
1024 Nodes.IntPoint(2).x = 0;
1025 Nodes.IntPoint(2).y = 1.;
1026 Nodes.IntPoint(2).z = 0;
1027 Nodes.IntPoint(3).x = 0;
1028 Nodes.IntPoint(3).y = 0;
1029 Nodes.IntPoint(3).z = 1.;
1030 Nodes.IntPoint(4).x = 0.3333333333333333333333333333;
1031 Nodes.IntPoint(4).y = 0;
1032 Nodes.IntPoint(4).z = 0;
1033 Nodes.IntPoint(5).x = 0.6666666666666666666666666667;
1034 Nodes.IntPoint(5).y = 0;
1035 Nodes.IntPoint(5).z = 0;
1036 Nodes.IntPoint(6).x = 0;
1037 Nodes.IntPoint(6).y = 0.3333333333333333333333333333;
1038 Nodes.IntPoint(6).z = 0;
1039 Nodes.IntPoint(7).x = 0;
1040 Nodes.IntPoint(7).y = 0.6666666666666666666666666667;
1041 Nodes.IntPoint(7).z = 0;
1042 Nodes.IntPoint(8).x = 0;
1043 Nodes.IntPoint(8).y = 0;
1044 Nodes.IntPoint(8).z = 0.3333333333333333333333333333;
1045 Nodes.IntPoint(9).x = 0;
1046 Nodes.IntPoint(9).y = 0;
1047 Nodes.IntPoint(9).z = 0.6666666666666666666666666667;
1048 Nodes.IntPoint(10).x = 0.6666666666666666666666666667;
1049 Nodes.IntPoint(10).y = 0.3333333333333333333333333333;
1050 Nodes.IntPoint(10).z = 0;
1051 Nodes.IntPoint(11).x = 0.3333333333333333333333333333;
1052 Nodes.IntPoint(11).y = 0.6666666666666666666666666667;
1053 Nodes.IntPoint(11).z = 0;
1054 Nodes.IntPoint(12).x = 0.6666666666666666666666666667;
1055 Nodes.IntPoint(12).y = 0;
1056 Nodes.IntPoint(12).z = 0.3333333333333333333333333333;
1057 Nodes.IntPoint(13).x = 0.3333333333333333333333333333;
1058 Nodes.IntPoint(13).y = 0;
1059 Nodes.IntPoint(13).z = 0.6666666666666666666666666667;
1060 Nodes.IntPoint(14).x = 0;
1061 Nodes.IntPoint(14).y = 0.6666666666666666666666666667;
1062 Nodes.IntPoint(14).z = 0.3333333333333333333333333333;
1063 Nodes.IntPoint(15).x = 0;
1064 Nodes.IntPoint(15).y = 0.3333333333333333333333333333;
1065 Nodes.IntPoint(15).z = 0.6666666666666666666666666667;
1066 Nodes.IntPoint(16).x = 0.3333333333333333333333333333;
1067 Nodes.IntPoint(16).y = 0.3333333333333333333333333333;
1068 Nodes.IntPoint(16).z = 0.3333333333333333333333333333;
1069 Nodes.IntPoint(17).x = 0;
1070 Nodes.IntPoint(17).y = 0.3333333333333333333333333333;
1071 Nodes.IntPoint(17).z = 0.3333333333333333333333333333;
1072 Nodes.IntPoint(18).x = 0.3333333333333333333333333333;
1073 Nodes.IntPoint(18).y = 0;
1074 Nodes.IntPoint(18).z = 0.3333333333333333333333333333;
1075 Nodes.IntPoint(19).x = 0.3333333333333333333333333333;
1076 Nodes.IntPoint(19).y = 0.3333333333333333333333333333;
1077 Nodes.IntPoint(19).z = 0;
1078}
1079
1081 Vector &shape) const
1082{
1083 real_t x = ip.x, y = ip.y, z = ip.z;
1084
1085 shape(0) = -((-1 + x + y + z)*(-2 + 3*x + 3*y + 3*z)*
1086 (-1 + 3*x + 3*y + 3*z))/2.;
1087 shape(4) = (9*x*(-1 + x + y + z)*(-2 + 3*x + 3*y + 3*z))/2.;
1088 shape(5) = (-9*x*(-1 + 3*x)*(-1 + x + y + z))/2.;
1089 shape(1) = (x*(2 + 9*(-1 + x)*x))/2.;
1090 shape(6) = (9*y*(-1 + x + y + z)*(-2 + 3*x + 3*y + 3*z))/2.;
1091 shape(19) = -27*x*y*(-1 + x + y + z);
1092 shape(10) = (9*x*(-1 + 3*x)*y)/2.;
1093 shape(7) = (-9*y*(-1 + 3*y)*(-1 + x + y + z))/2.;
1094 shape(11) = (9*x*y*(-1 + 3*y))/2.;
1095 shape(2) = (y*(2 + 9*(-1 + y)*y))/2.;
1096 shape(8) = (9*z*(-1 + x + y + z)*(-2 + 3*x + 3*y + 3*z))/2.;
1097 shape(18) = -27*x*z*(-1 + x + y + z);
1098 shape(12) = (9*x*(-1 + 3*x)*z)/2.;
1099 shape(17) = -27*y*z*(-1 + x + y + z);
1100 shape(16) = 27*x*y*z;
1101 shape(14) = (9*y*(-1 + 3*y)*z)/2.;
1102 shape(9) = (-9*z*(-1 + x + y + z)*(-1 + 3*z))/2.;
1103 shape(13) = (9*x*z*(-1 + 3*z))/2.;
1104 shape(15) = (9*y*z*(-1 + 3*z))/2.;
1105 shape(3) = (z*(2 + 9*(-1 + z)*z))/2.;
1106}
1107
1109 DenseMatrix &dshape) const
1110{
1111 real_t x = ip.x, y = ip.y, z = ip.z;
1112
1113 dshape(0,0) = (-11 + 36*y + 36*z - 9*(3*pow(x,2) + 3*pow(y + z,2) +
1114 x*(-4 + 6*y + 6*z)))/2.;
1115 dshape(0,1) = (-11 + 36*y + 36*z - 9*(3*pow(x,2) + 3*pow(y + z,2) +
1116 x*(-4 + 6*y + 6*z)))/2.;
1117 dshape(0,2) = (-11 + 36*y + 36*z - 9*(3*pow(x,2) + 3*pow(y + z,2) +
1118 x*(-4 + 6*y + 6*z)))/2.;
1119 dshape(4,0) = (9*(9*pow(x,2) + (-1 + y + z)*(-2 + 3*y + 3*z) +
1120 2*x*(-5 + 6*y + 6*z)))/2.;
1121 dshape(4,1) = (9*x*(-5 + 6*x + 6*y + 6*z))/2.;
1122 dshape(4,2) = (9*x*(-5 + 6*x + 6*y + 6*z))/2.;
1123 dshape(5,0) = (-9*(1 - y - z + x*(-8 + 9*x + 6*y + 6*z)))/2.;
1124 dshape(5,1) = (9*(1 - 3*x)*x)/2.;
1125 dshape(5,2) = (9*(1 - 3*x)*x)/2.;
1126 dshape(1,0) = 1 + (9*x*(-2 + 3*x))/2.;
1127 dshape(1,1) = 0;
1128 dshape(1,2) = 0;
1129 dshape(6,0) = (9*y*(-5 + 6*x + 6*y + 6*z))/2.;
1130 dshape(6,1) = (9*(2 + 3*pow(x,2) - 10*y - 5*z + 3*(y + z)*(3*y + z) +
1131 x*(-5 + 12*y + 6*z)))/2.;
1132 dshape(6,2) = (9*y*(-5 + 6*x + 6*y + 6*z))/2.;
1133 dshape(19,0) = -27*y*(-1 + 2*x + y + z);
1134 dshape(19,1) = -27*x*(-1 + x + 2*y + z);
1135 dshape(19,2) = -27*x*y;
1136 dshape(10,0) = (9*(-1 + 6*x)*y)/2.;
1137 dshape(10,1) = (9*x*(-1 + 3*x))/2.;
1138 dshape(10,2) = 0;
1139 dshape(7,0) = (9*(1 - 3*y)*y)/2.;
1140 dshape(7,1) = (-9*(1 + x*(-1 + 6*y) - z + y*(-8 + 9*y + 6*z)))/2.;
1141 dshape(7,2) = (9*(1 - 3*y)*y)/2.;
1142 dshape(11,0) = (9*y*(-1 + 3*y))/2.;
1143 dshape(11,1) = (9*x*(-1 + 6*y))/2.;
1144 dshape(11,2) = 0;
1145 dshape(2,0) = 0;
1146 dshape(2,1) = 1 + (9*y*(-2 + 3*y))/2.;
1147 dshape(2,2) = 0;
1148 dshape(8,0) = (9*z*(-5 + 6*x + 6*y + 6*z))/2.;
1149 dshape(8,1) = (9*z*(-5 + 6*x + 6*y + 6*z))/2.;
1150 dshape(8,2) = (9*(2 + 3*pow(x,2) - 5*y - 10*z + 3*(y + z)*(y + 3*z) +
1151 x*(-5 + 6*y + 12*z)))/2.;
1152 dshape(18,0) = -27*z*(-1 + 2*x + y + z);
1153 dshape(18,1) = -27*x*z;
1154 dshape(18,2) = -27*x*(-1 + x + y + 2*z);
1155 dshape(12,0) = (9*(-1 + 6*x)*z)/2.;
1156 dshape(12,1) = 0;
1157 dshape(12,2) = (9*x*(-1 + 3*x))/2.;
1158 dshape(17,0) = -27*y*z;
1159 dshape(17,1) = -27*z*(-1 + x + 2*y + z);
1160 dshape(17,2) = -27*y*(-1 + x + y + 2*z);
1161 dshape(16,0) = 27*y*z;
1162 dshape(16,1) = 27*x*z;
1163 dshape(16,2) = 27*x*y;
1164 dshape(14,0) = 0;
1165 dshape(14,1) = (9*(-1 + 6*y)*z)/2.;
1166 dshape(14,2) = (9*y*(-1 + 3*y))/2.;
1167 dshape(9,0) = (9*(1 - 3*z)*z)/2.;
1168 dshape(9,1) = (9*(1 - 3*z)*z)/2.;
1169 dshape(9,2) = (9*(-1 + x + y + 8*z - 6*(x + y)*z - 9*pow(z,2)))/2.;
1170 dshape(13,0) = (9*z*(-1 + 3*z))/2.;
1171 dshape(13,1) = 0;
1172 dshape(13,2) = (9*x*(-1 + 6*z))/2.;
1173 dshape(15,0) = 0;
1174 dshape(15,1) = (9*z*(-1 + 3*z))/2.;
1175 dshape(15,2) = (9*y*(-1 + 6*z))/2.;
1176 dshape(3,0) = 0;
1177 dshape(3,1) = 0;
1178 dshape(3,2) = 1 + (9*z*(-2 + 3*z))/2.;
1179}
1180
1181
1183 : NodalFiniteElement(2, Geometry::TRIANGLE, 1, 0)
1184{
1185 Nodes.IntPoint(0).x = 0.333333333333333333;
1186 Nodes.IntPoint(0).y = 0.333333333333333333;
1187}
1188
1190 Vector &shape) const
1191{
1192 shape(0) = 1.0;
1193}
1194
1196 DenseMatrix &dshape) const
1197{
1198 dshape(0,0) = 0.0;
1199 dshape(0,1) = 0.0;
1200}
1201
1202
1204 : NodalFiniteElement(2, Geometry::SQUARE, 1, 0, FunctionSpace::Qk)
1205{
1206 Nodes.IntPoint(0).x = 0.5;
1207 Nodes.IntPoint(0).y = 0.5;
1208}
1209
1211 Vector &shape) const
1212{
1213 shape(0) = 1.0;
1214}
1215
1217 DenseMatrix &dshape) const
1218{
1219 dshape(0,0) = 0.0;
1220 dshape(0,1) = 0.0;
1221}
1222
1223
1225 : NodalFiniteElement(3, Geometry::TETRAHEDRON, 4, 1)
1226{
1227 Nodes.IntPoint(0).x = 0.0;
1228 Nodes.IntPoint(0).y = 0.0;
1229 Nodes.IntPoint(0).z = 0.0;
1230 Nodes.IntPoint(1).x = 1.0;
1231 Nodes.IntPoint(1).y = 0.0;
1232 Nodes.IntPoint(1).z = 0.0;
1233 Nodes.IntPoint(2).x = 0.0;
1234 Nodes.IntPoint(2).y = 1.0;
1235 Nodes.IntPoint(2).z = 0.0;
1236 Nodes.IntPoint(3).x = 0.0;
1237 Nodes.IntPoint(3).y = 0.0;
1238 Nodes.IntPoint(3).z = 1.0;
1239}
1240
1242 Vector &shape) const
1243{
1244 shape(0) = 1. - ip.x - ip.y - ip.z;
1245 shape(1) = ip.x;
1246 shape(2) = ip.y;
1247 shape(3) = ip.z;
1248}
1249
1251 DenseMatrix &dshape) const
1252{
1253 if (dshape.Height() == 4)
1254 {
1255 real_t *A = &dshape(0,0);
1256 A[0] = -1.; A[4] = -1.; A[8] = -1.;
1257 A[1] = 1.; A[5] = 0.; A[9] = 0.;
1258 A[2] = 0.; A[6] = 1.; A[10] = 0.;
1259 A[3] = 0.; A[7] = 0.; A[11] = 1.;
1260 }
1261 else
1262 {
1263 dshape(0,0) = -1.; dshape(0,1) = -1.; dshape(0,2) = -1.;
1264 dshape(1,0) = 1.; dshape(1,1) = 0.; dshape(1,2) = 0.;
1265 dshape(2,0) = 0.; dshape(2,1) = 1.; dshape(2,2) = 0.;
1266 dshape(3,0) = 0.; dshape(3,1) = 0.; dshape(3,2) = 1.;
1267 }
1268}
1269
1271 DenseMatrix &h) const
1272{
1273 h = 0.0;
1274}
1275
1276void Linear3DFiniteElement::GetFaceDofs (int face, int **dofs, int *ndofs)
1277const
1278{
1279 static int face_dofs[4][3] = {{1, 2, 3}, {0, 2, 3}, {0, 1, 3}, {0, 1, 2}};
1280
1281 *ndofs = 3;
1282 *dofs = face_dofs[face];
1283}
1284
1285
1286// TODO: use a FunctionSpace specific to wedges instead of Qk.
1288 : NodalFiniteElement(3, Geometry::PRISM, 6, 1, FunctionSpace::Qk)
1289{
1290 Nodes.IntPoint(0).x = 0.0;
1291 Nodes.IntPoint(0).y = 0.0;
1292 Nodes.IntPoint(0).z = 0.0;
1293 Nodes.IntPoint(1).x = 1.0;
1294 Nodes.IntPoint(1).y = 0.0;
1295 Nodes.IntPoint(1).z = 0.0;
1296 Nodes.IntPoint(2).x = 0.0;
1297 Nodes.IntPoint(2).y = 1.0;
1298 Nodes.IntPoint(2).z = 0.0;
1299 Nodes.IntPoint(3).x = 0.0;
1300 Nodes.IntPoint(3).y = 0.0;
1301 Nodes.IntPoint(3).z = 1.0;
1302 Nodes.IntPoint(4).x = 1.0;
1303 Nodes.IntPoint(4).y = 0.0;
1304 Nodes.IntPoint(4).z = 1.0;
1305 Nodes.IntPoint(5).x = 0.0;
1306 Nodes.IntPoint(5).y = 1.0;
1307 Nodes.IntPoint(5).z = 1.0;
1308}
1309
1311 Vector &shape) const
1312{
1313 shape(0) = (1. - ip.x - ip.y) * (1. - ip.z);
1314 shape(1) = ip.x * (1. - ip.z);
1315 shape(2) = ip.y * (1. - ip.z);
1316 shape(3) = (1. - ip.x - ip.y) * ip.z;
1317 shape(4) = ip.x * ip.z;
1318 shape(5) = ip.y * ip.z;
1319}
1320
1322 DenseMatrix &dshape) const
1323{
1324 dshape(0,0) = -1. + ip.z;
1325 dshape(0,1) = -1. + ip.z;
1326 dshape(0,2) = -1. + ip.x + ip.y;
1327
1328 dshape(1,0) = 1. - ip.z;
1329 dshape(1,1) = 0.;
1330 dshape(1,2) = -ip.x;
1331
1332 dshape(2,0) = 0.;
1333 dshape(2,1) = 1. - ip.z;
1334 dshape(2,2) = -ip.y;
1335
1336 dshape(3,0) = -ip.z;
1337 dshape(3,1) = -ip.z;
1338 dshape(3,2) = 1. - ip.x - ip.y;
1339
1340 dshape(4,0) = ip.z;
1341 dshape(4,1) = 0.;
1342 dshape(4,2) = ip.x;
1343
1344 dshape(5,0) = 0.;
1345 dshape(5,1) = ip.z;
1346 dshape(5,2) = ip.y;
1347}
1348
1349void LinearWedgeFiniteElement::GetFaceDofs (int face, int **dofs, int *ndofs)
1350const
1351{
1352 static int face_dofs[5][4] =
1353 {{0, 2, 1, -1}, {3, 4, 5, -1}, {0, 1, 4, 3}, {1, 2, 5, 4}, {2, 0, 3, 5}};
1354
1355 *ndofs = (face < 2) ? 3 : 4;
1356 *dofs = face_dofs[face];
1357}
1358
1359
1361 : NodalFiniteElement(3, Geometry::PYRAMID, 5, 1, FunctionSpace::Uk)
1362{
1363 Nodes.IntPoint(0).x = 0.0;
1364 Nodes.IntPoint(0).y = 0.0;
1365 Nodes.IntPoint(0).z = 0.0;
1366 Nodes.IntPoint(1).x = 1.0;
1367 Nodes.IntPoint(1).y = 0.0;
1368 Nodes.IntPoint(1).z = 0.0;
1369 Nodes.IntPoint(2).x = 1.0;
1370 Nodes.IntPoint(2).y = 1.0;
1371 Nodes.IntPoint(2).z = 0.0;
1372 Nodes.IntPoint(3).x = 0.0;
1373 Nodes.IntPoint(3).y = 1.0;
1374 Nodes.IntPoint(3).z = 0.0;
1375 Nodes.IntPoint(4).x = 0.0;
1376 Nodes.IntPoint(4).y = 0.0;
1377 Nodes.IntPoint(4).z = 1.0;
1378}
1379
1381 Vector &shape) const
1382{
1383 real_t x = ip.x, y = ip.y, z = ip.z;
1384 real_t ox = 1.-x-z, oy = 1.-y-z, oz = 1.-z;
1385
1386 real_t tol = 1e-6;
1387
1388 if (oz <= tol)
1389 {
1390 // We must return the limit of the basis functions as z->1. In order to
1391 // remain inside the pyramid in this limit the x and y coordinates must
1392 // be approaching 0. The resulting limiting basis function values are:
1393 shape(0) = 0.;
1394 shape(1) = 0.;
1395 shape(2) = 0.;
1396 shape(3) = 0.;
1397 shape(4) = 1.;
1398 return;
1399 }
1400
1401 real_t ozi = 1. / oz;
1402
1403 shape(0) = ox * oy * ozi;
1404 shape(1) = x * oy * ozi;
1405 shape(2) = x * y * ozi;
1406 shape(3) = ox * y * ozi;
1407 shape(4) = z;
1408}
1409
1411 DenseMatrix &dshape) const
1412{
1413 real_t x = ip.x, y = ip.y, z = ip.z;
1414 real_t ox = 1.-x-z, oy = 1.-y-z, oz = 1.-z;
1415
1416 real_t tol = 1e-6;
1417
1418 if (oz <= tol)
1419 {
1420 // At the apex of the pyramid the gradients of the basis functions are
1421 // multivalued and depend on the direction from which the limit is taken.
1422 // The following values correspond to the average of the gradients taken
1423 // over all possible directions approaching the apex of the pyramid from
1424 // within its interior.
1425 dshape(0,0) = - 0.5;
1426 dshape(0,1) = - 0.5;
1427 dshape(0,2) = - 0.75;
1428
1429 dshape(1,0) = 0.5;
1430 dshape(1,1) = - 0.5;
1431 dshape(1,2) = - 0.25;
1432
1433 dshape(2,0) = 0.5;
1434 dshape(2,1) = 0.5;
1435 dshape(2,2) = 0.25;
1436
1437 dshape(3,0) = - 0.5;
1438 dshape(3,1) = 0.5;
1439 dshape(3,2) = - 0.25;
1440
1441 dshape(4,0) = 0.;
1442 dshape(4,1) = 0.;
1443 dshape(4,2) = 1.;
1444
1445 return;
1446 }
1447
1448 real_t ozi = 1. / oz;
1449
1450 dshape(0,0) = - oy * ozi;
1451 dshape(0,1) = - ox * ozi;
1452 dshape(0,2) = x * y * ozi * ozi - 1.;
1453
1454 dshape(1,0) = oy * ozi;
1455 dshape(1,1) = - x * ozi;
1456 dshape(1,2) = - x * y * ozi * ozi;
1457
1458 dshape(2,0) = y * ozi;
1459 dshape(2,1) = x * ozi;
1460 dshape(2,2) = x * y * ozi * ozi;
1461
1462 dshape(3,0) = - y * ozi;
1463 dshape(3,1) = ox * ozi;
1464 dshape(3,2) = - x * y * ozi * ozi;
1465
1466 dshape(4,0) = 0.;
1467 dshape(4,1) = 0.;
1468 dshape(4,2) = 1.;
1469}
1470
1471void LinearPyramidFiniteElement::GetFaceDofs (int face, int **dofs, int *ndofs)
1472const
1473{
1474 static int face_dofs[5][4] =
1475 {{3, 2, 1, 0}, {0, 1, 4, -1}, {1, 2, 4, -1}, {2, 3, 4, -1}, {3, 0, 4, -1}};
1476
1477 *ndofs = (face < 1) ? 4 : 3;
1478 *dofs = face_dofs[face];
1479}
1480
1481
1483 : NodalFiniteElement(3, Geometry::TETRAHEDRON, 10, 2)
1484{
1485 Nodes.IntPoint(0).x = 0.0;
1486 Nodes.IntPoint(0).y = 0.0;
1487 Nodes.IntPoint(0).z = 0.0;
1488 Nodes.IntPoint(1).x = 1.0;
1489 Nodes.IntPoint(1).y = 0.0;
1490 Nodes.IntPoint(1).z = 0.0;
1491 Nodes.IntPoint(2).x = 0.0;
1492 Nodes.IntPoint(2).y = 1.0;
1493 Nodes.IntPoint(2).z = 0.0;
1494 Nodes.IntPoint(3).x = 0.0;
1495 Nodes.IntPoint(3).y = 0.0;
1496 Nodes.IntPoint(3).z = 1.0;
1497 Nodes.IntPoint(4).x = 0.5;
1498 Nodes.IntPoint(4).y = 0.0;
1499 Nodes.IntPoint(4).z = 0.0;
1500 Nodes.IntPoint(5).x = 0.0;
1501 Nodes.IntPoint(5).y = 0.5;
1502 Nodes.IntPoint(5).z = 0.0;
1503 Nodes.IntPoint(6).x = 0.0;
1504 Nodes.IntPoint(6).y = 0.0;
1505 Nodes.IntPoint(6).z = 0.5;
1506 Nodes.IntPoint(7).x = 0.5;
1507 Nodes.IntPoint(7).y = 0.5;
1508 Nodes.IntPoint(7).z = 0.0;
1509 Nodes.IntPoint(8).x = 0.5;
1510 Nodes.IntPoint(8).y = 0.0;
1511 Nodes.IntPoint(8).z = 0.5;
1512 Nodes.IntPoint(9).x = 0.0;
1513 Nodes.IntPoint(9).y = 0.5;
1514 Nodes.IntPoint(9).z = 0.5;
1515}
1516
1518 Vector &shape) const
1519{
1520 real_t L0, L1, L2, L3;
1521
1522 L0 = 1. - ip.x - ip.y - ip.z;
1523 L1 = ip.x;
1524 L2 = ip.y;
1525 L3 = ip.z;
1526
1527 shape(0) = L0 * ( 2.0 * L0 - 1.0 );
1528 shape(1) = L1 * ( 2.0 * L1 - 1.0 );
1529 shape(2) = L2 * ( 2.0 * L2 - 1.0 );
1530 shape(3) = L3 * ( 2.0 * L3 - 1.0 );
1531 shape(4) = 4.0 * L0 * L1;
1532 shape(5) = 4.0 * L0 * L2;
1533 shape(6) = 4.0 * L0 * L3;
1534 shape(7) = 4.0 * L1 * L2;
1535 shape(8) = 4.0 * L1 * L3;
1536 shape(9) = 4.0 * L2 * L3;
1537}
1538
1540 DenseMatrix &dshape) const
1541{
1542 real_t x, y, z, L0;
1543
1544 x = ip.x;
1545 y = ip.y;
1546 z = ip.z;
1547 L0 = 1.0 - x - y - z;
1548
1549 dshape(0,0) = dshape(0,1) = dshape(0,2) = 1.0 - 4.0 * L0;
1550 dshape(1,0) = -1.0 + 4.0 * x; dshape(1,1) = 0.0; dshape(1,2) = 0.0;
1551 dshape(2,0) = 0.0; dshape(2,1) = -1.0 + 4.0 * y; dshape(2,2) = 0.0;
1552 dshape(3,0) = dshape(3,1) = 0.0; dshape(3,2) = -1.0 + 4.0 * z;
1553 dshape(4,0) = 4.0 * (L0 - x); dshape(4,1) = dshape(4,2) = -4.0 * x;
1554 dshape(5,0) = dshape(5,2) = -4.0 * y; dshape(5,1) = 4.0 * (L0 - y);
1555 dshape(6,0) = dshape(6,1) = -4.0 * z; dshape(6,2) = 4.0 * (L0 - z);
1556 dshape(7,0) = 4.0 * y; dshape(7,1) = 4.0 * x; dshape(7,2) = 0.0;
1557 dshape(8,0) = 4.0 * z; dshape(8,1) = 0.0; dshape(8,2) = 4.0 * x;
1558 dshape(9,0) = 0.0; dshape(9,1) = 4.0 * z; dshape(9,2) = 4.0 * y;
1559}
1560
1562 : NodalFiniteElement(3, Geometry::CUBE, 8, 1, FunctionSpace::Qk)
1563{
1564 Nodes.IntPoint(0).x = 0.0;
1565 Nodes.IntPoint(0).y = 0.0;
1566 Nodes.IntPoint(0).z = 0.0;
1567
1568 Nodes.IntPoint(1).x = 1.0;
1569 Nodes.IntPoint(1).y = 0.0;
1570 Nodes.IntPoint(1).z = 0.0;
1571
1572 Nodes.IntPoint(2).x = 1.0;
1573 Nodes.IntPoint(2).y = 1.0;
1574 Nodes.IntPoint(2).z = 0.0;
1575
1576 Nodes.IntPoint(3).x = 0.0;
1577 Nodes.IntPoint(3).y = 1.0;
1578 Nodes.IntPoint(3).z = 0.0;
1579
1580 Nodes.IntPoint(4).x = 0.0;
1581 Nodes.IntPoint(4).y = 0.0;
1582 Nodes.IntPoint(4).z = 1.0;
1583
1584 Nodes.IntPoint(5).x = 1.0;
1585 Nodes.IntPoint(5).y = 0.0;
1586 Nodes.IntPoint(5).z = 1.0;
1587
1588 Nodes.IntPoint(6).x = 1.0;
1589 Nodes.IntPoint(6).y = 1.0;
1590 Nodes.IntPoint(6).z = 1.0;
1591
1592 Nodes.IntPoint(7).x = 0.0;
1593 Nodes.IntPoint(7).y = 1.0;
1594 Nodes.IntPoint(7).z = 1.0;
1595}
1596
1598 Vector &shape) const
1599{
1600 real_t x = ip.x, y = ip.y, z = ip.z;
1601 real_t ox = 1.-x, oy = 1.-y, oz = 1.-z;
1602
1603 shape(0) = ox * oy * oz;
1604 shape(1) = x * oy * oz;
1605 shape(2) = x * y * oz;
1606 shape(3) = ox * y * oz;
1607 shape(4) = ox * oy * z;
1608 shape(5) = x * oy * z;
1609 shape(6) = x * y * z;
1610 shape(7) = ox * y * z;
1611}
1612
1614 DenseMatrix &dshape) const
1615{
1616 real_t x = ip.x, y = ip.y, z = ip.z;
1617 real_t ox = 1.-x, oy = 1.-y, oz = 1.-z;
1618
1619 dshape(0,0) = - oy * oz;
1620 dshape(0,1) = - ox * oz;
1621 dshape(0,2) = - ox * oy;
1622
1623 dshape(1,0) = oy * oz;
1624 dshape(1,1) = - x * oz;
1625 dshape(1,2) = - x * oy;
1626
1627 dshape(2,0) = y * oz;
1628 dshape(2,1) = x * oz;
1629 dshape(2,2) = - x * y;
1630
1631 dshape(3,0) = - y * oz;
1632 dshape(3,1) = ox * oz;
1633 dshape(3,2) = - ox * y;
1634
1635 dshape(4,0) = - oy * z;
1636 dshape(4,1) = - ox * z;
1637 dshape(4,2) = ox * oy;
1638
1639 dshape(5,0) = oy * z;
1640 dshape(5,1) = - x * z;
1641 dshape(5,2) = x * oy;
1642
1643 dshape(6,0) = y * z;
1644 dshape(6,1) = x * z;
1645 dshape(6,2) = x * y;
1646
1647 dshape(7,0) = - y * z;
1648 dshape(7,1) = ox * z;
1649 dshape(7,2) = ox * y;
1650}
1651
1653 DenseMatrix &h) const
1654{
1655 real_t x = ip.x, y = ip.y, z = ip.z;
1656 real_t ox = 1.-x, oy = 1.-y, oz = 1.-z;
1657
1658 h(0,0) = 0.; h(0,1) = oz; h(0,2) = oy;
1659 h(0,3) = 0.; h(0,4) = ox; h(0,5) = 0.;
1660
1661 h(1,0) = 0.; h(1,1) = -oz; h(1,2) = -oy;
1662 h(1,3) = 0.; h(1,4) = x; h(1,5) = 0.;
1663
1664 h(2,0) = 0.; h(2,1) = oz; h(2,2) = -y;
1665 h(2,3) = 0.; h(2,4) = -x; h(2,5) = 0.;
1666
1667 h(3,0) = 0.; h(3,1) = -oz; h(3,2) = y;
1668 h(3,3) = 0.; h(3,4) = -ox; h(3,5) = 0.;
1669
1670 h(4,0) = 0.; h(4,1) = z; h(4,2) = -oy;
1671 h(4,3) = 0.; h(4,4) = -ox; h(4,5) = 0.;
1672
1673 h(5,0) = 0.; h(5,1) = -z; h(5,2) = oy;
1674 h(5,3) = 0.; h(5,4) = -x; h(5,5) = 0.;
1675
1676 h(6,0) = 0.; h(6,1) = z; h(6,2) = y;
1677 h(6,3) = 0.; h(6,4) = x; h(6,5) = 0.;
1678
1679 h(7,0) = 0.; h(7,1) = -z; h(7,2) = -y;
1680 h(7,3) = 0.; h(7,4) = ox; h(7,5) = 0.;
1681}
1682
1683
1685 : NodalFiniteElement(1, Geometry::SEGMENT, 1, Ord) // default Ord = 0
1686{
1687 Nodes.IntPoint(0).x = 0.5;
1688}
1689
1691 Vector &shape) const
1692{
1693 shape(0) = 1.0;
1694}
1695
1697 DenseMatrix &dshape) const
1698{
1699 dshape(0,0) = 0.0;
1700}
1701
1703 : NodalFiniteElement(2, Geometry::TRIANGLE, 3, 1)
1704{
1705 Nodes.IntPoint(0).x = 0.5;
1706 Nodes.IntPoint(0).y = 0.0;
1707 Nodes.IntPoint(1).x = 0.5;
1708 Nodes.IntPoint(1).y = 0.5;
1709 Nodes.IntPoint(2).x = 0.0;
1710 Nodes.IntPoint(2).y = 0.5;
1711}
1712
1714 Vector &shape) const
1715{
1716 shape(0) = 1.0 - 2.0 * ip.y;
1717 shape(1) = -1.0 + 2.0 * ( ip.x + ip.y );
1718 shape(2) = 1.0 - 2.0 * ip.x;
1719}
1720
1722 DenseMatrix &dshape) const
1723{
1724 dshape(0,0) = 0.0; dshape(0,1) = -2.0;
1725 dshape(1,0) = 2.0; dshape(1,1) = 2.0;
1726 dshape(2,0) = -2.0; dshape(2,1) = 0.0;
1727}
1728
1730// the FunctionSpace should be rotated (45 degrees) Q_1
1731// i.e. the span of { 1, x, y, x^2 - y^2 }
1732 : NodalFiniteElement(2, Geometry::SQUARE, 4, 2, FunctionSpace::Qk)
1733{
1734 Nodes.IntPoint(0).x = 0.5;
1735 Nodes.IntPoint(0).y = 0.0;
1736 Nodes.IntPoint(1).x = 1.0;
1737 Nodes.IntPoint(1).y = 0.5;
1738 Nodes.IntPoint(2).x = 0.5;
1739 Nodes.IntPoint(2).y = 1.0;
1740 Nodes.IntPoint(3).x = 0.0;
1741 Nodes.IntPoint(3).y = 0.5;
1742}
1743
1745 Vector &shape) const
1746{
1747 const real_t l1 = ip.x+ip.y-0.5, l2 = 1.-l1, l3 = ip.x-ip.y+0.5, l4 = 1.-l3;
1748
1749 shape(0) = l2 * l3;
1750 shape(1) = l1 * l3;
1751 shape(2) = l1 * l4;
1752 shape(3) = l2 * l4;
1753}
1754
1756 DenseMatrix &dshape) const
1757{
1758 const real_t x2 = 2.*ip.x, y2 = 2.*ip.y;
1759
1760 dshape(0,0) = 1. - x2; dshape(0,1) = -2. + y2;
1761 dshape(1,0) = x2; dshape(1,1) = 1. - y2;
1762 dshape(2,0) = 1. - x2; dshape(2,1) = y2;
1763 dshape(3,0) = -2. + x2; dshape(3,1) = 1. - y2;
1764}
1765
1766
1768 : VectorFiniteElement(2, Geometry::TRIANGLE, 3, 1, H_DIV)
1769{
1770 Nodes.IntPoint(0).x = 0.5;
1771 Nodes.IntPoint(0).y = 0.0;
1772 Nodes.IntPoint(1).x = 0.5;
1773 Nodes.IntPoint(1).y = 0.5;
1774 Nodes.IntPoint(2).x = 0.0;
1775 Nodes.IntPoint(2).y = 0.5;
1776}
1777
1779 DenseMatrix &shape) const
1780{
1781 real_t x = ip.x, y = ip.y;
1782
1783 shape(0,0) = x;
1784 shape(0,1) = y - 1.;
1785 shape(1,0) = x;
1786 shape(1,1) = y;
1787 shape(2,0) = x - 1.;
1788 shape(2,1) = y;
1789}
1790
1792 Vector &divshape) const
1793{
1794 divshape(0) = 2.;
1795 divshape(1) = 2.;
1796 divshape(2) = 2.;
1797}
1798
1799const real_t RT0TriangleFiniteElement::nk[3][2] =
1800{ {0, -1}, {1, 1}, {-1, 0} };
1801
1803 ElementTransformation &Trans, DenseMatrix &I) const
1804{
1805 int k, j;
1806#ifdef MFEM_THREAD_SAFE
1808#endif
1809
1810#ifdef MFEM_DEBUG
1811 for (k = 0; k < 3; k++)
1812 {
1814 for (j = 0; j < 3; j++)
1815 {
1816 real_t d = vshape(j,0)*nk[k][0]+vshape(j,1)*nk[k][1];
1817 if (j == k) { d -= 1.0; }
1818 if (fabs(d) > 1.0e-12)
1819 {
1820 mfem::err << "RT0TriangleFiniteElement::GetLocalInterpolation (...)\n"
1821 " k = " << k << ", j = " << j << ", d = " << d << endl;
1822 mfem_error();
1823 }
1824 }
1825 }
1826#endif
1827
1829 ip.x = ip.y = 0.0;
1830 Trans.SetIntPoint (&ip);
1831 // Trans must be linear
1832 // set Jinv = |J| J^{-t} = adj(J)^t
1833 const DenseMatrix &Jinv = Trans.TransposeAdjugateJacobian();
1834
1835 real_t vk[2];
1836 Vector xk (vk, 2);
1837
1838 for (k = 0; k < 3; k++)
1839 {
1840 Trans.Transform (Nodes.IntPoint (k), xk);
1841 ip.x = vk[0]; ip.y = vk[1];
1842 CalcVShape (ip, vshape);
1843 // vk = |J| J^{-t} nk
1844 vk[0] = Jinv(0,0)*nk[k][0]+Jinv(0,1)*nk[k][1];
1845 vk[1] = Jinv(1,0)*nk[k][0]+Jinv(1,1)*nk[k][1];
1846 for (j = 0; j < 3; j++)
1847 if (fabs (I(k,j) = vshape(j,0)*vk[0]+vshape(j,1)*vk[1]) < 1.0e-12)
1848 {
1849 I(k,j) = 0.0;
1850 }
1851 }
1852}
1853
1856 Vector &dofs) const
1857{
1858 real_t vk[2];
1859 Vector xk (vk, 2);
1860
1861 for (int k = 0; k < 3; k++)
1862 {
1863 Trans.SetIntPoint (&Nodes.IntPoint (k));
1864 // set Jinv = |J| J^{-t} = adj(J)^t
1865 const DenseMatrix &Jinv = Trans.TransposeAdjugateJacobian();
1866
1867 vc.Eval (xk, Trans, Nodes.IntPoint (k));
1868 // xk^t |J| J^{-t} nk
1869 dofs(k) = (vk[0] * ( Jinv(0,0)*nk[k][0]+Jinv(0,1)*nk[k][1] ) +
1870 vk[1] * ( Jinv(1,0)*nk[k][0]+Jinv(1,1)*nk[k][1] ));
1871 }
1872}
1873
1875 : VectorFiniteElement(2, Geometry::SQUARE, 4, 1, H_DIV,
1876 FunctionSpace::Qk)
1877{
1878 Nodes.IntPoint(0).x = 0.5;
1879 Nodes.IntPoint(0).y = 0.0;
1880 Nodes.IntPoint(1).x = 1.0;
1881 Nodes.IntPoint(1).y = 0.5;
1882 Nodes.IntPoint(2).x = 0.5;
1883 Nodes.IntPoint(2).y = 1.0;
1884 Nodes.IntPoint(3).x = 0.0;
1885 Nodes.IntPoint(3).y = 0.5;
1886}
1887
1889 DenseMatrix &shape) const
1890{
1891 real_t x = ip.x, y = ip.y;
1892
1893 shape(0,0) = 0;
1894 shape(0,1) = y - 1.;
1895 shape(1,0) = x;
1896 shape(1,1) = 0;
1897 shape(2,0) = 0;
1898 shape(2,1) = y;
1899 shape(3,0) = x - 1.;
1900 shape(3,1) = 0;
1901}
1902
1904 Vector &divshape) const
1905{
1906 divshape(0) = 1.;
1907 divshape(1) = 1.;
1908 divshape(2) = 1.;
1909 divshape(3) = 1.;
1910}
1911
1912const real_t RT0QuadFiniteElement::nk[4][2] =
1913{ {0, -1}, {1, 0}, {0, 1}, {-1, 0} };
1914
1916 ElementTransformation &Trans, DenseMatrix &I) const
1917{
1918 int k, j;
1919#ifdef MFEM_THREAD_SAFE
1921#endif
1922
1923#ifdef MFEM_DEBUG
1924 for (k = 0; k < 4; k++)
1925 {
1927 for (j = 0; j < 4; j++)
1928 {
1929 real_t d = vshape(j,0)*nk[k][0]+vshape(j,1)*nk[k][1];
1930 if (j == k) { d -= 1.0; }
1931 if (fabs(d) > 1.0e-12)
1932 {
1933 mfem::err << "RT0QuadFiniteElement::GetLocalInterpolation (...)\n"
1934 " k = " << k << ", j = " << j << ", d = " << d << endl;
1935 mfem_error();
1936 }
1937 }
1938 }
1939#endif
1940
1942 ip.x = ip.y = 0.0;
1943 Trans.SetIntPoint (&ip);
1944 // Trans must be linear (more to have embedding?)
1945 // set Jinv = |J| J^{-t} = adj(J)^t
1946 const DenseMatrix &Jinv = Trans.TransposeAdjugateJacobian();
1947
1948 real_t vk[2];
1949 Vector xk (vk, 2);
1950
1951 for (k = 0; k < 4; k++)
1952 {
1953 Trans.Transform (Nodes.IntPoint (k), xk);
1954 ip.x = vk[0]; ip.y = vk[1];
1955 CalcVShape (ip, vshape);
1956 // vk = |J| J^{-t} nk
1957 vk[0] = Jinv(0,0)*nk[k][0]+Jinv(0,1)*nk[k][1];
1958 vk[1] = Jinv(1,0)*nk[k][0]+Jinv(1,1)*nk[k][1];
1959 for (j = 0; j < 4; j++)
1960 if (fabs (I(k,j) = vshape(j,0)*vk[0]+vshape(j,1)*vk[1]) < 1.0e-12)
1961 {
1962 I(k,j) = 0.0;
1963 }
1964 }
1965}
1966
1969 Vector &dofs) const
1970{
1971 real_t vk[2];
1972 Vector xk (vk, 2);
1973
1974 for (int k = 0; k < 4; k++)
1975 {
1976 Trans.SetIntPoint (&Nodes.IntPoint (k));
1977 // set Jinv = |J| J^{-t} = adj(J)^t
1978 const DenseMatrix &Jinv = Trans.TransposeAdjugateJacobian();
1979
1980 vc.Eval (xk, Trans, Nodes.IntPoint (k));
1981 // xk^t |J| J^{-t} nk
1982 dofs(k) = (vk[0] * ( Jinv(0,0)*nk[k][0]+Jinv(0,1)*nk[k][1] ) +
1983 vk[1] * ( Jinv(1,0)*nk[k][0]+Jinv(1,1)*nk[k][1] ));
1984 }
1985}
1986
1988 : VectorFiniteElement(2, Geometry::TRIANGLE, 8, 2, H_DIV)
1989{
1990 Nodes.IntPoint(0).x = 0.33333333333333333333;
1991 Nodes.IntPoint(0).y = 0.0;
1992 Nodes.IntPoint(1).x = 0.66666666666666666667;
1993 Nodes.IntPoint(1).y = 0.0;
1994 Nodes.IntPoint(2).x = 0.66666666666666666667;
1995 Nodes.IntPoint(2).y = 0.33333333333333333333;
1996 Nodes.IntPoint(3).x = 0.33333333333333333333;
1997 Nodes.IntPoint(3).y = 0.66666666666666666667;
1998 Nodes.IntPoint(4).x = 0.0;
1999 Nodes.IntPoint(4).y = 0.66666666666666666667;
2000 Nodes.IntPoint(5).x = 0.0;
2001 Nodes.IntPoint(5).y = 0.33333333333333333333;
2002 Nodes.IntPoint(6).x = 0.33333333333333333333;
2003 Nodes.IntPoint(6).y = 0.33333333333333333333;
2004 Nodes.IntPoint(7).x = 0.33333333333333333333;
2005 Nodes.IntPoint(7).y = 0.33333333333333333333;
2006}
2007
2009 DenseMatrix &shape) const
2010{
2011 real_t x = ip.x, y = ip.y;
2012
2013 shape(0,0) = -2 * x * (-1 + x + 2 * y);
2014 shape(0,1) = -2 * (-1 + y) * (-1 + x + 2 * y);
2015 shape(1,0) = 2 * x * (x - y);
2016 shape(1,1) = 2 * (x - y) * (-1 + y);
2017 shape(2,0) = 2 * x * (-1 + 2 * x + y);
2018 shape(2,1) = 2 * y * (-1 + 2 * x + y);
2019 shape(3,0) = 2 * x * (-1 + x + 2 * y);
2020 shape(3,1) = 2 * y * (-1 + x + 2 * y);
2021 shape(4,0) = -2 * (-1 + x) * (x - y);
2022 shape(4,1) = 2 * y * (-x + y);
2023 shape(5,0) = -2 * (-1 + x) * (-1 + 2 * x + y);
2024 shape(5,1) = -2 * y * (-1 + 2 * x + y);
2025 shape(6,0) = -3 * x * (-2 + 2 * x + y);
2026 shape(6,1) = -3 * y * (-1 + 2 * x + y);
2027 shape(7,0) = -3 * x * (-1 + x + 2 * y);
2028 shape(7,1) = -3 * y * (-2 + x + 2 * y);
2029}
2030
2032 Vector &divshape) const
2033{
2034 real_t x = ip.x, y = ip.y;
2035
2036 divshape(0) = -2 * (-4 + 3 * x + 6 * y);
2037 divshape(1) = 2 + 6 * x - 6 * y;
2038 divshape(2) = -4 + 12 * x + 6 * y;
2039 divshape(3) = -4 + 6 * x + 12 * y;
2040 divshape(4) = 2 - 6 * x + 6 * y;
2041 divshape(5) = -2 * (-4 + 6 * x + 3 * y);
2042 divshape(6) = -9 * (-1 + 2 * x + y);
2043 divshape(7) = -9 * (-1 + x + 2 * y);
2044}
2045
2046const real_t RT1TriangleFiniteElement::nk[8][2] =
2047{
2048 { 0,-1}, { 0,-1},
2049 { 1, 1}, { 1, 1},
2050 {-1, 0}, {-1, 0},
2051 { 1, 0}, { 0, 1}
2052};
2053
2055 ElementTransformation &Trans, DenseMatrix &I) const
2056{
2057 int k, j;
2058#ifdef MFEM_THREAD_SAFE
2060#endif
2061
2062#ifdef MFEM_DEBUG
2063 for (k = 0; k < 8; k++)
2064 {
2066 for (j = 0; j < 8; j++)
2067 {
2068 real_t d = vshape(j,0)*nk[k][0]+vshape(j,1)*nk[k][1];
2069 if (j == k) { d -= 1.0; }
2070 if (fabs(d) > 1.0e-12)
2071 {
2072 mfem::err << "RT1QuadFiniteElement::GetLocalInterpolation (...)\n"
2073 " k = " << k << ", j = " << j << ", d = " << d << endl;
2074 mfem_error();
2075 }
2076 }
2077 }
2078#endif
2079
2081 ip.x = ip.y = 0.0;
2082 Trans.SetIntPoint (&ip);
2083 // Trans must be linear (more to have embedding?)
2084 // set Jinv = |J| J^{-t} = adj(J)^t
2085 const DenseMatrix &Jinv = Trans.TransposeAdjugateJacobian();
2086
2087 real_t vk[2];
2088 Vector xk (vk, 2);
2089
2090 for (k = 0; k < 8; k++)
2091 {
2092 Trans.Transform (Nodes.IntPoint (k), xk);
2093 ip.x = vk[0]; ip.y = vk[1];
2094 CalcVShape (ip, vshape);
2095 // vk = |J| J^{-t} nk
2096 vk[0] = Jinv(0,0)*nk[k][0]+Jinv(0,1)*nk[k][1];
2097 vk[1] = Jinv(1,0)*nk[k][0]+Jinv(1,1)*nk[k][1];
2098 for (j = 0; j < 8; j++)
2099 if (fabs (I(k,j) = vshape(j,0)*vk[0]+vshape(j,1)*vk[1]) < 1.0e-12)
2100 {
2101 I(k,j) = 0.0;
2102 }
2103 }
2104}
2105
2107 VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const
2108{
2109 real_t vk[2];
2110 Vector xk (vk, 2);
2111
2112 for (int k = 0; k < 8; k++)
2113 {
2114 Trans.SetIntPoint (&Nodes.IntPoint (k));
2115 // set Jinv = |J| J^{-t} = adj(J)^t
2116 const DenseMatrix &Jinv = Trans.TransposeAdjugateJacobian();
2117
2118 vc.Eval (xk, Trans, Nodes.IntPoint (k));
2119 // xk^t |J| J^{-t} nk
2120 dofs(k) = (vk[0] * ( Jinv(0,0)*nk[k][0]+Jinv(0,1)*nk[k][1] ) +
2121 vk[1] * ( Jinv(1,0)*nk[k][0]+Jinv(1,1)*nk[k][1] ));
2122 dofs(k) *= 0.5;
2123 }
2124}
2125
2127 : VectorFiniteElement(2, Geometry::SQUARE, 12, 2, H_DIV,
2128 FunctionSpace::Qk)
2129{
2130 // y = 0
2131 Nodes.IntPoint(0).x = 1./3.;
2132 Nodes.IntPoint(0).y = 0.0;
2133 Nodes.IntPoint(1).x = 2./3.;
2134 Nodes.IntPoint(1).y = 0.0;
2135 // x = 1
2136 Nodes.IntPoint(2).x = 1.0;
2137 Nodes.IntPoint(2).y = 1./3.;
2138 Nodes.IntPoint(3).x = 1.0;
2139 Nodes.IntPoint(3).y = 2./3.;
2140 // y = 1
2141 Nodes.IntPoint(4).x = 2./3.;
2142 Nodes.IntPoint(4).y = 1.0;
2143 Nodes.IntPoint(5).x = 1./3.;
2144 Nodes.IntPoint(5).y = 1.0;
2145 // x = 0
2146 Nodes.IntPoint(6).x = 0.0;
2147 Nodes.IntPoint(6).y = 2./3.;
2148 Nodes.IntPoint(7).x = 0.0;
2149 Nodes.IntPoint(7).y = 1./3.;
2150 // x = 0.5 (interior)
2151 Nodes.IntPoint(8).x = 0.5;
2152 Nodes.IntPoint(8).y = 1./3.;
2153 Nodes.IntPoint(9).x = 0.5;
2154 Nodes.IntPoint(9).y = 2./3.;
2155 // y = 0.5 (interior)
2156 Nodes.IntPoint(10).x = 1./3.;
2157 Nodes.IntPoint(10).y = 0.5;
2158 Nodes.IntPoint(11).x = 2./3.;
2159 Nodes.IntPoint(11).y = 0.5;
2160}
2161
2163 DenseMatrix &shape) const
2164{
2165 real_t x = ip.x, y = ip.y;
2166
2167 // y = 0
2168 shape(0,0) = 0;
2169 shape(0,1) = -( 1. - 3.*y + 2.*y*y)*( 2. - 3.*x);
2170 shape(1,0) = 0;
2171 shape(1,1) = -( 1. - 3.*y + 2.*y*y)*(-1. + 3.*x);
2172 // x = 1
2173 shape(2,0) = (-x + 2.*x*x)*( 2. - 3.*y);
2174 shape(2,1) = 0;
2175 shape(3,0) = (-x + 2.*x*x)*(-1. + 3.*y);
2176 shape(3,1) = 0;
2177 // y = 1
2178 shape(4,0) = 0;
2179 shape(4,1) = (-y + 2.*y*y)*(-1. + 3.*x);
2180 shape(5,0) = 0;
2181 shape(5,1) = (-y + 2.*y*y)*( 2. - 3.*x);
2182 // x = 0
2183 shape(6,0) = -(1. - 3.*x + 2.*x*x)*(-1. + 3.*y);
2184 shape(6,1) = 0;
2185 shape(7,0) = -(1. - 3.*x + 2.*x*x)*( 2. - 3.*y);
2186 shape(7,1) = 0;
2187 // x = 0.5 (interior)
2188 shape(8,0) = (4.*x - 4.*x*x)*( 2. - 3.*y);
2189 shape(8,1) = 0;
2190 shape(9,0) = (4.*x - 4.*x*x)*(-1. + 3.*y);
2191 shape(9,1) = 0;
2192 // y = 0.5 (interior)
2193 shape(10,0) = 0;
2194 shape(10,1) = (4.*y - 4.*y*y)*( 2. - 3.*x);
2195 shape(11,0) = 0;
2196 shape(11,1) = (4.*y - 4.*y*y)*(-1. + 3.*x);
2197}
2198
2200 Vector &divshape) const
2201{
2202 real_t x = ip.x, y = ip.y;
2203
2204 divshape(0) = -(-3. + 4.*y)*( 2. - 3.*x);
2205 divshape(1) = -(-3. + 4.*y)*(-1. + 3.*x);
2206 divshape(2) = (-1. + 4.*x)*( 2. - 3.*y);
2207 divshape(3) = (-1. + 4.*x)*(-1. + 3.*y);
2208 divshape(4) = (-1. + 4.*y)*(-1. + 3.*x);
2209 divshape(5) = (-1. + 4.*y)*( 2. - 3.*x);
2210 divshape(6) = -(-3. + 4.*x)*(-1. + 3.*y);
2211 divshape(7) = -(-3. + 4.*x)*( 2. - 3.*y);
2212 divshape(8) = ( 4. - 8.*x)*( 2. - 3.*y);
2213 divshape(9) = ( 4. - 8.*x)*(-1. + 3.*y);
2214 divshape(10) = ( 4. - 8.*y)*( 2. - 3.*x);
2215 divshape(11) = ( 4. - 8.*y)*(-1. + 3.*x);
2216}
2217
2218const real_t RT1QuadFiniteElement::nk[12][2] =
2219{
2220 // y = 0
2221 {0,-1}, {0,-1},
2222 // X = 1
2223 {1, 0}, {1, 0},
2224 // y = 1
2225 {0, 1}, {0, 1},
2226 // x = 0
2227 {-1,0}, {-1,0},
2228 // x = 0.5 (interior)
2229 {1, 0}, {1, 0},
2230 // y = 0.5 (interior)
2231 {0, 1}, {0, 1}
2232};
2233
2235 ElementTransformation &Trans, DenseMatrix &I) const
2236{
2237 int k, j;
2238#ifdef MFEM_THREAD_SAFE
2240#endif
2241
2242#ifdef MFEM_DEBUG
2243 for (k = 0; k < 12; k++)
2244 {
2246 for (j = 0; j < 12; j++)
2247 {
2248 real_t d = vshape(j,0)*nk[k][0]+vshape(j,1)*nk[k][1];
2249 if (j == k) { d -= 1.0; }
2250 if (fabs(d) > 1.0e-12)
2251 {
2252 mfem::err << "RT1QuadFiniteElement::GetLocalInterpolation (...)\n"
2253 " k = " << k << ", j = " << j << ", d = " << d << endl;
2254 mfem_error();
2255 }
2256 }
2257 }
2258#endif
2259
2261 ip.x = ip.y = 0.0;
2262 Trans.SetIntPoint (&ip);
2263 // Trans must be linear (more to have embedding?)
2264 // set Jinv = |J| J^{-t} = adj(J)^t
2265 const DenseMatrix &Jinv = Trans.TransposeAdjugateJacobian();
2266
2267 real_t vk[2];
2268 Vector xk (vk, 2);
2269
2270 for (k = 0; k < 12; k++)
2271 {
2272 Trans.Transform (Nodes.IntPoint (k), xk);
2273 ip.x = vk[0]; ip.y = vk[1];
2274 CalcVShape (ip, vshape);
2275 // vk = |J| J^{-t} nk
2276 vk[0] = Jinv(0,0)*nk[k][0]+Jinv(0,1)*nk[k][1];
2277 vk[1] = Jinv(1,0)*nk[k][0]+Jinv(1,1)*nk[k][1];
2278 for (j = 0; j < 12; j++)
2279 if (fabs (I(k,j) = vshape(j,0)*vk[0]+vshape(j,1)*vk[1]) < 1.0e-12)
2280 {
2281 I(k,j) = 0.0;
2282 }
2283 }
2284}
2285
2287 VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const
2288{
2289 real_t vk[2];
2290 Vector xk (vk, 2);
2291
2292 for (int k = 0; k < 12; k++)
2293 {
2294 Trans.SetIntPoint (&Nodes.IntPoint (k));
2295 // set Jinv = |J| J^{-t} = adj(J)^t
2296 const DenseMatrix &Jinv = Trans.TransposeAdjugateJacobian();
2297
2298 vc.Eval (xk, Trans, Nodes.IntPoint (k));
2299 // xk^t |J| J^{-t} nk
2300 dofs(k) = (vk[0] * ( Jinv(0,0)*nk[k][0]+Jinv(0,1)*nk[k][1] ) +
2301 vk[1] * ( Jinv(1,0)*nk[k][0]+Jinv(1,1)*nk[k][1] ));
2302 }
2303}
2304
2305const real_t RT2TriangleFiniteElement::M[15][15] =
2306{
2307 // *INDENT-OFF*
2308 {
2309 0, -5.3237900077244501311, 5.3237900077244501311, 16.647580015448900262,
2310 0, 24.442740046346700787, -16.647580015448900262, -12.,
2311 -19.118950038622250656, -47.237900077244501311, 0, -34.414110069520051180,
2312 12., 30.590320061795601049, 15.295160030897800524
2313 },
2314 {
2315 0, 1.5, -1.5, -15., 0, 2.625, 15., 15., -4.125, 30., 0, -14.625, -15.,
2316 -15., 10.5
2317 },
2318 {
2319 0, -0.67620999227554986889, 0.67620999227554986889, 7.3524199845510997378,
2320 0, -3.4427400463467007866, -7.3524199845510997378, -12.,
2321 4.1189500386222506555, -0.76209992275549868892, 0, 7.4141100695200511800,
2322 12., -6.5903200617956010489, -3.2951600308978005244
2323 },
2324 {
2325 0, 0, 1.5, 0, 0, 1.5, -11.471370023173350393, 0, 2.4713700231733503933,
2326 -11.471370023173350393, 0, 2.4713700231733503933, 15.295160030897800524,
2327 0, -3.2951600308978005244
2328 },
2329 {
2330 0, 0, 4.875, 0, 0, 4.875, -16.875, 0, -16.875, -16.875, 0, -16.875, 10.5,
2331 36., 10.5
2332 },
2333 {
2334 0, 0, 1.5, 0, 0, 1.5, 2.4713700231733503933, 0, -11.471370023173350393,
2335 2.4713700231733503933, 0, -11.471370023173350393, -3.2951600308978005244,
2336 0, 15.295160030897800524
2337 },
2338 {
2339 -0.67620999227554986889, 0, -3.4427400463467007866, 0,
2340 7.3524199845510997378, 0.67620999227554986889, 7.4141100695200511800, 0,
2341 -0.76209992275549868892, 4.1189500386222506555, -12.,
2342 -7.3524199845510997378, -3.2951600308978005244, -6.5903200617956010489,
2343 12.
2344 },
2345 {
2346 1.5, 0, 2.625, 0, -15., -1.5, -14.625, 0, 30., -4.125, 15., 15., 10.5,
2347 -15., -15.
2348 },
2349 {
2350 -5.3237900077244501311, 0, 24.442740046346700787, 0, 16.647580015448900262,
2351 5.3237900077244501311, -34.414110069520051180, 0, -47.237900077244501311,
2352 -19.118950038622250656, -12., -16.647580015448900262, 15.295160030897800524,
2353 30.590320061795601049, 12.
2354 },
2355 { 0, 0, 18., 0, 0, 6., -42., 0, -30., -26., 0, -14., 24., 32., 8.},
2356 { 0, 0, 6., 0, 0, 18., -14., 0, -26., -30., 0, -42., 8., 32., 24.},
2357 { 0, 0, -6., 0, 0, -4., 30., 0, 4., 22., 0, 4., -24., -16., 0},
2358 { 0, 0, -4., 0, 0, -8., 20., 0, 8., 36., 0, 8., -16., -32., 0},
2359 { 0, 0, -8., 0, 0, -4., 8., 0, 36., 8., 0, 20., 0, -32., -16.},
2360 { 0, 0, -4., 0, 0, -6., 4., 0, 22., 4., 0, 30., 0, -16., -24.}
2361 // *INDENT-ON*
2362};
2363
2365 : VectorFiniteElement(2, Geometry::TRIANGLE, 15, 3, H_DIV)
2366{
2367 const real_t p = 0.11270166537925831148;
2368
2369 Nodes.IntPoint(0).x = p;
2370 Nodes.IntPoint(0).y = 0.0;
2371 Nodes.IntPoint(1).x = 0.5;
2372 Nodes.IntPoint(1).y = 0.0;
2373 Nodes.IntPoint(2).x = 1.-p;
2374 Nodes.IntPoint(2).y = 0.0;
2375 Nodes.IntPoint(3).x = 1.-p;
2376 Nodes.IntPoint(3).y = p;
2377 Nodes.IntPoint(4).x = 0.5;
2378 Nodes.IntPoint(4).y = 0.5;
2379 Nodes.IntPoint(5).x = p;
2380 Nodes.IntPoint(5).y = 1.-p;
2381 Nodes.IntPoint(6).x = 0.0;
2382 Nodes.IntPoint(6).y = 1.-p;
2383 Nodes.IntPoint(7).x = 0.0;
2384 Nodes.IntPoint(7).y = 0.5;
2385 Nodes.IntPoint(8).x = 0.0;
2386 Nodes.IntPoint(8).y = p;
2387 Nodes.IntPoint(9).x = 0.25;
2388 Nodes.IntPoint(9).y = 0.25;
2389 Nodes.IntPoint(10).x = 0.25;
2390 Nodes.IntPoint(10).y = 0.25;
2391 Nodes.IntPoint(11).x = 0.5;
2392 Nodes.IntPoint(11).y = 0.25;
2393 Nodes.IntPoint(12).x = 0.5;
2394 Nodes.IntPoint(12).y = 0.25;
2395 Nodes.IntPoint(13).x = 0.25;
2396 Nodes.IntPoint(13).y = 0.5;
2397 Nodes.IntPoint(14).x = 0.25;
2398 Nodes.IntPoint(14).y = 0.5;
2399}
2400
2402 DenseMatrix &shape) const
2403{
2404 real_t x = ip.x, y = ip.y;
2405
2406 real_t Bx[15] = {1., 0., x, 0., y, 0., x*x, 0., x*y, 0., y*y, 0., x*x*x,
2407 x*x*y, x*y*y
2408 };
2409 real_t By[15] = {0., 1., 0., x, 0., y, 0., x*x, 0., x*y, 0., y*y,
2410 x*x*y, x*y*y, y*y*y
2411 };
2412
2413 for (int i = 0; i < 15; i++)
2414 {
2415 real_t cx = 0.0, cy = 0.0;
2416 for (int j = 0; j < 15; j++)
2417 {
2418 cx += M[i][j] * Bx[j];
2419 cy += M[i][j] * By[j];
2420 }
2421 shape(i,0) = cx;
2422 shape(i,1) = cy;
2423 }
2424}
2425
2427 Vector &divshape) const
2428{
2429 real_t x = ip.x, y = ip.y;
2430 constexpr real_t f2 = 2.0;
2431 constexpr real_t f4 = 4.0;
2432
2433 real_t DivB[15] = {0., 0., 1., 0., 0., 1., f2*x, 0., y, x, 0., f2*y,
2434 f4*x*x, f4*x*y, f4*y*y
2435 };
2436
2437 for (int i = 0; i < 15; i++)
2438 {
2439 real_t div = 0.0;
2440 for (int j = 0; j < 15; j++)
2441 {
2442 div += M[i][j] * DivB[j];
2443 }
2444 divshape(i) = div;
2445 }
2446}
2447
2448const real_t RT2QuadFiniteElement::pt[4] = {0.,1./3.,2./3.,1.};
2449
2450const real_t RT2QuadFiniteElement::dpt[3] = {0.25,0.5,0.75};
2451
2453 : VectorFiniteElement(2, Geometry::SQUARE, 24, 3, H_DIV,
2454 FunctionSpace::Qk)
2455{
2456 // y = 0 (pt[0])
2457 Nodes.IntPoint(0).x = dpt[0]; Nodes.IntPoint(0).y = pt[0];
2458 Nodes.IntPoint(1).x = dpt[1]; Nodes.IntPoint(1).y = pt[0];
2459 Nodes.IntPoint(2).x = dpt[2]; Nodes.IntPoint(2).y = pt[0];
2460 // x = 1 (pt[3])
2461 Nodes.IntPoint(3).x = pt[3]; Nodes.IntPoint(3).y = dpt[0];
2462 Nodes.IntPoint(4).x = pt[3]; Nodes.IntPoint(4).y = dpt[1];
2463 Nodes.IntPoint(5).x = pt[3]; Nodes.IntPoint(5).y = dpt[2];
2464 // y = 1 (pt[3])
2465 Nodes.IntPoint(6).x = dpt[2]; Nodes.IntPoint(6).y = pt[3];
2466 Nodes.IntPoint(7).x = dpt[1]; Nodes.IntPoint(7).y = pt[3];
2467 Nodes.IntPoint(8).x = dpt[0]; Nodes.IntPoint(8).y = pt[3];
2468 // x = 0 (pt[0])
2469 Nodes.IntPoint(9).x = pt[0]; Nodes.IntPoint(9).y = dpt[2];
2470 Nodes.IntPoint(10).x = pt[0]; Nodes.IntPoint(10).y = dpt[1];
2471 Nodes.IntPoint(11).x = pt[0]; Nodes.IntPoint(11).y = dpt[0];
2472 // x = pt[1] (interior)
2473 Nodes.IntPoint(12).x = pt[1]; Nodes.IntPoint(12).y = dpt[0];
2474 Nodes.IntPoint(13).x = pt[1]; Nodes.IntPoint(13).y = dpt[1];
2475 Nodes.IntPoint(14).x = pt[1]; Nodes.IntPoint(14).y = dpt[2];
2476 // x = pt[2] (interior)
2477 Nodes.IntPoint(15).x = pt[2]; Nodes.IntPoint(15).y = dpt[0];
2478 Nodes.IntPoint(16).x = pt[2]; Nodes.IntPoint(16).y = dpt[1];
2479 Nodes.IntPoint(17).x = pt[2]; Nodes.IntPoint(17).y = dpt[2];
2480 // y = pt[1] (interior)
2481 Nodes.IntPoint(18).x = dpt[0]; Nodes.IntPoint(18).y = pt[1];
2482 Nodes.IntPoint(19).x = dpt[1]; Nodes.IntPoint(19).y = pt[1];
2483 Nodes.IntPoint(20).x = dpt[2]; Nodes.IntPoint(20).y = pt[1];
2484 // y = pt[2] (interior)
2485 Nodes.IntPoint(21).x = dpt[0]; Nodes.IntPoint(21).y = pt[2];
2486 Nodes.IntPoint(22).x = dpt[1]; Nodes.IntPoint(22).y = pt[2];
2487 Nodes.IntPoint(23).x = dpt[2]; Nodes.IntPoint(23).y = pt[2];
2488}
2489
2491 DenseMatrix &shape) const
2492{
2493 real_t x = ip.x, y = ip.y;
2494
2495 real_t ax0 = pt[0] - x;
2496 real_t ax1 = pt[1] - x;
2497 real_t ax2 = pt[2] - x;
2498 real_t ax3 = pt[3] - x;
2499
2500 real_t by0 = dpt[0] - y;
2501 real_t by1 = dpt[1] - y;
2502 real_t by2 = dpt[2] - y;
2503
2504 real_t ay0 = pt[0] - y;
2505 real_t ay1 = pt[1] - y;
2506 real_t ay2 = pt[2] - y;
2507 real_t ay3 = pt[3] - y;
2508
2509 real_t bx0 = dpt[0] - x;
2510 real_t bx1 = dpt[1] - x;
2511 real_t bx2 = dpt[2] - x;
2512
2513 real_t A01 = pt[0] - pt[1];
2514 real_t A02 = pt[0] - pt[2];
2515 real_t A12 = pt[1] - pt[2];
2516 real_t A03 = pt[0] - pt[3];
2517 real_t A13 = pt[1] - pt[3];
2518 real_t A23 = pt[2] - pt[3];
2519
2520 real_t B01 = dpt[0] - dpt[1];
2521 real_t B02 = dpt[0] - dpt[2];
2522 real_t B12 = dpt[1] - dpt[2];
2523
2524 real_t tx0 = (bx1*bx2)/(B01*B02);
2525 real_t tx1 = -(bx0*bx2)/(B01*B12);
2526 real_t tx2 = (bx0*bx1)/(B02*B12);
2527
2528 real_t ty0 = (by1*by2)/(B01*B02);
2529 real_t ty1 = -(by0*by2)/(B01*B12);
2530 real_t ty2 = (by0*by1)/(B02*B12);
2531
2532 // y = 0 (p[0])
2533 shape(0, 0) = 0;
2534 shape(0, 1) = (ay1*ay2*ay3)/(A01*A02*A03)*tx0;
2535 shape(1, 0) = 0;
2536 shape(1, 1) = (ay1*ay2*ay3)/(A01*A02*A03)*tx1;
2537 shape(2, 0) = 0;
2538 shape(2, 1) = (ay1*ay2*ay3)/(A01*A02*A03)*tx2;
2539 // x = 1 (p[3])
2540 shape(3, 0) = (ax0*ax1*ax2)/(A03*A13*A23)*ty0;
2541 shape(3, 1) = 0;
2542 shape(4, 0) = (ax0*ax1*ax2)/(A03*A13*A23)*ty1;
2543 shape(4, 1) = 0;
2544 shape(5, 0) = (ax0*ax1*ax2)/(A03*A13*A23)*ty2;
2545 shape(5, 1) = 0;
2546 // y = 1 (p[3])
2547 shape(6, 0) = 0;
2548 shape(6, 1) = (ay0*ay1*ay2)/(A03*A13*A23)*tx2;
2549 shape(7, 0) = 0;
2550 shape(7, 1) = (ay0*ay1*ay2)/(A03*A13*A23)*tx1;
2551 shape(8, 0) = 0;
2552 shape(8, 1) = (ay0*ay1*ay2)/(A03*A13*A23)*tx0;
2553 // x = 0 (p[0])
2554 shape(9, 0) = (ax1*ax2*ax3)/(A01*A02*A03)*ty2;
2555 shape(9, 1) = 0;
2556 shape(10, 0) = (ax1*ax2*ax3)/(A01*A02*A03)*ty1;
2557 shape(10, 1) = 0;
2558 shape(11, 0) = (ax1*ax2*ax3)/(A01*A02*A03)*ty0;
2559 shape(11, 1) = 0;
2560 // x = p[1] (interior)
2561 shape(12, 0) = (ax0*ax2*ax3)/(A01*A12*A13)*ty0;
2562 shape(12, 1) = 0;
2563 shape(13, 0) = (ax0*ax2*ax3)/(A01*A12*A13)*ty1;
2564 shape(13, 1) = 0;
2565 shape(14, 0) = (ax0*ax2*ax3)/(A01*A12*A13)*ty2;
2566 shape(14, 1) = 0;
2567 // x = p[2] (interior)
2568 shape(15, 0) = -(ax0*ax1*ax3)/(A02*A12*A23)*ty0;
2569 shape(15, 1) = 0;
2570 shape(16, 0) = -(ax0*ax1*ax3)/(A02*A12*A23)*ty1;
2571 shape(16, 1) = 0;
2572 shape(17, 0) = -(ax0*ax1*ax3)/(A02*A12*A23)*ty2;
2573 shape(17, 1) = 0;
2574 // y = p[1] (interior)
2575 shape(18, 0) = 0;
2576 shape(18, 1) = (ay0*ay2*ay3)/(A01*A12*A13)*tx0;
2577 shape(19, 0) = 0;
2578 shape(19, 1) = (ay0*ay2*ay3)/(A01*A12*A13)*tx1;
2579 shape(20, 0) = 0;
2580 shape(20, 1) = (ay0*ay2*ay3)/(A01*A12*A13)*tx2;
2581 // y = p[2] (interior)
2582 shape(21, 0) = 0;
2583 shape(21, 1) = -(ay0*ay1*ay3)/(A02*A12*A23)*tx0;
2584 shape(22, 0) = 0;
2585 shape(22, 1) = -(ay0*ay1*ay3)/(A02*A12*A23)*tx1;
2586 shape(23, 0) = 0;
2587 shape(23, 1) = -(ay0*ay1*ay3)/(A02*A12*A23)*tx2;
2588}
2589
2591 Vector &divshape) const
2592{
2593 real_t x = ip.x, y = ip.y;
2594
2595 real_t a01 = pt[0]*pt[1];
2596 real_t a02 = pt[0]*pt[2];
2597 real_t a12 = pt[1]*pt[2];
2598 real_t a03 = pt[0]*pt[3];
2599 real_t a13 = pt[1]*pt[3];
2600 real_t a23 = pt[2]*pt[3];
2601
2602 real_t bx0 = dpt[0] - x;
2603 real_t bx1 = dpt[1] - x;
2604 real_t bx2 = dpt[2] - x;
2605
2606 real_t by0 = dpt[0] - y;
2607 real_t by1 = dpt[1] - y;
2608 real_t by2 = dpt[2] - y;
2609
2610 real_t A01 = pt[0] - pt[1];
2611 real_t A02 = pt[0] - pt[2];
2612 real_t A12 = pt[1] - pt[2];
2613 real_t A03 = pt[0] - pt[3];
2614 real_t A13 = pt[1] - pt[3];
2615 real_t A23 = pt[2] - pt[3];
2616
2617 real_t A012 = pt[0] + pt[1] + pt[2];
2618 real_t A013 = pt[0] + pt[1] + pt[3];
2619 real_t A023 = pt[0] + pt[2] + pt[3];
2620 real_t A123 = pt[1] + pt[2] + pt[3];
2621
2622 real_t B01 = dpt[0] - dpt[1];
2623 real_t B02 = dpt[0] - dpt[2];
2624 real_t B12 = dpt[1] - dpt[2];
2625
2626 real_t tx0 = (bx1*bx2)/(B01*B02);
2627 real_t tx1 = -(bx0*bx2)/(B01*B12);
2628 real_t tx2 = (bx0*bx1)/(B02*B12);
2629
2630 real_t ty0 = (by1*by2)/(B01*B02);
2631 real_t ty1 = -(by0*by2)/(B01*B12);
2632 real_t ty2 = (by0*by1)/(B02*B12);
2633
2634 // y = 0 (p[0])
2635 divshape(0) = -(a12 + a13 + a23 - 2.*A123*y + 3.*y*y)/(A01*A02*A03)*tx0;
2636 divshape(1) = -(a12 + a13 + a23 - 2.*A123*y + 3.*y*y)/(A01*A02*A03)*tx1;
2637 divshape(2) = -(a12 + a13 + a23 - 2.*A123*y + 3.*y*y)/(A01*A02*A03)*tx2;
2638 // x = 1 (p[3])
2639 divshape(3) = -(a01 + a02 + a12 - 2.*A012*x + 3.*x*x)/(A03*A13*A23)*ty0;
2640 divshape(4) = -(a01 + a02 + a12 - 2.*A012*x + 3.*x*x)/(A03*A13*A23)*ty1;
2641 divshape(5) = -(a01 + a02 + a12 - 2.*A012*x + 3.*x*x)/(A03*A13*A23)*ty2;
2642 // y = 1 (p[3])
2643 divshape(6) = -(a01 + a02 + a12 - 2.*A012*y + 3.*y*y)/(A03*A13*A23)*tx2;
2644 divshape(7) = -(a01 + a02 + a12 - 2.*A012*y + 3.*y*y)/(A03*A13*A23)*tx1;
2645 divshape(8) = -(a01 + a02 + a12 - 2.*A012*y + 3.*y*y)/(A03*A13*A23)*tx0;
2646 // x = 0 (p[0])
2647 divshape(9) = -(a12 + a13 + a23 - 2.*A123*x + 3.*x*x)/(A01*A02*A03)*ty2;
2648 divshape(10) = -(a12 + a13 + a23 - 2.*A123*x + 3.*x*x)/(A01*A02*A03)*ty1;
2649 divshape(11) = -(a12 + a13 + a23 - 2.*A123*x + 3.*x*x)/(A01*A02*A03)*ty0;
2650 // x = p[1] (interior)
2651 divshape(12) = -(a02 + a03 + a23 - 2.*A023*x + 3.*x*x)/(A01*A12*A13)*ty0;
2652 divshape(13) = -(a02 + a03 + a23 - 2.*A023*x + 3.*x*x)/(A01*A12*A13)*ty1;
2653 divshape(14) = -(a02 + a03 + a23 - 2.*A023*x + 3.*x*x)/(A01*A12*A13)*ty2;
2654 // x = p[2] (interior)
2655 divshape(15) = (a01 + a03 + a13 - 2.*A013*x + 3.*x*x)/(A02*A12*A23)*ty0;
2656 divshape(16) = (a01 + a03 + a13 - 2.*A013*x + 3.*x*x)/(A02*A12*A23)*ty1;
2657 divshape(17) = (a01 + a03 + a13 - 2.*A013*x + 3.*x*x)/(A02*A12*A23)*ty2;
2658 // y = p[1] (interior)
2659 divshape(18) = -(a02 + a03 + a23 - 2.*A023*y + 3.*y*y)/(A01*A12*A13)*tx0;
2660 divshape(19) = -(a02 + a03 + a23 - 2.*A023*y + 3.*y*y)/(A01*A12*A13)*tx1;
2661 divshape(20) = -(a02 + a03 + a23 - 2.*A023*y + 3.*y*y)/(A01*A12*A13)*tx2;
2662 // y = p[2] (interior)
2663 divshape(21) = (a01 + a03 + a13 - 2.*A013*y + 3.*y*y)/(A02*A12*A23)*tx0;
2664 divshape(22) = (a01 + a03 + a13 - 2.*A013*y + 3.*y*y)/(A02*A12*A23)*tx1;
2665 divshape(23) = (a01 + a03 + a13 - 2.*A013*y + 3.*y*y)/(A02*A12*A23)*tx2;
2666}
2667
2668const real_t RT2QuadFiniteElement::nk[24][2] =
2669{
2670 // y = 0
2671 {0,-1}, {0,-1}, {0,-1},
2672 // x = 1
2673 {1, 0}, {1, 0}, {1, 0},
2674 // y = 1
2675 {0, 1}, {0, 1}, {0, 1},
2676 // x = 0
2677 {-1,0}, {-1,0}, {-1,0},
2678 // x = p[1] (interior)
2679 {1, 0}, {1, 0}, {1, 0},
2680 // x = p[2] (interior)
2681 {1, 0}, {1, 0}, {1, 0},
2682 // y = p[1] (interior)
2683 {0, 1}, {0, 1}, {0, 1},
2684 // y = p[1] (interior)
2685 {0, 1}, {0, 1}, {0, 1}
2686};
2687
2689 ElementTransformation &Trans, DenseMatrix &I) const
2690{
2691 int k, j;
2692#ifdef MFEM_THREAD_SAFE
2694#endif
2695
2696#ifdef MFEM_DEBUG
2697 for (k = 0; k < 24; k++)
2698 {
2700 for (j = 0; j < 24; j++)
2701 {
2702 real_t d = vshape(j,0)*nk[k][0]+vshape(j,1)*nk[k][1];
2703 if (j == k) { d -= 1.0; }
2704 if (fabs(d) > 1.0e-12)
2705 {
2706 mfem::err << "RT2QuadFiniteElement::GetLocalInterpolation (...)\n"
2707 " k = " << k << ", j = " << j << ", d = " << d << endl;
2708 mfem_error();
2709 }
2710 }
2711 }
2712#endif
2713
2715 ip.x = ip.y = 0.0;
2716 Trans.SetIntPoint (&ip);
2717 // Trans must be linear (more to have embedding?)
2718 // set Jinv = |J| J^{-t} = adj(J)^t
2719 const DenseMatrix &Jinv = Trans.TransposeAdjugateJacobian();
2720
2721 real_t vk[2];
2722 Vector xk (vk, 2);
2723
2724 for (k = 0; k < 24; k++)
2725 {
2726 Trans.Transform (Nodes.IntPoint (k), xk);
2727 ip.x = vk[0]; ip.y = vk[1];
2728 CalcVShape (ip, vshape);
2729 // vk = |J| J^{-t} nk
2730 vk[0] = Jinv(0,0)*nk[k][0]+Jinv(0,1)*nk[k][1];
2731 vk[1] = Jinv(1,0)*nk[k][0]+Jinv(1,1)*nk[k][1];
2732 for (j = 0; j < 24; j++)
2733 if (fabs (I(k,j) = vshape(j,0)*vk[0]+vshape(j,1)*vk[1]) < 1.0e-12)
2734 {
2735 I(k,j) = 0.0;
2736 }
2737 }
2738}
2739
2741 VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const
2742{
2743 real_t vk[2];
2744 Vector xk (vk, 2);
2745
2746 for (int k = 0; k < 24; k++)
2747 {
2748 Trans.SetIntPoint (&Nodes.IntPoint (k));
2749 // set Jinv = |J| J^{-t} = adj(J)^t
2750 const DenseMatrix &Jinv = Trans.TransposeAdjugateJacobian();
2751
2752 vc.Eval (xk, Trans, Nodes.IntPoint (k));
2753 // xk^t |J| J^{-t} nk
2754 dofs(k) = (vk[0] * ( Jinv(0,0)*nk[k][0]+Jinv(0,1)*nk[k][1] ) +
2755 vk[1] * ( Jinv(1,0)*nk[k][0]+Jinv(1,1)*nk[k][1] ));
2756 }
2757}
2758
2760 : NodalFiniteElement(1, Geometry::SEGMENT, 2, 1)
2761{
2762 Nodes.IntPoint(0).x = 0.33333333333333333333;
2763 Nodes.IntPoint(1).x = 0.66666666666666666667;
2764}
2765
2767 Vector &shape) const
2768{
2769 real_t x = ip.x;
2770
2771 shape(0) = 2. - 3. * x;
2772 shape(1) = 3. * x - 1.;
2773}
2774
2776 DenseMatrix &dshape) const
2777{
2778 dshape(0,0) = -3.;
2779 dshape(1,0) = 3.;
2780}
2781
2782
2784 : NodalFiniteElement(1, Geometry::SEGMENT, 3, 2)
2785{
2786 const real_t p = 0.11270166537925831148;
2787
2788 Nodes.IntPoint(0).x = p;
2789 Nodes.IntPoint(1).x = 0.5;
2790 Nodes.IntPoint(2).x = 1.-p;
2791}
2792
2794 Vector &shape) const
2795{
2796 const real_t p = 0.11270166537925831148;
2797 const real_t w = 1./((1-2*p)*(1-2*p));
2798 real_t x = ip.x;
2799
2800 shape(0) = (2*x-1)*(x-1+p)*w;
2801 shape(1) = 4*(x-1+p)*(p-x)*w;
2802 shape(2) = (2*x-1)*(x-p)*w;
2803}
2804
2806 DenseMatrix &dshape) const
2807{
2808 const real_t p = 0.11270166537925831148;
2809 const real_t w = 1./((1-2*p)*(1-2*p));
2810 real_t x = ip.x;
2811
2812 dshape(0,0) = (-3+4*x+2*p)*w;
2813 dshape(1,0) = (4-8*x)*w;
2814 dshape(2,0) = (-1+4*x-2*p)*w;
2815}
2816
2817
2819 : NodalFiniteElement(1, Geometry::SEGMENT, degree+1, degree)
2820{
2821 int i, m = degree;
2822
2823 Nodes.IntPoint(0).x = 0.0;
2824 Nodes.IntPoint(1).x = 1.0;
2825 for (i = 1; i < m; i++)
2826 {
2827 Nodes.IntPoint(i+1).x = real_t(i) / m;
2828 }
2829
2830 rwk.SetSize(degree+1);
2831#ifndef MFEM_THREAD_SAFE
2832 rxxk.SetSize(degree+1);
2833#endif
2834
2835 rwk(0) = 1.0;
2836 for (i = 1; i <= m; i++)
2837 {
2838 rwk(i) = rwk(i-1) * ( (real_t)(m) / (real_t)(i) );
2839 }
2840 for (i = 0; i < m/2+1; i++)
2841 {
2842 rwk(m-i) = ( rwk(i) *= rwk(m-i) );
2843 }
2844 for (i = m-1; i >= 0; i -= 2)
2845 {
2846 rwk(i) = -rwk(i);
2847 }
2848}
2849
2851 Vector &shape) const
2852{
2853 real_t w, wk, x = ip.x;
2854 int i, k, m = GetOrder();
2855
2856#ifdef MFEM_THREAD_SAFE
2857 Vector rxxk(m+1);
2858#endif
2859
2860 k = (int) floor ( m * x + 0.5 );
2861 k = k > m ? m : k < 0 ? 0 : k; // clamp k to [0,m]
2862
2863 wk = 1.0;
2864 for (i = 0; i <= m; i++)
2865 if (i != k)
2866 {
2867 wk *= ( rxxk(i) = x - (real_t)(i) / m );
2868 }
2869 w = wk * ( rxxk(k) = x - (real_t)(k) / m );
2870
2871 if (k != 0)
2872 {
2873 shape(0) = w * rwk(0) / rxxk(0);
2874 }
2875 else
2876 {
2877 shape(0) = wk * rwk(0);
2878 }
2879 if (k != m)
2880 {
2881 shape(1) = w * rwk(m) / rxxk(m);
2882 }
2883 else
2884 {
2885 shape(1) = wk * rwk(k);
2886 }
2887 for (i = 1; i < m; i++)
2888 if (i != k)
2889 {
2890 shape(i+1) = w * rwk(i) / rxxk(i);
2891 }
2892 else
2893 {
2894 shape(k+1) = wk * rwk(k);
2895 }
2896}
2897
2899 DenseMatrix &dshape) const
2900{
2901 real_t s, srx, w, wk, x = ip.x;
2902 int i, k, m = GetOrder();
2903
2904#ifdef MFEM_THREAD_SAFE
2905 Vector rxxk(m+1);
2906#endif
2907
2908 k = (int) floor ( m * x + 0.5 );
2909 k = k > m ? m : k < 0 ? 0 : k; // clamp k to [0,m]
2910
2911 wk = 1.0;
2912 for (i = 0; i <= m; i++)
2913 if (i != k)
2914 {
2915 wk *= ( rxxk(i) = x - (real_t)(i) / m );
2916 }
2917 w = wk * ( rxxk(k) = x - (real_t)(k) / m );
2918
2919 for (i = 0; i <= m; i++)
2920 {
2921 rxxk(i) = 1.0 / rxxk(i);
2922 }
2923 srx = 0.0;
2924 for (i = 0; i <= m; i++)
2925 if (i != k)
2926 {
2927 srx += rxxk(i);
2928 }
2929 s = w * srx + wk;
2930
2931 if (k != 0)
2932 {
2933 dshape(0,0) = (s - w * rxxk(0)) * rwk(0) * rxxk(0);
2934 }
2935 else
2936 {
2937 dshape(0,0) = wk * srx * rwk(0);
2938 }
2939 if (k != m)
2940 {
2941 dshape(1,0) = (s - w * rxxk(m)) * rwk(m) * rxxk(m);
2942 }
2943 else
2944 {
2945 dshape(1,0) = wk * srx * rwk(k);
2946 }
2947 for (i = 1; i < m; i++)
2948 if (i != k)
2949 {
2950 dshape(i+1,0) = (s - w * rxxk(i)) * rwk(i) * rxxk(i);
2951 }
2952 else
2953 {
2954 dshape(k+1,0) = wk * srx * rwk(k);
2955 }
2956}
2957
2958
2960 : NodalFiniteElement(3, Geometry::TETRAHEDRON, 4, 1)
2961{
2962 Nodes.IntPoint(0).x = 0.33333333333333333333;
2963 Nodes.IntPoint(0).y = 0.33333333333333333333;
2964 Nodes.IntPoint(0).z = 0.33333333333333333333;
2965
2966 Nodes.IntPoint(1).x = 0.0;
2967 Nodes.IntPoint(1).y = 0.33333333333333333333;
2968 Nodes.IntPoint(1).z = 0.33333333333333333333;
2969
2970 Nodes.IntPoint(2).x = 0.33333333333333333333;
2971 Nodes.IntPoint(2).y = 0.0;
2972 Nodes.IntPoint(2).z = 0.33333333333333333333;
2973
2974 Nodes.IntPoint(3).x = 0.33333333333333333333;
2975 Nodes.IntPoint(3).y = 0.33333333333333333333;
2976 Nodes.IntPoint(3).z = 0.0;
2977
2978}
2979
2981 Vector &shape) const
2982{
2983 real_t L0, L1, L2, L3;
2984
2985 L1 = ip.x; L2 = ip.y; L3 = ip.z; L0 = 1.0 - L1 - L2 - L3;
2986 shape(0) = 1.0 - 3.0 * L0;
2987 shape(1) = 1.0 - 3.0 * L1;
2988 shape(2) = 1.0 - 3.0 * L2;
2989 shape(3) = 1.0 - 3.0 * L3;
2990}
2991
2993 DenseMatrix &dshape) const
2994{
2995 dshape(0,0) = 3.0; dshape(0,1) = 3.0; dshape(0,2) = 3.0;
2996 dshape(1,0) = -3.0; dshape(1,1) = 0.0; dshape(1,2) = 0.0;
2997 dshape(2,0) = 0.0; dshape(2,1) = -3.0; dshape(2,2) = 0.0;
2998 dshape(3,0) = 0.0; dshape(3,1) = 0.0; dshape(3,2) = -3.0;
2999}
3000
3001
3003 : NodalFiniteElement(3, Geometry::TETRAHEDRON, 1, 0)
3004{
3005 Nodes.IntPoint(0).x = 0.25;
3006 Nodes.IntPoint(0).y = 0.25;
3007 Nodes.IntPoint(0).z = 0.25;
3008}
3009
3011 Vector &shape) const
3012{
3013 shape(0) = 1.0;
3014}
3015
3017 DenseMatrix &dshape) const
3018{
3019 dshape(0,0) = 0.0; dshape(0,1) = 0.0; dshape(0,2) = 0.0;
3020}
3021
3022
3024 : NodalFiniteElement(3, Geometry::CUBE, 1, 0, FunctionSpace::Qk)
3025{
3026 Nodes.IntPoint(0).x = 0.5;
3027 Nodes.IntPoint(0).y = 0.5;
3028 Nodes.IntPoint(0).z = 0.5;
3029}
3030
3032 Vector &shape) const
3033{
3034 shape(0) = 1.0;
3035}
3036
3038 DenseMatrix &dshape) const
3039{
3040 dshape(0,0) = 0.0; dshape(0,1) = 0.0; dshape(0,2) = 0.0;
3041}
3042
3043
3045 : NodalFiniteElement(3, Geometry::PRISM, 1, 0, FunctionSpace::Qk)
3046{
3047 Nodes.IntPoint(0).x = 1.0 / 3.0;
3048 Nodes.IntPoint(0).y = 1.0 / 3.0;
3049 Nodes.IntPoint(0).z = 0.5;
3050}
3051
3053 Vector &shape) const
3054{
3055 shape(0) = 1.0;
3056}
3057
3059 DenseMatrix &dshape) const
3060{
3061 dshape(0,0) = 0.0; dshape(0,1) = 0.0; dshape(0,2) = 0.0;
3062}
3063
3064
3066 : NodalFiniteElement(3, Geometry::PYRAMID, 1, 0, FunctionSpace::Uk)
3067{
3068 Nodes.IntPoint(0).x = 0.375;
3069 Nodes.IntPoint(0).y = 0.375;
3070 Nodes.IntPoint(0).z = 0.25;
3071}
3072
3074 Vector &shape) const
3075{
3076 shape(0) = 1.0;
3077}
3078
3080 DenseMatrix &dshape) const
3081{
3082 dshape(0,0) = 0.0; dshape(0,1) = 0.0; dshape(0,2) = 0.0;
3083}
3084
3085
3087 : NodalFiniteElement(3, Geometry::CUBE, (degree+1)*(degree+1)*(degree+1),
3088 degree, FunctionSpace::Qk)
3089{
3090 if (degree == 2)
3091 {
3092 I = new int[dof];
3093 J = new int[dof];
3094 K = new int[dof];
3095 // nodes
3096 I[ 0] = 0; J[ 0] = 0; K[ 0] = 0;
3097 I[ 1] = 1; J[ 1] = 0; K[ 1] = 0;
3098 I[ 2] = 1; J[ 2] = 1; K[ 2] = 0;
3099 I[ 3] = 0; J[ 3] = 1; K[ 3] = 0;
3100 I[ 4] = 0; J[ 4] = 0; K[ 4] = 1;
3101 I[ 5] = 1; J[ 5] = 0; K[ 5] = 1;
3102 I[ 6] = 1; J[ 6] = 1; K[ 6] = 1;
3103 I[ 7] = 0; J[ 7] = 1; K[ 7] = 1;
3104 // edges
3105 I[ 8] = 2; J[ 8] = 0; K[ 8] = 0;
3106 I[ 9] = 1; J[ 9] = 2; K[ 9] = 0;
3107 I[10] = 2; J[10] = 1; K[10] = 0;
3108 I[11] = 0; J[11] = 2; K[11] = 0;
3109 I[12] = 2; J[12] = 0; K[12] = 1;
3110 I[13] = 1; J[13] = 2; K[13] = 1;
3111 I[14] = 2; J[14] = 1; K[14] = 1;
3112 I[15] = 0; J[15] = 2; K[15] = 1;
3113 I[16] = 0; J[16] = 0; K[16] = 2;
3114 I[17] = 1; J[17] = 0; K[17] = 2;
3115 I[18] = 1; J[18] = 1; K[18] = 2;
3116 I[19] = 0; J[19] = 1; K[19] = 2;
3117 // faces
3118 I[20] = 2; J[20] = 2; K[20] = 0;
3119 I[21] = 2; J[21] = 0; K[21] = 2;
3120 I[22] = 1; J[22] = 2; K[22] = 2;
3121 I[23] = 2; J[23] = 1; K[23] = 2;
3122 I[24] = 0; J[24] = 2; K[24] = 2;
3123 I[25] = 2; J[25] = 2; K[25] = 1;
3124 // element
3125 I[26] = 2; J[26] = 2; K[26] = 2;
3126 }
3127 else if (degree == 3)
3128 {
3129 I = new int[dof];
3130 J = new int[dof];
3131 K = new int[dof];
3132 // nodes
3133 I[ 0] = 0; J[ 0] = 0; K[ 0] = 0;
3134 I[ 1] = 1; J[ 1] = 0; K[ 1] = 0;
3135 I[ 2] = 1; J[ 2] = 1; K[ 2] = 0;
3136 I[ 3] = 0; J[ 3] = 1; K[ 3] = 0;
3137 I[ 4] = 0; J[ 4] = 0; K[ 4] = 1;
3138 I[ 5] = 1; J[ 5] = 0; K[ 5] = 1;
3139 I[ 6] = 1; J[ 6] = 1; K[ 6] = 1;
3140 I[ 7] = 0; J[ 7] = 1; K[ 7] = 1;
3141 // edges
3142 I[ 8] = 2; J[ 8] = 0; K[ 8] = 0;
3143 I[ 9] = 3; J[ 9] = 0; K[ 9] = 0;
3144 I[10] = 1; J[10] = 2; K[10] = 0;
3145 I[11] = 1; J[11] = 3; K[11] = 0;
3146 I[12] = 2; J[12] = 1; K[12] = 0;
3147 I[13] = 3; J[13] = 1; K[13] = 0;
3148 I[14] = 0; J[14] = 2; K[14] = 0;
3149 I[15] = 0; J[15] = 3; K[15] = 0;
3150 I[16] = 2; J[16] = 0; K[16] = 1;
3151 I[17] = 3; J[17] = 0; K[17] = 1;
3152 I[18] = 1; J[18] = 2; K[18] = 1;
3153 I[19] = 1; J[19] = 3; K[19] = 1;
3154 I[20] = 2; J[20] = 1; K[20] = 1;
3155 I[21] = 3; J[21] = 1; K[21] = 1;
3156 I[22] = 0; J[22] = 2; K[22] = 1;
3157 I[23] = 0; J[23] = 3; K[23] = 1;
3158 I[24] = 0; J[24] = 0; K[24] = 2;
3159 I[25] = 0; J[25] = 0; K[25] = 3;
3160 I[26] = 1; J[26] = 0; K[26] = 2;
3161 I[27] = 1; J[27] = 0; K[27] = 3;
3162 I[28] = 1; J[28] = 1; K[28] = 2;
3163 I[29] = 1; J[29] = 1; K[29] = 3;
3164 I[30] = 0; J[30] = 1; K[30] = 2;
3165 I[31] = 0; J[31] = 1; K[31] = 3;
3166 // faces
3167 I[32] = 2; J[32] = 3; K[32] = 0;
3168 I[33] = 3; J[33] = 3; K[33] = 0;
3169 I[34] = 2; J[34] = 2; K[34] = 0;
3170 I[35] = 3; J[35] = 2; K[35] = 0;
3171 I[36] = 2; J[36] = 0; K[36] = 2;
3172 I[37] = 3; J[37] = 0; K[37] = 2;
3173 I[38] = 2; J[38] = 0; K[38] = 3;
3174 I[39] = 3; J[39] = 0; K[39] = 3;
3175 I[40] = 1; J[40] = 2; K[40] = 2;
3176 I[41] = 1; J[41] = 3; K[41] = 2;
3177 I[42] = 1; J[42] = 2; K[42] = 3;
3178 I[43] = 1; J[43] = 3; K[43] = 3;
3179 I[44] = 3; J[44] = 1; K[44] = 2;
3180 I[45] = 2; J[45] = 1; K[45] = 2;
3181 I[46] = 3; J[46] = 1; K[46] = 3;
3182 I[47] = 2; J[47] = 1; K[47] = 3;
3183 I[48] = 0; J[48] = 3; K[48] = 2;
3184 I[49] = 0; J[49] = 2; K[49] = 2;
3185 I[50] = 0; J[50] = 3; K[50] = 3;
3186 I[51] = 0; J[51] = 2; K[51] = 3;
3187 I[52] = 2; J[52] = 2; K[52] = 1;
3188 I[53] = 3; J[53] = 2; K[53] = 1;
3189 I[54] = 2; J[54] = 3; K[54] = 1;
3190 I[55] = 3; J[55] = 3; K[55] = 1;
3191 // element
3192 I[56] = 2; J[56] = 2; K[56] = 2;
3193 I[57] = 3; J[57] = 2; K[57] = 2;
3194 I[58] = 3; J[58] = 3; K[58] = 2;
3195 I[59] = 2; J[59] = 3; K[59] = 2;
3196 I[60] = 2; J[60] = 2; K[60] = 3;
3197 I[61] = 3; J[61] = 2; K[61] = 3;
3198 I[62] = 3; J[62] = 3; K[62] = 3;
3199 I[63] = 2; J[63] = 3; K[63] = 3;
3200 }
3201 else
3202 {
3203 mfem_error ("LagrangeHexFiniteElement::LagrangeHexFiniteElement");
3204 }
3205
3206 fe1d = new Lagrange1DFiniteElement(degree);
3207 dof1d = fe1d -> GetDof();
3208
3209#ifndef MFEM_THREAD_SAFE
3210 shape1dx.SetSize(dof1d);
3211 shape1dy.SetSize(dof1d);
3212 shape1dz.SetSize(dof1d);
3213
3214 dshape1dx.SetSize(dof1d,1);
3215 dshape1dy.SetSize(dof1d,1);
3216 dshape1dz.SetSize(dof1d,1);
3217#endif
3218
3219 for (int n = 0; n < dof; n++)
3220 {
3221 Nodes.IntPoint(n).x = fe1d -> GetNodes().IntPoint(I[n]).x;
3222 Nodes.IntPoint(n).y = fe1d -> GetNodes().IntPoint(J[n]).x;
3223 Nodes.IntPoint(n).z = fe1d -> GetNodes().IntPoint(K[n]).x;
3224 }
3225}
3226
3228 Vector &shape) const
3229{
3230 IntegrationPoint ipy, ipz;
3231 ipy.x = ip.y;
3232 ipz.x = ip.z;
3233
3234#ifdef MFEM_THREAD_SAFE
3235 Vector shape1dx(dof1d), shape1dy(dof1d), shape1dz(dof1d);
3236#endif
3237
3238 fe1d -> CalcShape(ip, shape1dx);
3239 fe1d -> CalcShape(ipy, shape1dy);
3240 fe1d -> CalcShape(ipz, shape1dz);
3241
3242 for (int n = 0; n < dof; n++)
3243 {
3244 shape(n) = shape1dx(I[n]) * shape1dy(J[n]) * shape1dz(K[n]);
3245 }
3246}
3247
3249 DenseMatrix &dshape) const
3250{
3251 IntegrationPoint ipy, ipz;
3252 ipy.x = ip.y;
3253 ipz.x = ip.z;
3254
3255#ifdef MFEM_THREAD_SAFE
3256 Vector shape1dx(dof1d), shape1dy(dof1d), shape1dz(dof1d);
3257 DenseMatrix dshape1dx(dof1d,1), dshape1dy(dof1d,1), dshape1dz(dof1d,1);
3258#endif
3259
3260 fe1d -> CalcShape(ip, shape1dx);
3261 fe1d -> CalcShape(ipy, shape1dy);
3262 fe1d -> CalcShape(ipz, shape1dz);
3263
3264 fe1d -> CalcDShape(ip, dshape1dx);
3265 fe1d -> CalcDShape(ipy, dshape1dy);
3266 fe1d -> CalcDShape(ipz, dshape1dz);
3267
3268 for (int n = 0; n < dof; n++)
3269 {
3270 dshape(n,0) = dshape1dx(I[n],0) * shape1dy(J[n]) * shape1dz(K[n]);
3271 dshape(n,1) = shape1dx(I[n]) * dshape1dy(J[n],0) * shape1dz(K[n]);
3272 dshape(n,2) = shape1dx(I[n]) * shape1dy(J[n]) * dshape1dz(K[n],0);
3273 }
3274}
3275
3277{
3278 delete fe1d;
3279
3280 delete [] I;
3281 delete [] J;
3282 delete [] K;
3283}
3284
3285
3287 : NodalFiniteElement(1, Geometry::SEGMENT, 3, 4)
3288{
3289 Nodes.IntPoint(0).x = 0.0;
3290 Nodes.IntPoint(1).x = 1.0;
3291 Nodes.IntPoint(2).x = 0.5;
3292}
3293
3295 Vector &shape) const
3296{
3297 real_t x = ip.x;
3298
3299 if (x <= 0.5)
3300 {
3301 shape(0) = 1.0 - 2.0 * x;
3302 shape(1) = 0.0;
3303 shape(2) = 2.0 * x;
3304 }
3305 else
3306 {
3307 shape(0) = 0.0;
3308 shape(1) = 2.0 * x - 1.0;
3309 shape(2) = 2.0 - 2.0 * x;
3310 }
3311}
3312
3314 DenseMatrix &dshape) const
3315{
3316 real_t x = ip.x;
3317
3318 if (x <= 0.5)
3319 {
3320 dshape(0,0) = - 2.0;
3321 dshape(1,0) = 0.0;
3322 dshape(2,0) = 2.0;
3323 }
3324 else
3325 {
3326 dshape(0,0) = 0.0;
3327 dshape(1,0) = 2.0;
3328 dshape(2,0) = - 2.0;
3329 }
3330}
3331
3333 : NodalFiniteElement(2, Geometry::TRIANGLE, 6, 5)
3334{
3335 Nodes.IntPoint(0).x = 0.0;
3336 Nodes.IntPoint(0).y = 0.0;
3337 Nodes.IntPoint(1).x = 1.0;
3338 Nodes.IntPoint(1).y = 0.0;
3339 Nodes.IntPoint(2).x = 0.0;
3340 Nodes.IntPoint(2).y = 1.0;
3341 Nodes.IntPoint(3).x = 0.5;
3342 Nodes.IntPoint(3).y = 0.0;
3343 Nodes.IntPoint(4).x = 0.5;
3344 Nodes.IntPoint(4).y = 0.5;
3345 Nodes.IntPoint(5).x = 0.0;
3346 Nodes.IntPoint(5).y = 0.5;
3347}
3348
3350 Vector &shape) const
3351{
3352 int i;
3353
3354 real_t L0, L1, L2;
3355 L0 = 2.0 * ( 1. - ip.x - ip.y );
3356 L1 = 2.0 * ( ip.x );
3357 L2 = 2.0 * ( ip.y );
3358
3359 // The reference triangle is split in 4 triangles as follows:
3360 //
3361 // T0 - 0,3,5
3362 // T1 - 1,3,4
3363 // T2 - 2,4,5
3364 // T3 - 3,4,5
3365
3366 for (i = 0; i < 6; i++)
3367 {
3368 shape(i) = 0.0;
3369 }
3370
3371 if (L0 >= 1.0) // T0
3372 {
3373 shape(0) = L0 - 1.0;
3374 shape(3) = L1;
3375 shape(5) = L2;
3376 }
3377 else if (L1 >= 1.0) // T1
3378 {
3379 shape(3) = L0;
3380 shape(1) = L1 - 1.0;
3381 shape(4) = L2;
3382 }
3383 else if (L2 >= 1.0) // T2
3384 {
3385 shape(5) = L0;
3386 shape(4) = L1;
3387 shape(2) = L2 - 1.0;
3388 }
3389 else // T3
3390 {
3391 shape(3) = 1.0 - L2;
3392 shape(4) = 1.0 - L0;
3393 shape(5) = 1.0 - L1;
3394 }
3395}
3396
3398 DenseMatrix &dshape) const
3399{
3400 int i,j;
3401
3402 real_t L0, L1, L2;
3403 L0 = 2.0 * ( 1. - ip.x - ip.y );
3404 L1 = 2.0 * ( ip.x );
3405 L2 = 2.0 * ( ip.y );
3406
3407 real_t DL0[2], DL1[2], DL2[2];
3408 DL0[0] = -2.0; DL0[1] = -2.0;
3409 DL1[0] = 2.0; DL1[1] = 0.0;
3410 DL2[0] = 0.0; DL2[1] = 2.0;
3411
3412 for (i = 0; i < 6; i++)
3413 for (j = 0; j < 2; j++)
3414 {
3415 dshape(i,j) = 0.0;
3416 }
3417
3418 if (L0 >= 1.0) // T0
3419 {
3420 for (j = 0; j < 2; j++)
3421 {
3422 dshape(0,j) = DL0[j];
3423 dshape(3,j) = DL1[j];
3424 dshape(5,j) = DL2[j];
3425 }
3426 }
3427 else if (L1 >= 1.0) // T1
3428 {
3429 for (j = 0; j < 2; j++)
3430 {
3431 dshape(3,j) = DL0[j];
3432 dshape(1,j) = DL1[j];
3433 dshape(4,j) = DL2[j];
3434 }
3435 }
3436 else if (L2 >= 1.0) // T2
3437 {
3438 for (j = 0; j < 2; j++)
3439 {
3440 dshape(5,j) = DL0[j];
3441 dshape(4,j) = DL1[j];
3442 dshape(2,j) = DL2[j];
3443 }
3444 }
3445 else // T3
3446 {
3447 for (j = 0; j < 2; j++)
3448 {
3449 dshape(3,j) = - DL2[j];
3450 dshape(4,j) = - DL0[j];
3451 dshape(5,j) = - DL1[j];
3452 }
3453 }
3454}
3455
3457 : NodalFiniteElement(3, Geometry::TETRAHEDRON, 10, 4)
3458{
3459 Nodes.IntPoint(0).x = 0.0;
3460 Nodes.IntPoint(0).y = 0.0;
3461 Nodes.IntPoint(0).z = 0.0;
3462 Nodes.IntPoint(1).x = 1.0;
3463 Nodes.IntPoint(1).y = 0.0;
3464 Nodes.IntPoint(1).z = 0.0;
3465 Nodes.IntPoint(2).x = 0.0;
3466 Nodes.IntPoint(2).y = 1.0;
3467 Nodes.IntPoint(2).z = 0.0;
3468 Nodes.IntPoint(3).x = 0.0;
3469 Nodes.IntPoint(3).y = 0.0;
3470 Nodes.IntPoint(3).z = 1.0;
3471 Nodes.IntPoint(4).x = 0.5;
3472 Nodes.IntPoint(4).y = 0.0;
3473 Nodes.IntPoint(4).z = 0.0;
3474 Nodes.IntPoint(5).x = 0.0;
3475 Nodes.IntPoint(5).y = 0.5;
3476 Nodes.IntPoint(5).z = 0.0;
3477 Nodes.IntPoint(6).x = 0.0;
3478 Nodes.IntPoint(6).y = 0.0;
3479 Nodes.IntPoint(6).z = 0.5;
3480 Nodes.IntPoint(7).x = 0.5;
3481 Nodes.IntPoint(7).y = 0.5;
3482 Nodes.IntPoint(7).z = 0.0;
3483 Nodes.IntPoint(8).x = 0.5;
3484 Nodes.IntPoint(8).y = 0.0;
3485 Nodes.IntPoint(8).z = 0.5;
3486 Nodes.IntPoint(9).x = 0.0;
3487 Nodes.IntPoint(9).y = 0.5;
3488 Nodes.IntPoint(9).z = 0.5;
3489}
3490
3492 Vector &shape) const
3493{
3494 int i;
3495
3496 real_t L0, L1, L2, L3, L4, L5;
3497 L0 = 2.0 * ( 1. - ip.x - ip.y - ip.z );
3498 L1 = 2.0 * ( ip.x );
3499 L2 = 2.0 * ( ip.y );
3500 L3 = 2.0 * ( ip.z );
3501 L4 = 2.0 * ( ip.x + ip.y );
3502 L5 = 2.0 * ( ip.y + ip.z );
3503
3504 // The reference tetrahedron is split in 8 tetrahedra as follows:
3505 //
3506 // T0 - 0,4,5,6
3507 // T1 - 1,4,7,8
3508 // T2 - 2,5,7,9
3509 // T3 - 3,6,8,9
3510 // T4 - 4,5,6,8
3511 // T5 - 4,5,7,8
3512 // T6 - 5,6,8,9
3513 // T7 - 5,7,8,9
3514
3515 for (i = 0; i < 10; i++)
3516 {
3517 shape(i) = 0.0;
3518 }
3519
3520 if (L0 >= 1.0) // T0
3521 {
3522 shape(0) = L0 - 1.0;
3523 shape(4) = L1;
3524 shape(5) = L2;
3525 shape(6) = L3;
3526 }
3527 else if (L1 >= 1.0) // T1
3528 {
3529 shape(4) = L0;
3530 shape(1) = L1 - 1.0;
3531 shape(7) = L2;
3532 shape(8) = L3;
3533 }
3534 else if (L2 >= 1.0) // T2
3535 {
3536 shape(5) = L0;
3537 shape(7) = L1;
3538 shape(2) = L2 - 1.0;
3539 shape(9) = L3;
3540 }
3541 else if (L3 >= 1.0) // T3
3542 {
3543 shape(6) = L0;
3544 shape(8) = L1;
3545 shape(9) = L2;
3546 shape(3) = L3 - 1.0;
3547 }
3548 else if ((L4 <= 1.0) && (L5 <= 1.0)) // T4
3549 {
3550 shape(4) = 1.0 - L5;
3551 shape(5) = L2;
3552 shape(6) = 1.0 - L4;
3553 shape(8) = 1.0 - L0;
3554 }
3555 else if ((L4 >= 1.0) && (L5 <= 1.0)) // T5
3556 {
3557 shape(4) = 1.0 - L5;
3558 shape(5) = 1.0 - L1;
3559 shape(7) = L4 - 1.0;
3560 shape(8) = L3;
3561 }
3562 else if ((L4 <= 1.0) && (L5 >= 1.0)) // T6
3563 {
3564 shape(5) = 1.0 - L3;
3565 shape(6) = 1.0 - L4;
3566 shape(8) = L1;
3567 shape(9) = L5 - 1.0;
3568 }
3569 else if ((L4 >= 1.0) && (L5 >= 1.0)) // T7
3570 {
3571 shape(5) = L0;
3572 shape(7) = L4 - 1.0;
3573 shape(8) = 1.0 - L2;
3574 shape(9) = L5 - 1.0;
3575 }
3576}
3577
3579 DenseMatrix &dshape) const
3580{
3581 int i,j;
3582
3583 real_t L0, L1, L2, L3, L4, L5;
3584 L0 = 2.0 * ( 1. - ip.x - ip.y - ip.z );
3585 L1 = 2.0 * ( ip.x );
3586 L2 = 2.0 * ( ip.y );
3587 L3 = 2.0 * ( ip.z );
3588 L4 = 2.0 * ( ip.x + ip.y );
3589 L5 = 2.0 * ( ip.y + ip.z );
3590
3591 real_t DL0[3], DL1[3], DL2[3], DL3[3], DL4[3], DL5[3];
3592 DL0[0] = -2.0; DL0[1] = -2.0; DL0[2] = -2.0;
3593 DL1[0] = 2.0; DL1[1] = 0.0; DL1[2] = 0.0;
3594 DL2[0] = 0.0; DL2[1] = 2.0; DL2[2] = 0.0;
3595 DL3[0] = 0.0; DL3[1] = 0.0; DL3[2] = 2.0;
3596 DL4[0] = 2.0; DL4[1] = 2.0; DL4[2] = 0.0;
3597 DL5[0] = 0.0; DL5[1] = 2.0; DL5[2] = 2.0;
3598
3599 for (i = 0; i < 10; i++)
3600 for (j = 0; j < 3; j++)
3601 {
3602 dshape(i,j) = 0.0;
3603 }
3604
3605 if (L0 >= 1.0) // T0
3606 {
3607 for (j = 0; j < 3; j++)
3608 {
3609 dshape(0,j) = DL0[j];
3610 dshape(4,j) = DL1[j];
3611 dshape(5,j) = DL2[j];
3612 dshape(6,j) = DL3[j];
3613 }
3614 }
3615 else if (L1 >= 1.0) // T1
3616 {
3617 for (j = 0; j < 3; j++)
3618 {
3619 dshape(4,j) = DL0[j];
3620 dshape(1,j) = DL1[j];
3621 dshape(7,j) = DL2[j];
3622 dshape(8,j) = DL3[j];
3623 }
3624 }
3625 else if (L2 >= 1.0) // T2
3626 {
3627 for (j = 0; j < 3; j++)
3628 {
3629 dshape(5,j) = DL0[j];
3630 dshape(7,j) = DL1[j];
3631 dshape(2,j) = DL2[j];
3632 dshape(9,j) = DL3[j];
3633 }
3634 }
3635 else if (L3 >= 1.0) // T3
3636 {
3637 for (j = 0; j < 3; j++)
3638 {
3639 dshape(6,j) = DL0[j];
3640 dshape(8,j) = DL1[j];
3641 dshape(9,j) = DL2[j];
3642 dshape(3,j) = DL3[j];
3643 }
3644 }
3645 else if ((L4 <= 1.0) && (L5 <= 1.0)) // T4
3646 {
3647 for (j = 0; j < 3; j++)
3648 {
3649 dshape(4,j) = - DL5[j];
3650 dshape(5,j) = DL2[j];
3651 dshape(6,j) = - DL4[j];
3652 dshape(8,j) = - DL0[j];
3653 }
3654 }
3655 else if ((L4 >= 1.0) && (L5 <= 1.0)) // T5
3656 {
3657 for (j = 0; j < 3; j++)
3658 {
3659 dshape(4,j) = - DL5[j];
3660 dshape(5,j) = - DL1[j];
3661 dshape(7,j) = DL4[j];
3662 dshape(8,j) = DL3[j];
3663 }
3664 }
3665 else if ((L4 <= 1.0) && (L5 >= 1.0)) // T6
3666 {
3667 for (j = 0; j < 3; j++)
3668 {
3669 dshape(5,j) = - DL3[j];
3670 dshape(6,j) = - DL4[j];
3671 dshape(8,j) = DL1[j];
3672 dshape(9,j) = DL5[j];
3673 }
3674 }
3675 else if ((L4 >= 1.0) && (L5 >= 1.0)) // T7
3676 {
3677 for (j = 0; j < 3; j++)
3678 {
3679 dshape(5,j) = DL0[j];
3680 dshape(7,j) = DL4[j];
3681 dshape(8,j) = - DL2[j];
3682 dshape(9,j) = DL5[j];
3683 }
3684 }
3685}
3686
3687
3689 : NodalFiniteElement(2, Geometry::SQUARE, 9, 1, FunctionSpace::rQk)
3690{
3691 Nodes.IntPoint(0).x = 0.0;
3692 Nodes.IntPoint(0).y = 0.0;
3693 Nodes.IntPoint(1).x = 1.0;
3694 Nodes.IntPoint(1).y = 0.0;
3695 Nodes.IntPoint(2).x = 1.0;
3696 Nodes.IntPoint(2).y = 1.0;
3697 Nodes.IntPoint(3).x = 0.0;
3698 Nodes.IntPoint(3).y = 1.0;
3699 Nodes.IntPoint(4).x = 0.5;
3700 Nodes.IntPoint(4).y = 0.0;
3701 Nodes.IntPoint(5).x = 1.0;
3702 Nodes.IntPoint(5).y = 0.5;
3703 Nodes.IntPoint(6).x = 0.5;
3704 Nodes.IntPoint(6).y = 1.0;
3705 Nodes.IntPoint(7).x = 0.0;
3706 Nodes.IntPoint(7).y = 0.5;
3707 Nodes.IntPoint(8).x = 0.5;
3708 Nodes.IntPoint(8).y = 0.5;
3709}
3710
3712 Vector &shape) const
3713{
3714 int i;
3715 real_t x = ip.x, y = ip.y;
3716 real_t Lx, Ly;
3717 Lx = 2.0 * ( 1. - x );
3718 Ly = 2.0 * ( 1. - y );
3719
3720 // The reference square is split in 4 squares as follows:
3721 //
3722 // T0 - 0,4,7,8
3723 // T1 - 1,4,5,8
3724 // T2 - 2,5,6,8
3725 // T3 - 3,6,7,8
3726
3727 for (i = 0; i < 9; i++)
3728 {
3729 shape(i) = 0.0;
3730 }
3731
3732 if ((x <= 0.5) && (y <= 0.5)) // T0
3733 {
3734 shape(0) = (Lx - 1.0) * (Ly - 1.0);
3735 shape(4) = (2.0 - Lx) * (Ly - 1.0);
3736 shape(8) = (2.0 - Lx) * (2.0 - Ly);
3737 shape(7) = (Lx - 1.0) * (2.0 - Ly);
3738 }
3739 else if ((x >= 0.5) && (y <= 0.5)) // T1
3740 {
3741 shape(4) = Lx * (Ly - 1.0);
3742 shape(1) = (1.0 - Lx) * (Ly - 1.0);
3743 shape(5) = (1.0 - Lx) * (2.0 - Ly);
3744 shape(8) = Lx * (2.0 - Ly);
3745 }
3746 else if ((x >= 0.5) && (y >= 0.5)) // T2
3747 {
3748 shape(8) = Lx * Ly ;
3749 shape(5) = (1.0 - Lx) * Ly ;
3750 shape(2) = (1.0 - Lx) * (1.0 - Ly);
3751 shape(6) = Lx * (1.0 - Ly);
3752 }
3753 else if ((x <= 0.5) && (y >= 0.5)) // T3
3754 {
3755 shape(7) = (Lx - 1.0) * Ly ;
3756 shape(8) = (2.0 - Lx) * Ly ;
3757 shape(6) = (2.0 - Lx) * (1.0 - Ly);
3758 shape(3) = (Lx - 1.0) * (1.0 - Ly);
3759 }
3760}
3761
3763 DenseMatrix &dshape) const
3764{
3765 int i,j;
3766 real_t x = ip.x, y = ip.y;
3767 real_t Lx, Ly;
3768 Lx = 2.0 * ( 1. - x );
3769 Ly = 2.0 * ( 1. - y );
3770
3771 for (i = 0; i < 9; i++)
3772 for (j = 0; j < 2; j++)
3773 {
3774 dshape(i,j) = 0.0;
3775 }
3776
3777 if ((x <= 0.5) && (y <= 0.5)) // T0
3778 {
3779 dshape(0,0) = 2.0 * (1.0 - Ly);
3780 dshape(0,1) = 2.0 * (1.0 - Lx);
3781
3782 dshape(4,0) = 2.0 * (Ly - 1.0);
3783 dshape(4,1) = -2.0 * (2.0 - Lx);
3784
3785 dshape(8,0) = 2.0 * (2.0 - Ly);
3786 dshape(8,1) = 2.0 * (2.0 - Lx);
3787
3788 dshape(7,0) = -2.0 * (2.0 - Ly);
3789 dshape(7,0) = 2.0 * (Lx - 1.0);
3790 }
3791 else if ((x >= 0.5) && (y <= 0.5)) // T1
3792 {
3793 dshape(4,0) = -2.0 * (Ly - 1.0);
3794 dshape(4,1) = -2.0 * Lx;
3795
3796 dshape(1,0) = 2.0 * (Ly - 1.0);
3797 dshape(1,1) = -2.0 * (1.0 - Lx);
3798
3799 dshape(5,0) = 2.0 * (2.0 - Ly);
3800 dshape(5,1) = 2.0 * (1.0 - Lx);
3801
3802 dshape(8,0) = -2.0 * (2.0 - Ly);
3803 dshape(8,1) = 2.0 * Lx;
3804 }
3805 else if ((x >= 0.5) && (y >= 0.5)) // T2
3806 {
3807 dshape(8,0) = -2.0 * Ly;
3808 dshape(8,1) = -2.0 * Lx;
3809
3810 dshape(5,0) = 2.0 * Ly;
3811 dshape(5,1) = -2.0 * (1.0 - Lx);
3812
3813 dshape(2,0) = 2.0 * (1.0 - Ly);
3814 dshape(2,1) = 2.0 * (1.0 - Lx);
3815
3816 dshape(6,0) = -2.0 * (1.0 - Ly);
3817 dshape(6,1) = 2.0 * Lx;
3818 }
3819 else if ((x <= 0.5) && (y >= 0.5)) // T3
3820 {
3821 dshape(7,0) = -2.0 * Ly;
3822 dshape(7,1) = -2.0 * (Lx - 1.0);
3823
3824 dshape(8,0) = 2.0 * Ly ;
3825 dshape(8,1) = -2.0 * (2.0 - Lx);
3826
3827 dshape(6,0) = 2.0 * (1.0 - Ly);
3828 dshape(6,1) = 2.0 * (2.0 - Lx);
3829
3830 dshape(3,0) = -2.0 * (1.0 - Ly);
3831 dshape(3,1) = 2.0 * (Lx - 1.0);
3832 }
3833}
3834
3836 : NodalFiniteElement(3, Geometry::CUBE, 27, 2, FunctionSpace::rQk)
3837{
3838 real_t I[27];
3839 real_t J[27];
3840 real_t K[27];
3841 // nodes
3842 I[ 0] = 0.0; J[ 0] = 0.0; K[ 0] = 0.0;
3843 I[ 1] = 1.0; J[ 1] = 0.0; K[ 1] = 0.0;
3844 I[ 2] = 1.0; J[ 2] = 1.0; K[ 2] = 0.0;
3845 I[ 3] = 0.0; J[ 3] = 1.0; K[ 3] = 0.0;
3846 I[ 4] = 0.0; J[ 4] = 0.0; K[ 4] = 1.0;
3847 I[ 5] = 1.0; J[ 5] = 0.0; K[ 5] = 1.0;
3848 I[ 6] = 1.0; J[ 6] = 1.0; K[ 6] = 1.0;
3849 I[ 7] = 0.0; J[ 7] = 1.0; K[ 7] = 1.0;
3850 // edges
3851 I[ 8] = 0.5; J[ 8] = 0.0; K[ 8] = 0.0;
3852 I[ 9] = 1.0; J[ 9] = 0.5; K[ 9] = 0.0;
3853 I[10] = 0.5; J[10] = 1.0; K[10] = 0.0;
3854 I[11] = 0.0; J[11] = 0.5; K[11] = 0.0;
3855 I[12] = 0.5; J[12] = 0.0; K[12] = 1.0;
3856 I[13] = 1.0; J[13] = 0.5; K[13] = 1.0;
3857 I[14] = 0.5; J[14] = 1.0; K[14] = 1.0;
3858 I[15] = 0.0; J[15] = 0.5; K[15] = 1.0;
3859 I[16] = 0.0; J[16] = 0.0; K[16] = 0.5;
3860 I[17] = 1.0; J[17] = 0.0; K[17] = 0.5;
3861 I[18] = 1.0; J[18] = 1.0; K[18] = 0.5;
3862 I[19] = 0.0; J[19] = 1.0; K[19] = 0.5;
3863 // faces
3864 I[20] = 0.5; J[20] = 0.5; K[20] = 0.0;
3865 I[21] = 0.5; J[21] = 0.0; K[21] = 0.5;
3866 I[22] = 1.0; J[22] = 0.5; K[22] = 0.5;
3867 I[23] = 0.5; J[23] = 1.0; K[23] = 0.5;
3868 I[24] = 0.0; J[24] = 0.5; K[24] = 0.5;
3869 I[25] = 0.5; J[25] = 0.5; K[25] = 1.0;
3870 // element
3871 I[26] = 0.5; J[26] = 0.5; K[26] = 0.5;
3872
3873 for (int n = 0; n < 27; n++)
3874 {
3875 Nodes.IntPoint(n).x = I[n];
3876 Nodes.IntPoint(n).y = J[n];
3877 Nodes.IntPoint(n).z = K[n];
3878 }
3879}
3880
3882 Vector &shape) const
3883{
3884 int i, N[8];
3885 real_t Lx, Ly, Lz;
3886 real_t x = ip.x, y = ip.y, z = ip.z;
3887
3888 for (i = 0; i < 27; i++)
3889 {
3890 shape(i) = 0.0;
3891 }
3892
3893 if ((x <= 0.5) && (y <= 0.5) && (z <= 0.5)) // T0
3894 {
3895 Lx = 1.0 - 2.0 * x;
3896 Ly = 1.0 - 2.0 * y;
3897 Lz = 1.0 - 2.0 * z;
3898
3899 N[0] = 0;
3900 N[1] = 8;
3901 N[2] = 20;
3902 N[3] = 11;
3903 N[4] = 16;
3904 N[5] = 21;
3905 N[6] = 26;
3906 N[7] = 24;
3907 }
3908 else if ((x >= 0.5) && (y <= 0.5) && (z <= 0.5)) // T1
3909 {
3910 Lx = 2.0 - 2.0 * x;
3911 Ly = 1.0 - 2.0 * y;
3912 Lz = 1.0 - 2.0 * z;
3913
3914 N[0] = 8;
3915 N[1] = 1;
3916 N[2] = 9;
3917 N[3] = 20;
3918 N[4] = 21;
3919 N[5] = 17;
3920 N[6] = 22;
3921 N[7] = 26;
3922 }
3923 else if ((x <= 0.5) && (y >= 0.5) && (z <= 0.5)) // T2
3924 {
3925 Lx = 2.0 - 2.0 * x;
3926 Ly = 2.0 - 2.0 * y;
3927 Lz = 1.0 - 2.0 * z;
3928
3929 N[0] = 20;
3930 N[1] = 9;
3931 N[2] = 2;
3932 N[3] = 10;
3933 N[4] = 26;
3934 N[5] = 22;
3935 N[6] = 18;
3936 N[7] = 23;
3937 }
3938 else if ((x >= 0.5) && (y >= 0.5) && (z <= 0.5)) // T3
3939 {
3940 Lx = 1.0 - 2.0 * x;
3941 Ly = 2.0 - 2.0 * y;
3942 Lz = 1.0 - 2.0 * z;
3943
3944 N[0] = 11;
3945 N[1] = 20;
3946 N[2] = 10;
3947 N[3] = 3;
3948 N[4] = 24;
3949 N[5] = 26;
3950 N[6] = 23;
3951 N[7] = 19;
3952 }
3953 else if ((x <= 0.5) && (y <= 0.5) && (z >= 0.5)) // T4
3954 {
3955 Lx = 1.0 - 2.0 * x;
3956 Ly = 1.0 - 2.0 * y;
3957 Lz = 2.0 - 2.0 * z;
3958
3959 N[0] = 16;
3960 N[1] = 21;
3961 N[2] = 26;
3962 N[3] = 24;
3963 N[4] = 4;
3964 N[5] = 12;
3965 N[6] = 25;
3966 N[7] = 15;
3967 }
3968 else if ((x >= 0.5) && (y <= 0.5) && (z >= 0.5)) // T5
3969 {
3970 Lx = 2.0 - 2.0 * x;
3971 Ly = 1.0 - 2.0 * y;
3972 Lz = 2.0 - 2.0 * z;
3973
3974 N[0] = 21;
3975 N[1] = 17;
3976 N[2] = 22;
3977 N[3] = 26;
3978 N[4] = 12;
3979 N[5] = 5;
3980 N[6] = 13;
3981 N[7] = 25;
3982 }
3983 else if ((x <= 0.5) && (y >= 0.5) && (z >= 0.5)) // T6
3984 {
3985 Lx = 2.0 - 2.0 * x;
3986 Ly = 2.0 - 2.0 * y;
3987 Lz = 2.0 - 2.0 * z;
3988
3989 N[0] = 26;
3990 N[1] = 22;
3991 N[2] = 18;
3992 N[3] = 23;
3993 N[4] = 25;
3994 N[5] = 13;
3995 N[6] = 6;
3996 N[7] = 14;
3997 }
3998 else // T7
3999 {
4000 Lx = 1.0 - 2.0 * x;
4001 Ly = 2.0 - 2.0 * y;
4002 Lz = 2.0 - 2.0 * z;
4003
4004 N[0] = 24;
4005 N[1] = 26;
4006 N[2] = 23;
4007 N[3] = 19;
4008 N[4] = 15;
4009 N[5] = 25;
4010 N[6] = 14;
4011 N[7] = 7;
4012 }
4013
4014 shape(N[0]) = Lx * Ly * Lz;
4015 shape(N[1]) = (1 - Lx) * Ly * Lz;
4016 shape(N[2]) = (1 - Lx) * (1 - Ly) * Lz;
4017 shape(N[3]) = Lx * (1 - Ly) * Lz;
4018 shape(N[4]) = Lx * Ly * (1 - Lz);
4019 shape(N[5]) = (1 - Lx) * Ly * (1 - Lz);
4020 shape(N[6]) = (1 - Lx) * (1 - Ly) * (1 - Lz);
4021 shape(N[7]) = Lx * (1 - Ly) * (1 - Lz);
4022}
4023
4025 DenseMatrix &dshape) const
4026{
4027 int i, j, N[8];
4028 real_t Lx, Ly, Lz;
4029 real_t x = ip.x, y = ip.y, z = ip.z;
4030
4031 for (i = 0; i < 27; i++)
4032 for (j = 0; j < 3; j++)
4033 {
4034 dshape(i,j) = 0.0;
4035 }
4036
4037 if ((x <= 0.5) && (y <= 0.5) && (z <= 0.5)) // T0
4038 {
4039 Lx = 1.0 - 2.0 * x;
4040 Ly = 1.0 - 2.0 * y;
4041 Lz = 1.0 - 2.0 * z;
4042
4043 N[0] = 0;
4044 N[1] = 8;
4045 N[2] = 20;
4046 N[3] = 11;
4047 N[4] = 16;
4048 N[5] = 21;
4049 N[6] = 26;
4050 N[7] = 24;
4051 }
4052 else if ((x >= 0.5) && (y <= 0.5) && (z <= 0.5)) // T1
4053 {
4054 Lx = 2.0 - 2.0 * x;
4055 Ly = 1.0 - 2.0 * y;
4056 Lz = 1.0 - 2.0 * z;
4057
4058 N[0] = 8;
4059 N[1] = 1;
4060 N[2] = 9;
4061 N[3] = 20;
4062 N[4] = 21;
4063 N[5] = 17;
4064 N[6] = 22;
4065 N[7] = 26;
4066 }
4067 else if ((x <= 0.5) && (y >= 0.5) && (z <= 0.5)) // T2
4068 {
4069 Lx = 2.0 - 2.0 * x;
4070 Ly = 2.0 - 2.0 * y;
4071 Lz = 1.0 - 2.0 * z;
4072
4073 N[0] = 20;
4074 N[1] = 9;
4075 N[2] = 2;
4076 N[3] = 10;
4077 N[4] = 26;
4078 N[5] = 22;
4079 N[6] = 18;
4080 N[7] = 23;
4081 }
4082 else if ((x >= 0.5) && (y >= 0.5) && (z <= 0.5)) // T3
4083 {
4084 Lx = 1.0 - 2.0 * x;
4085 Ly = 2.0 - 2.0 * y;
4086 Lz = 1.0 - 2.0 * z;
4087
4088 N[0] = 11;
4089 N[1] = 20;
4090 N[2] = 10;
4091 N[3] = 3;
4092 N[4] = 24;
4093 N[5] = 26;
4094 N[6] = 23;
4095 N[7] = 19;
4096 }
4097 else if ((x <= 0.5) && (y <= 0.5) && (z >= 0.5)) // T4
4098 {
4099 Lx = 1.0 - 2.0 * x;
4100 Ly = 1.0 - 2.0 * y;
4101 Lz = 2.0 - 2.0 * z;
4102
4103 N[0] = 16;
4104 N[1] = 21;
4105 N[2] = 26;
4106 N[3] = 24;
4107 N[4] = 4;
4108 N[5] = 12;
4109 N[6] = 25;
4110 N[7] = 15;
4111 }
4112 else if ((x >= 0.5) && (y <= 0.5) && (z >= 0.5)) // T5
4113 {
4114 Lx = 2.0 - 2.0 * x;
4115 Ly = 1.0 - 2.0 * y;
4116 Lz = 2.0 - 2.0 * z;
4117
4118 N[0] = 21;
4119 N[1] = 17;
4120 N[2] = 22;
4121 N[3] = 26;
4122 N[4] = 12;
4123 N[5] = 5;
4124 N[6] = 13;
4125 N[7] = 25;
4126 }
4127 else if ((x <= 0.5) && (y >= 0.5) && (z >= 0.5)) // T6
4128 {
4129 Lx = 2.0 - 2.0 * x;
4130 Ly = 2.0 - 2.0 * y;
4131 Lz = 2.0 - 2.0 * z;
4132
4133 N[0] = 26;
4134 N[1] = 22;
4135 N[2] = 18;
4136 N[3] = 23;
4137 N[4] = 25;
4138 N[5] = 13;
4139 N[6] = 6;
4140 N[7] = 14;
4141 }
4142 else // T7
4143 {
4144 Lx = 1.0 - 2.0 * x;
4145 Ly = 2.0 - 2.0 * y;
4146 Lz = 2.0 - 2.0 * z;
4147
4148 N[0] = 24;
4149 N[1] = 26;
4150 N[2] = 23;
4151 N[3] = 19;
4152 N[4] = 15;
4153 N[5] = 25;
4154 N[6] = 14;
4155 N[7] = 7;
4156 }
4157
4158 dshape(N[0],0) = -2.0 * Ly * Lz ;
4159 dshape(N[0],1) = -2.0 * Lx * Lz ;
4160 dshape(N[0],2) = -2.0 * Lx * Ly ;
4161
4162 dshape(N[1],0) = 2.0 * Ly * Lz ;
4163 dshape(N[1],1) = -2.0 * (1 - Lx) * Lz ;
4164 dshape(N[1],2) = -2.0 * (1 - Lx) * Ly ;
4165
4166 dshape(N[2],0) = 2.0 * (1 - Ly) * Lz ;
4167 dshape(N[2],1) = 2.0 * (1 - Lx) * Lz ;
4168 dshape(N[2],2) = -2.0 * (1 - Lx) * (1 - Ly);
4169
4170 dshape(N[3],0) = -2.0 * (1 - Ly) * Lz ;
4171 dshape(N[3],1) = 2.0 * Lx * Lz ;
4172 dshape(N[3],2) = -2.0 * Lx * (1 - Ly);
4173
4174 dshape(N[4],0) = -2.0 * Ly * (1 - Lz);
4175 dshape(N[4],1) = -2.0 * Lx * (1 - Lz);
4176 dshape(N[4],2) = 2.0 * Lx * Ly ;
4177
4178 dshape(N[5],0) = 2.0 * Ly * (1 - Lz);
4179 dshape(N[5],1) = -2.0 * (1 - Lx) * (1 - Lz);
4180 dshape(N[5],2) = 2.0 * (1 - Lx) * Ly ;
4181
4182 dshape(N[6],0) = 2.0 * (1 - Ly) * (1 - Lz);
4183 dshape(N[6],1) = 2.0 * (1 - Lx) * (1 - Lz);
4184 dshape(N[6],2) = 2.0 * (1 - Lx) * (1 - Ly);
4185
4186 dshape(N[7],0) = -2.0 * (1 - Ly) * (1 - Lz);
4187 dshape(N[7],1) = 2.0 * Lx * (1 - Lz);
4188 dshape(N[7],2) = 2.0 * Lx * (1 - Ly);
4189}
4190
4191
4193 : VectorFiniteElement(3, Geometry::CUBE, 12, 1, H_CURL,
4194 FunctionSpace::Qk)
4195{
4196 // not real nodes ...
4197 Nodes.IntPoint(0).x = 0.5;
4198 Nodes.IntPoint(0).y = 0.0;
4199 Nodes.IntPoint(0).z = 0.0;
4200
4201 Nodes.IntPoint(1).x = 1.0;
4202 Nodes.IntPoint(1).y = 0.5;
4203 Nodes.IntPoint(1).z = 0.0;
4204
4205 Nodes.IntPoint(2).x = 0.5;
4206 Nodes.IntPoint(2).y = 1.0;
4207 Nodes.IntPoint(2).z = 0.0;
4208
4209 Nodes.IntPoint(3).x = 0.0;
4210 Nodes.IntPoint(3).y = 0.5;
4211 Nodes.IntPoint(3).z = 0.0;
4212
4213 Nodes.IntPoint(4).x = 0.5;
4214 Nodes.IntPoint(4).y = 0.0;
4215 Nodes.IntPoint(4).z = 1.0;
4216
4217 Nodes.IntPoint(5).x = 1.0;
4218 Nodes.IntPoint(5).y = 0.5;
4219 Nodes.IntPoint(5).z = 1.0;
4220
4221 Nodes.IntPoint(6).x = 0.5;
4222 Nodes.IntPoint(6).y = 1.0;
4223 Nodes.IntPoint(6).z = 1.0;
4224
4225 Nodes.IntPoint(7).x = 0.0;
4226 Nodes.IntPoint(7).y = 0.5;
4227 Nodes.IntPoint(7).z = 1.0;
4228
4229 Nodes.IntPoint(8).x = 0.0;
4230 Nodes.IntPoint(8).y = 0.0;
4231 Nodes.IntPoint(8).z = 0.5;
4232
4233 Nodes.IntPoint(9).x = 1.0;
4234 Nodes.IntPoint(9).y = 0.0;
4235 Nodes.IntPoint(9).z = 0.5;
4236
4237 Nodes.IntPoint(10).x= 1.0;
4238 Nodes.IntPoint(10).y= 1.0;
4239 Nodes.IntPoint(10).z= 0.5;
4240
4241 Nodes.IntPoint(11).x= 0.0;
4242 Nodes.IntPoint(11).y= 1.0;
4243 Nodes.IntPoint(11).z= 0.5;
4244}
4245
4247 DenseMatrix &shape) const
4248{
4249 real_t x = ip.x, y = ip.y, z = ip.z;
4250
4251 shape(0,0) = (1. - y) * (1. - z);
4252 shape(0,1) = 0.;
4253 shape(0,2) = 0.;
4254
4255 shape(2,0) = y * (1. - z);
4256 shape(2,1) = 0.;
4257 shape(2,2) = 0.;
4258
4259 shape(4,0) = z * (1. - y);
4260 shape(4,1) = 0.;
4261 shape(4,2) = 0.;
4262
4263 shape(6,0) = y * z;
4264 shape(6,1) = 0.;
4265 shape(6,2) = 0.;
4266
4267 shape(1,0) = 0.;
4268 shape(1,1) = x * (1. - z);
4269 shape(1,2) = 0.;
4270
4271 shape(3,0) = 0.;
4272 shape(3,1) = (1. - x) * (1. - z);
4273 shape(3,2) = 0.;
4274
4275 shape(5,0) = 0.;
4276 shape(5,1) = x * z;
4277 shape(5,2) = 0.;
4278
4279 shape(7,0) = 0.;
4280 shape(7,1) = (1. - x) * z;
4281 shape(7,2) = 0.;
4282
4283 shape(8,0) = 0.;
4284 shape(8,1) = 0.;
4285 shape(8,2) = (1. - x) * (1. - y);
4286
4287 shape(9,0) = 0.;
4288 shape(9,1) = 0.;
4289 shape(9,2) = x * (1. - y);
4290
4291 shape(10,0) = 0.;
4292 shape(10,1) = 0.;
4293 shape(10,2) = x * y;
4294
4295 shape(11,0) = 0.;
4296 shape(11,1) = 0.;
4297 shape(11,2) = y * (1. - x);
4298
4299}
4300
4302 DenseMatrix &curl_shape)
4303const
4304{
4305 real_t x = ip.x, y = ip.y, z = ip.z;
4306
4307 curl_shape(0,0) = 0.;
4308 curl_shape(0,1) = y - 1.;
4309 curl_shape(0,2) = 1. - z;
4310
4311 curl_shape(2,0) = 0.;
4312 curl_shape(2,1) = -y;
4313 curl_shape(2,2) = z - 1.;
4314
4315 curl_shape(4,0) = 0;
4316 curl_shape(4,1) = 1. - y;
4317 curl_shape(4,2) = z;
4318
4319 curl_shape(6,0) = 0.;
4320 curl_shape(6,1) = y;
4321 curl_shape(6,2) = -z;
4322
4323 curl_shape(1,0) = x;
4324 curl_shape(1,1) = 0.;
4325 curl_shape(1,2) = 1. - z;
4326
4327 curl_shape(3,0) = 1. - x;
4328 curl_shape(3,1) = 0.;
4329 curl_shape(3,2) = z - 1.;
4330
4331 curl_shape(5,0) = -x;
4332 curl_shape(5,1) = 0.;
4333 curl_shape(5,2) = z;
4334
4335 curl_shape(7,0) = x - 1.;
4336 curl_shape(7,1) = 0.;
4337 curl_shape(7,2) = -z;
4338
4339 curl_shape(8,0) = x - 1.;
4340 curl_shape(8,1) = 1. - y;
4341 curl_shape(8,2) = 0.;
4342
4343 curl_shape(9,0) = -x;
4344 curl_shape(9,1) = y - 1.;
4345 curl_shape(9,2) = 0;
4346
4347 curl_shape(10,0) = x;
4348 curl_shape(10,1) = -y;
4349 curl_shape(10,2) = 0.;
4350
4351 curl_shape(11,0) = 1. - x;
4352 curl_shape(11,1) = y;
4353 curl_shape(11,2) = 0.;
4354}
4355
4356const real_t Nedelec1HexFiniteElement::tk[12][3] =
4357{
4358 {1,0,0}, {0,1,0}, {1,0,0}, {0,1,0},
4359 {1,0,0}, {0,1,0}, {1,0,0}, {0,1,0},
4360 {0,0,1}, {0,0,1}, {0,0,1}, {0,0,1}
4361};
4362
4364 ElementTransformation &Trans, DenseMatrix &I) const
4365{
4366 int k, j;
4367#ifdef MFEM_THREAD_SAFE
4369#endif
4370
4371#ifdef MFEM_DEBUG
4372 for (k = 0; k < dof; k++)
4373 {
4375 for (j = 0; j < dof; j++)
4376 {
4377 real_t d = ( vshape(j,0)*tk[k][0] + vshape(j,1)*tk[k][1] +
4378 vshape(j,2)*tk[k][2] );
4379 if (j == k) { d -= 1.0; }
4380 if (fabs(d) > 1.0e-12)
4381 {
4382 mfem::err << "Nedelec1HexFiniteElement::GetLocalInterpolation (...)\n"
4383 " k = " << k << ", j = " << j << ", d = " << d << endl;
4384 mfem_error();
4385 }
4386 }
4387 }
4388#endif
4389
4391 ip.x = ip.y = ip.z = 0.0;
4392 Trans.SetIntPoint (&ip);
4393 // Trans must be linear (more to have embedding?)
4394 const DenseMatrix &J = Trans.Jacobian();
4395 real_t vk[3];
4396 Vector xk (vk, 3);
4397
4398 for (k = 0; k < dof; k++)
4399 {
4400 Trans.Transform (Nodes.IntPoint (k), xk);
4401 ip.x = vk[0]; ip.y = vk[1]; ip.z = vk[2];
4402 CalcVShape (ip, vshape);
4403 // vk = J tk
4404 vk[0] = J(0,0)*tk[k][0]+J(0,1)*tk[k][1]+J(0,2)*tk[k][2];
4405 vk[1] = J(1,0)*tk[k][0]+J(1,1)*tk[k][1]+J(1,2)*tk[k][2];
4406 vk[2] = J(2,0)*tk[k][0]+J(2,1)*tk[k][1]+J(2,2)*tk[k][2];
4407 for (j = 0; j < dof; j++)
4408 if (fabs (I(k,j) = (vshape(j,0)*vk[0]+vshape(j,1)*vk[1]+
4409 vshape(j,2)*vk[2])) < 1.0e-12)
4410 {
4411 I(k,j) = 0.0;
4412 }
4413 }
4414}
4415
4418 Vector &dofs) const
4419{
4420 real_t vk[3];
4421 Vector xk (vk, 3);
4422
4423 for (int k = 0; k < dof; k++)
4424 {
4425 Trans.SetIntPoint (&Nodes.IntPoint (k));
4426 const DenseMatrix &J = Trans.Jacobian();
4427
4428 vc.Eval (xk, Trans, Nodes.IntPoint (k));
4429 // xk^t J tk
4430 dofs(k) =
4431 vk[0] * ( J(0,0)*tk[k][0]+J(0,1)*tk[k][1]+J(0,2)*tk[k][2] ) +
4432 vk[1] * ( J(1,0)*tk[k][0]+J(1,1)*tk[k][1]+J(1,2)*tk[k][2] ) +
4433 vk[2] * ( J(2,0)*tk[k][0]+J(2,1)*tk[k][1]+J(2,2)*tk[k][2] );
4434 }
4435}
4436
4438 ElementTransformation &Trans,
4439 DenseMatrix &grad) const
4440{
4441 DenseMatrix dshape(fe.GetDof(), 3);
4442 Vector grad_k(fe.GetDof());
4443
4444 grad.SetSize(dof, fe.GetDof());
4445 for (int k = 0; k < dof; k++)
4446 {
4447 fe.CalcDShape(Nodes.IntPoint(k), dshape);
4448 dshape.Mult(tk[k], grad_k);
4449 for (int j = 0; j < grad_k.Size(); j++)
4450 {
4451 grad(k,j) = (fabs(grad_k(j)) < 1e-12) ? 0.0 : grad_k(j);
4452 }
4453 }
4454}
4455
4456
4458 : VectorFiniteElement(3, Geometry::TETRAHEDRON, 6, 1, H_CURL)
4459{
4460 // not real nodes ...
4461 Nodes.IntPoint(0).x = 0.5;
4462 Nodes.IntPoint(0).y = 0.0;
4463 Nodes.IntPoint(0).z = 0.0;
4464
4465 Nodes.IntPoint(1).x = 0.0;
4466 Nodes.IntPoint(1).y = 0.5;
4467 Nodes.IntPoint(1).z = 0.0;
4468
4469 Nodes.IntPoint(2).x = 0.0;
4470 Nodes.IntPoint(2).y = 0.0;
4471 Nodes.IntPoint(2).z = 0.5;
4472
4473 Nodes.IntPoint(3).x = 0.5;
4474 Nodes.IntPoint(3).y = 0.5;
4475 Nodes.IntPoint(3).z = 0.0;
4476
4477 Nodes.IntPoint(4).x = 0.5;
4478 Nodes.IntPoint(4).y = 0.0;
4479 Nodes.IntPoint(4).z = 0.5;
4480
4481 Nodes.IntPoint(5).x = 0.0;
4482 Nodes.IntPoint(5).y = 0.5;
4483 Nodes.IntPoint(5).z = 0.5;
4484}
4485
4487 DenseMatrix &shape) const
4488{
4489 real_t x = ip.x, y = ip.y, z = ip.z;
4490
4491 shape(0,0) = 1. - y - z;
4492 shape(0,1) = x;
4493 shape(0,2) = x;
4494
4495 shape(1,0) = y;
4496 shape(1,1) = 1. - x - z;
4497 shape(1,2) = y;
4498
4499 shape(2,0) = z;
4500 shape(2,1) = z;
4501 shape(2,2) = 1. - x - y;
4502
4503 shape(3,0) = -y;
4504 shape(3,1) = x;
4505 shape(3,2) = 0.;
4506
4507 shape(4,0) = -z;
4508 shape(4,1) = 0.;
4509 shape(4,2) = x;
4510
4511 shape(5,0) = 0.;
4512 shape(5,1) = -z;
4513 shape(5,2) = y;
4514}
4515
4517 DenseMatrix &curl_shape)
4518const
4519{
4520 curl_shape(0,0) = 0.;
4521 curl_shape(0,1) = -2.;
4522 curl_shape(0,2) = 2.;
4523
4524 curl_shape(1,0) = 2.;
4525 curl_shape(1,1) = 0.;
4526 curl_shape(1,2) = -2.;
4527
4528 curl_shape(2,0) = -2.;
4529 curl_shape(2,1) = 2.;
4530 curl_shape(2,2) = 0.;
4531
4532 curl_shape(3,0) = 0.;
4533 curl_shape(3,1) = 0.;
4534 curl_shape(3,2) = 2.;
4535
4536 curl_shape(4,0) = 0.;
4537 curl_shape(4,1) = -2.;
4538 curl_shape(4,2) = 0.;
4539
4540 curl_shape(5,0) = 2.;
4541 curl_shape(5,1) = 0.;
4542 curl_shape(5,2) = 0.;
4543}
4544
4545const real_t Nedelec1TetFiniteElement::tk[6][3] =
4546{{1,0,0}, {0,1,0}, {0,0,1}, {-1,1,0}, {-1,0,1}, {0,-1,1}};
4547
4549 ElementTransformation &Trans, DenseMatrix &I) const
4550{
4551 int k, j;
4552#ifdef MFEM_THREAD_SAFE
4554#endif
4555
4556#ifdef MFEM_DEBUG
4557 for (k = 0; k < dof; k++)
4558 {
4560 for (j = 0; j < dof; j++)
4561 {
4562 real_t d = ( vshape(j,0)*tk[k][0] + vshape(j,1)*tk[k][1] +
4563 vshape(j,2)*tk[k][2] );
4564 if (j == k) { d -= 1.0; }
4565 if (fabs(d) > 1.0e-12)
4566 {
4567 mfem::err << "Nedelec1TetFiniteElement::GetLocalInterpolation (...)\n"
4568 " k = " << k << ", j = " << j << ", d = " << d << endl;
4569 mfem_error();
4570 }
4571 }
4572 }
4573#endif
4574
4576 ip.x = ip.y = ip.z = 0.0;
4577 Trans.SetIntPoint (&ip);
4578 // Trans must be linear
4579 const DenseMatrix &J = Trans.Jacobian();
4580 real_t vk[3];
4581 Vector xk (vk, 3);
4582
4583 for (k = 0; k < dof; k++)
4584 {
4585 Trans.Transform (Nodes.IntPoint (k), xk);
4586 ip.x = vk[0]; ip.y = vk[1]; ip.z = vk[2];
4587 CalcVShape (ip, vshape);
4588 // vk = J tk
4589 vk[0] = J(0,0)*tk[k][0]+J(0,1)*tk[k][1]+J(0,2)*tk[k][2];
4590 vk[1] = J(1,0)*tk[k][0]+J(1,1)*tk[k][1]+J(1,2)*tk[k][2];
4591 vk[2] = J(2,0)*tk[k][0]+J(2,1)*tk[k][1]+J(2,2)*tk[k][2];
4592 for (j = 0; j < dof; j++)
4593 if (fabs (I(k,j) = (vshape(j,0)*vk[0]+vshape(j,1)*vk[1]+
4594 vshape(j,2)*vk[2])) < 1.0e-12)
4595 {
4596 I(k,j) = 0.0;
4597 }
4598 }
4599}
4600
4603 Vector &dofs) const
4604{
4605 real_t vk[3];
4606 Vector xk (vk, 3);
4607
4608 for (int k = 0; k < dof; k++)
4609 {
4610 Trans.SetIntPoint (&Nodes.IntPoint (k));
4611 const DenseMatrix &J = Trans.Jacobian();
4612
4613 vc.Eval (xk, Trans, Nodes.IntPoint (k));
4614 // xk^t J tk
4615 dofs(k) =
4616 vk[0] * ( J(0,0)*tk[k][0]+J(0,1)*tk[k][1]+J(0,2)*tk[k][2] ) +
4617 vk[1] * ( J(1,0)*tk[k][0]+J(1,1)*tk[k][1]+J(1,2)*tk[k][2] ) +
4618 vk[2] * ( J(2,0)*tk[k][0]+J(2,1)*tk[k][1]+J(2,2)*tk[k][2] );
4619 }
4620}
4621
4623 ElementTransformation &Trans,
4624 DenseMatrix &grad) const
4625{
4626 DenseMatrix dshape(fe.GetDof(), 3);
4627 Vector grad_k(fe.GetDof());
4628
4629 grad.SetSize(dof, fe.GetDof());
4630 for (int k = 0; k < dof; k++)
4631 {
4632 fe.CalcDShape(Nodes.IntPoint(k), dshape);
4633 dshape.Mult(tk[k], grad_k);
4634 for (int j = 0; j < grad_k.Size(); j++)
4635 {
4636 grad(k,j) = (fabs(grad_k(j)) < 1e-12) ? 0.0 : grad_k(j);
4637 }
4638 }
4639}
4640
4641
4643 : VectorFiniteElement(3, Geometry::PRISM, 9, 1, H_CURL, FunctionSpace::Qk)
4644{
4645 // not real nodes ...
4646 Nodes.IntPoint(0).x = 0.5;
4647 Nodes.IntPoint(0).y = 0.0;
4648 Nodes.IntPoint(0).z = 0.0;
4649
4650 Nodes.IntPoint(1).x = 0.5;
4651 Nodes.IntPoint(1).y = 0.5;
4652 Nodes.IntPoint(1).z = 0.0;
4653
4654 Nodes.IntPoint(2).x = 0.0;
4655 Nodes.IntPoint(2).y = 0.5;
4656 Nodes.IntPoint(2).z = 0.0;
4657
4658 Nodes.IntPoint(3).x = 0.5;
4659 Nodes.IntPoint(3).y = 0.0;
4660 Nodes.IntPoint(3).z = 1.0;
4661
4662 Nodes.IntPoint(4).x = 0.5;
4663 Nodes.IntPoint(4).y = 0.5;
4664 Nodes.IntPoint(4).z = 1.0;
4665
4666 Nodes.IntPoint(5).x = 0.0;
4667 Nodes.IntPoint(5).y = 0.5;
4668 Nodes.IntPoint(5).z = 1.0;
4669
4670 Nodes.IntPoint(6).x = 0.0;
4671 Nodes.IntPoint(6).y = 0.0;
4672 Nodes.IntPoint(6).z = 0.5;
4673
4674 Nodes.IntPoint(7).x = 1.0;
4675 Nodes.IntPoint(7).y = 0.0;
4676 Nodes.IntPoint(7).z = 0.5;
4677
4678 Nodes.IntPoint(8).x = 0.0;
4679 Nodes.IntPoint(8).y = 1.0;
4680 Nodes.IntPoint(8).z = 0.5;
4681}
4682
4684 DenseMatrix &shape) const
4685{
4686 real_t x = ip.x, y = ip.y, z = ip.z;
4687
4688 shape(0,0) = (1. - y) * (1. - z);
4689 shape(0,1) = x * (1. - z);
4690 shape(0,2) = 0.;
4691
4692 shape(1,0) = - y * (1. - z);
4693 shape(1,1) = x * (1. - z);
4694 shape(1,2) = 0.;
4695
4696 shape(2,0) = - y * (1. - z);
4697 shape(2,1) = - (1. - x) * (1. - z);
4698 shape(2,2) = 0.;
4699
4700 shape(3,0) = (1. - y) * z;
4701 shape(3,1) = x * z;
4702 shape(3,2) = 0.;
4703
4704 shape(4,0) = - y * z;
4705 shape(4,1) = x * z;
4706 shape(4,2) = 0.;
4707
4708 shape(5,0) = - y * z;
4709 shape(5,1) = - (1. - x) * z;
4710 shape(5,2) = 0.;
4711
4712 shape(6,0) = 0.;
4713 shape(6,1) = 0.;
4714 shape(6,2) = 1. - x - y;
4715
4716 shape(7,0) = 0.;
4717 shape(7,1) = 0.;
4718 shape(7,2) = x;
4719
4720 shape(8,0) = 0.;
4721 shape(8,1) = 0.;
4722 shape(8,2) = y;
4723}
4724
4726 DenseMatrix &curl_shape)
4727const
4728{
4729 real_t x = ip.x, y = ip.y, z2 = 2. * ip.z;
4730
4731 curl_shape(0,0) = x;
4732 curl_shape(0,1) = - 1. + y;
4733 curl_shape(0,2) = 2. - z2;
4734
4735 curl_shape(1,0) = x;
4736 curl_shape(1,1) = y;
4737 curl_shape(1,2) = 2. - z2;
4738
4739 curl_shape(2,0) = - 1. + x;
4740 curl_shape(2,1) = y;
4741 curl_shape(2,2) = 2. - z2;
4742
4743 curl_shape(3,0) = - x;
4744 curl_shape(3,1) = 1. - y;
4745 curl_shape(3,2) = z2;
4746
4747 curl_shape(4,0) = - x;
4748 curl_shape(4,1) = - y;
4749 curl_shape(4,2) = z2;
4750
4751 curl_shape(5,0) = 1. - x;
4752 curl_shape(5,1) = - y;
4753 curl_shape(5,2) = z2;
4754
4755 curl_shape(6,0) = - 1.;
4756 curl_shape(6,1) = 1.;
4757 curl_shape(6,2) = 0.;
4758
4759 curl_shape(7,0) = 0.;
4760 curl_shape(7,1) = - 1.;
4761 curl_shape(7,2) = 0.;
4762
4763 curl_shape(8,0) = 1.;
4764 curl_shape(8,1) = 0.;
4765 curl_shape(8,2) = 0.;
4766}
4767
4768const real_t Nedelec1WdgFiniteElement::tk[9][3] =
4769{
4770 {1,0,0}, {-1,1,0}, {0,-1,0}, {1,0,0}, {-1,1,0}, {0,-1,0},
4771 {0,0,1}, {0,0,1}, {0,0,1}
4772};
4773
4775 ElementTransformation &Trans, DenseMatrix &I) const
4776{
4777 int k, j;
4778#ifdef MFEM_THREAD_SAFE
4780#endif
4781
4782#ifdef MFEM_DEBUG
4783 for (k = 0; k < dof; k++)
4784 {
4786 for (j = 0; j < dof; j++)
4787 {
4788 real_t d = ( vshape(j,0)*tk[k][0] + vshape(j,1)*tk[k][1] +
4789 vshape(j,2)*tk[k][2] );
4790 if (j == k) { d -= 1.0; }
4791 if (fabs(d) > 1.0e-12)
4792 {
4793 mfem::err << "Nedelec1WdgFiniteElement::GetLocalInterpolation (...)\n"
4794 " k = " << k << ", j = " << j << ", d = " << d << endl;
4795 mfem_error();
4796 }
4797 }
4798 }
4799#endif
4800
4802 ip.x = ip.y = ip.z = 0.0;
4803 Trans.SetIntPoint (&ip);
4804 // Trans must be linear
4805 const DenseMatrix &J = Trans.Jacobian();
4806 real_t vk[3];
4807 Vector xk (vk, 3);
4808
4809 for (k = 0; k < dof; k++)
4810 {
4811 Trans.Transform (Nodes.IntPoint (k), xk);
4812 ip.x = vk[0]; ip.y = vk[1]; ip.z = vk[2];
4813 CalcVShape (ip, vshape);
4814 // vk = J tk
4815 vk[0] = J(0,0)*tk[k][0]+J(0,1)*tk[k][1]+J(0,2)*tk[k][2];
4816 vk[1] = J(1,0)*tk[k][0]+J(1,1)*tk[k][1]+J(1,2)*tk[k][2];
4817 vk[2] = J(2,0)*tk[k][0]+J(2,1)*tk[k][1]+J(2,2)*tk[k][2];
4818 for (j = 0; j < dof; j++)
4819 if (fabs (I(k,j) = (vshape(j,0)*vk[0]+vshape(j,1)*vk[1]+
4820 vshape(j,2)*vk[2])) < 1.0e-12)
4821 {
4822 I(k,j) = 0.0;
4823 }
4824 }
4825}
4826
4829 Vector &dofs) const
4830{
4831 real_t vk[3];
4832 Vector xk (vk, 3);
4833
4834 for (int k = 0; k < dof; k++)
4835 {
4836 Trans.SetIntPoint (&Nodes.IntPoint (k));
4837 const DenseMatrix &J = Trans.Jacobian();
4838
4839 vc.Eval (xk, Trans, Nodes.IntPoint (k));
4840 // xk^t J tk
4841 dofs(k) =
4842 vk[0] * ( J(0,0)*tk[k][0]+J(0,1)*tk[k][1]+J(0,2)*tk[k][2] ) +
4843 vk[1] * ( J(1,0)*tk[k][0]+J(1,1)*tk[k][1]+J(1,2)*tk[k][2] ) +
4844 vk[2] * ( J(2,0)*tk[k][0]+J(2,1)*tk[k][1]+J(2,2)*tk[k][2] );
4845 }
4846}
4847
4849 ElementTransformation &Trans,
4850 DenseMatrix &grad) const
4851{
4852 DenseMatrix dshape(fe.GetDof(), 3);
4853 Vector grad_k(fe.GetDof());
4854
4855 grad.SetSize(dof, fe.GetDof());
4856 for (int k = 0; k < dof; k++)
4857 {
4858 fe.CalcDShape(Nodes.IntPoint(k), dshape);
4859 dshape.Mult(tk[k], grad_k);
4860 for (int j = 0; j < grad_k.Size(); j++)
4861 {
4862 grad(k,j) = (fabs(grad_k(j)) < 1e-12) ? 0.0 : grad_k(j);
4863 }
4864 }
4865}
4866
4867
4869 : VectorFiniteElement(3, Geometry::PYRAMID, 8, 1, H_CURL, FunctionSpace::Uk)
4870{
4871 // not real nodes ...
4872 Nodes.IntPoint(0).x = 0.5;
4873 Nodes.IntPoint(0).y = 0.0;
4874 Nodes.IntPoint(0).z = 0.0;
4875
4876 Nodes.IntPoint(1).x = 1.0;
4877 Nodes.IntPoint(1).y = 0.5;
4878 Nodes.IntPoint(1).z = 0.0;
4879
4880 Nodes.IntPoint(2).x = 0.5;
4881 Nodes.IntPoint(2).y = 1.0;
4882 Nodes.IntPoint(2).z = 0.0;
4883
4884 Nodes.IntPoint(3).x = 0.0;
4885 Nodes.IntPoint(3).y = 0.5;
4886 Nodes.IntPoint(3).z = 0.0;
4887
4888 Nodes.IntPoint(4).x = 0.0;
4889 Nodes.IntPoint(4).y = 0.0;
4890 Nodes.IntPoint(4).z = 0.5;
4891
4892 Nodes.IntPoint(5).x = 0.5;
4893 Nodes.IntPoint(5).y = 0.0;
4894 Nodes.IntPoint(5).z = 0.5;
4895
4896 Nodes.IntPoint(6).x = 0.5;
4897 Nodes.IntPoint(6).y = 0.5;
4898 Nodes.IntPoint(6).z = 0.5;
4899
4900 Nodes.IntPoint(7).x = 0.0;
4901 Nodes.IntPoint(7).y = 0.5;
4902 Nodes.IntPoint(7).z = 0.5;
4903}
4904
4906 DenseMatrix &shape) const
4907{
4908 real_t x = ip.x, y = ip.y, z = ip.z, z2 = 2. * ip.z;
4909 real_t ox = 1. - x - z, oy = 1. - y - z, oz = 1. - z;
4910
4911 real_t tol = 1e-6;
4912
4913 if (oz <= tol)
4914 {
4915 // We must return the limit of the basis functions as z->1. In order to
4916 // remain inside the pyramid in this limit the x and y coordinates must
4917 // be approaching 0. Unfortunately we obtain different limits if we
4918 // approach (0,0,1) from different directions. The values provided below
4919 // are the limits as x->(1-z)/2 and y->(1-z)/2 i.e. along the line from
4920 // the center of the base of the pyramid towards the apex. The resulting
4921 // limiting basis function values are:
4922 shape(0,0) = 0.;
4923 shape(0,1) = 0.;
4924 shape(0,2) = 0.;
4925
4926 shape(1,0) = 0.;
4927 shape(1,1) = 0.;
4928 shape(1,2) = 0.;
4929
4930 shape(2,0) = 0.;
4931 shape(2,1) = 0.;
4932 shape(2,2) = 0.;
4933
4934 shape(3,0) = 0.;
4935 shape(3,1) = 0.;
4936 shape(3,2) = 0.;
4937
4938 shape(4,0) = 0.5;
4939 shape(4,1) = 0.5;
4940 shape(4,2) = 0.75;
4941
4942 shape(5,0) = - 0.5;
4943 shape(5,1) = 0.5;
4944 shape(5,2) = 0.25;
4945
4946 shape(6,0) = - 0.5;
4947 shape(6,1) = - 0.5;
4948 shape(6,2) = - 0.25;
4949
4950 shape(7,0) = 0.5;
4951 shape(7,1) = - 0.5;
4952 shape(7,2) = 0.25;
4953
4954 return;
4955 }
4956
4957 real_t ozi = 1.0 / oz;
4958
4959 shape(0,0) = oy;
4960 shape(0,1) = 0.;
4961 shape(0,2) = x * oy * ozi;
4962
4963 shape(1,0) = 0.;
4964 shape(1,1) = x;
4965 shape(1,2) = x * y * ozi;
4966
4967 shape(2,0) = y;
4968 shape(2,1) = 0.;
4969 shape(2,2) = x * y * ozi;
4970
4971 shape(3,0) = 0.;
4972 shape(3,1) = ox;
4973 shape(3,2) = ox * y * ozi;
4974
4975 shape(4,0) = oy * z * ozi;
4976 shape(4,1) = ox * z * ozi;
4977 shape(4,2) = 1. - x - y + x * y * (1. - z2) * ozi * ozi;
4978
4979 shape(5,0) = - oy * z * ozi;
4980 shape(5,1) = x * z * ozi;
4981 shape(5,2) = x * (1. - y * (1. - z2) * ozi * ozi);
4982
4983 shape(6,0) = - y * z * ozi;
4984 shape(6,1) = - x * z * ozi;
4985 shape(6,2) = x * y * (1. - z2) * ozi * ozi;
4986
4987 shape(7,0) = y * z * ozi;
4988 shape(7,1) = - ox * z * ozi;
4989 shape(7,2) = y * (1. - x * (1. - z2) * ozi * ozi);
4990}
4991
4993 DenseMatrix &curl_shape)
4994const
4995{
4996 real_t x = ip.x, y = ip.y, z = ip.z, z2 = 2. * z;
4997 real_t ox = 1. - x - z, oy = 1. - y - z, oz = 1. - z;
4998
4999 real_t tol = 1e-6;
5000
5001 if (oz <= tol)
5002 {
5003 // We must return the limit of the basis function derivatives as z->1.
5004 // In order to remain inside the pyramid in this limit the x and y
5005 // coordinates must be approaching 0. The resulting limiting basis
5006 // function values are:
5007 curl_shape(0,0) = - 0.5;
5008 curl_shape(0,1) = - 1.5;
5009 curl_shape(0,2) = 1.;
5010
5011 curl_shape(1,0) = 0.5;
5012 curl_shape(1,1) = - 0.5;
5013 curl_shape(1,2) = 1.;
5014
5015 curl_shape(2,0) = 0.5;
5016 curl_shape(2,1) = - 0.5;
5017 curl_shape(2,2) = - 1.;
5018
5019 curl_shape(3,0) = 1.5;
5020 curl_shape(3,1) = 0.5;
5021 curl_shape(3,2) = - 1.;
5022
5023 curl_shape(4,0) = - 1.;
5024 curl_shape(4,1) = 1.;
5025 curl_shape(4,2) = 0.;
5026
5027 curl_shape(5,0) = - 1.;
5028 curl_shape(5,1) = - 1.;
5029 curl_shape(5,2) = 0.;
5030
5031 curl_shape(6,0) = 1.;
5032 curl_shape(6,1) = - 1.;
5033 curl_shape(6,2) = 0.;
5034
5035 curl_shape(7,0) = 1.;
5036 curl_shape(7,1) = 1.;
5037 curl_shape(7,2) = 0.;
5038
5039 return;
5040 }
5041
5042 real_t ozi = 1. / oz;
5043
5044 curl_shape(0,0) = - x * ozi;
5045 curl_shape(0,1) = - 2. + y * ozi;
5046 curl_shape(0,2) = 1.;
5047
5048 curl_shape(1,0) = x * ozi;
5049 curl_shape(1,1) = - y * ozi;
5050 curl_shape(1,2) = 1.;
5051
5052 curl_shape(2,0) = x * ozi;
5053 curl_shape(2,1) = - y * ozi;
5054 curl_shape(2,2) = - 1.;
5055
5056 curl_shape(3,0) = (2. - x - z2) * ozi;
5057 curl_shape(3,1) = y * ozi;
5058 curl_shape(3,2) = - 1.;
5059
5060 curl_shape(4,0) = - 2. * ox * ozi;
5061 curl_shape(4,1) = 2. * oy * ozi;
5062 curl_shape(4,2) = 0.;
5063
5064 curl_shape(5,0) = - 2. * x * ozi;
5065 curl_shape(5,1) = - 2. * oy * ozi;
5066 curl_shape(5,2) = 0.;
5067
5068 curl_shape(6,0) = 2. * x * ozi;
5069 curl_shape(6,1) = - 2. * y * ozi;
5070 curl_shape(6,2) = 0.;
5071
5072 curl_shape(7,0) = 2. * ox * ozi;
5073 curl_shape(7,1) = 2. * y * ozi;
5074 curl_shape(7,2) = 0.;
5075}
5076
5077const real_t Nedelec1PyrFiniteElement::tk[8][3] =
5078{{1,0,0}, {0,1,0}, {1,0,0}, {0,1,0}, {0,0,1}, {-1,0,1}, {-1,-1,1}, {0,-1,1}};
5079
5081 ElementTransformation &Trans, DenseMatrix &I) const
5082{
5083 int k, j;
5084#ifdef MFEM_THREAD_SAFE
5086#endif
5087
5088#ifdef MFEM_DEBUG
5089 for (k = 0; k < dof; k++)
5090 {
5092 for (j = 0; j < dof; j++)
5093 {
5094 real_t d = ( vshape(j,0)*tk[k][0] + vshape(j,1)*tk[k][1] +
5095 vshape(j,2)*tk[k][2] );
5096 if (j == k) { d -= 1.0; }
5097 if (fabs(d) > 1.0e-12)
5098 {
5099 mfem::err << "Nedelec1PyrFiniteElement::GetLocalInterpolation (...)\n"
5100 " k = " << k << ", j = " << j << ", d = " << d << endl;
5101 mfem_error();
5102 }
5103 }
5104 }
5105#endif
5106
5108 ip.x = ip.y = ip.z = 0.0;
5109 Trans.SetIntPoint (&ip);
5110 // Trans must be linear
5111 const DenseMatrix &J = Trans.Jacobian();
5112 real_t vk[3];
5113 Vector xk (vk, 3);
5114
5115 for (k = 0; k < dof; k++)
5116 {
5117 Trans.Transform (Nodes.IntPoint (k), xk);
5118 ip.x = vk[0]; ip.y = vk[1]; ip.z = vk[2];
5119 CalcVShape (ip, vshape);
5120 // vk = J tk
5121 vk[0] = J(0,0)*tk[k][0]+J(0,1)*tk[k][1]+J(0,2)*tk[k][2];
5122 vk[1] = J(1,0)*tk[k][0]+J(1,1)*tk[k][1]+J(1,2)*tk[k][2];
5123 vk[2] = J(2,0)*tk[k][0]+J(2,1)*tk[k][1]+J(2,2)*tk[k][2];
5124 for (j = 0; j < dof; j++)
5125 if (fabs (I(k,j) = (vshape(j,0)*vk[0]+vshape(j,1)*vk[1]+
5126 vshape(j,2)*vk[2])) < 1.0e-12)
5127 {
5128 I(k,j) = 0.0;
5129 }
5130 }
5131}
5132
5135 Vector &dofs) const
5136{
5137 real_t vk[3];
5138 Vector xk (vk, 3);
5139
5140 for (int k = 0; k < dof; k++)
5141 {
5142 Trans.SetIntPoint (&Nodes.IntPoint (k));
5143 const DenseMatrix &J = Trans.Jacobian();
5144
5145 vc.Eval (xk, Trans, Nodes.IntPoint (k));
5146 // xk^t J tk
5147 dofs(k) =
5148 vk[0] * ( J(0,0)*tk[k][0]+J(0,1)*tk[k][1]+J(0,2)*tk[k][2] ) +
5149 vk[1] * ( J(1,0)*tk[k][0]+J(1,1)*tk[k][1]+J(1,2)*tk[k][2] ) +
5150 vk[2] * ( J(2,0)*tk[k][0]+J(2,1)*tk[k][1]+J(2,2)*tk[k][2] );
5151 }
5152}
5153
5155 ElementTransformation &Trans,
5156 DenseMatrix &grad) const
5157{
5158 DenseMatrix dshape(fe.GetDof(), 3);
5159 Vector grad_k(fe.GetDof());
5160
5161 grad.SetSize(dof, fe.GetDof());
5162 for (int k = 0; k < dof; k++)
5163 {
5164 fe.CalcDShape(Nodes.IntPoint(k), dshape);
5165 dshape.Mult(tk[k], grad_k);
5166 for (int j = 0; j < grad_k.Size(); j++)
5167 {
5168 grad(k,j) = (fabs(grad_k(j)) < 1e-12) ? 0.0 : grad_k(j);
5169 }
5170 }
5171}
5172
5173
5175 : VectorFiniteElement(3, Geometry::PYRAMID, 28, 2, H_CURL, FunctionSpace::Uk)
5176{
5177 const real_t *eop = poly1d.OpenPoints(2 - 1);
5178 const real_t fop = 1. / 3.;
5179
5180 // not real nodes ...
5181 Nodes.IntPoint(0).Set3(eop[0], 0., 0.);
5182 Nodes.IntPoint(1).Set3(eop[1], 0., 0.);
5183
5184 Nodes.IntPoint(2).Set3(1.0, eop[0], 0.);
5185 Nodes.IntPoint(3).Set3(1.0, eop[1], 0.);
5186
5187 Nodes.IntPoint(4).Set3(eop[0], 1.0, 0.);
5188 Nodes.IntPoint(5).Set3(eop[1], 1.0, 0.);
5189
5190 Nodes.IntPoint(6).Set3(0., eop[0], 0.);
5191 Nodes.IntPoint(7).Set3(0., eop[1], 0.);
5192
5193 Nodes.IntPoint(8).Set3(0., 0., eop[0]);
5194 Nodes.IntPoint(9).Set3(0., 0., eop[1]);
5195
5196 Nodes.IntPoint(10).Set3(eop[1], 0., eop[0]);
5197 Nodes.IntPoint(11).Set3(eop[0], 0., eop[1]);
5198
5199 Nodes.IntPoint(12).Set3(eop[1], eop[1], eop[0]);
5200 Nodes.IntPoint(13).Set3(eop[0], eop[0], eop[1]);
5201
5202 Nodes.IntPoint(14).Set3(0., eop[1], eop[0]);
5203 Nodes.IntPoint(15).Set3(0., eop[0], eop[1]);
5204
5205 Nodes.IntPoint(16).Set3(eop[0], 0.5, 0.);
5206 Nodes.IntPoint(17).Set3(eop[1], 0.5, 0.);
5207
5208 Nodes.IntPoint(18).Set3(0.5, eop[0], 0.);
5209 Nodes.IntPoint(19).Set3(0.5, eop[1], 0.);
5210
5211 Nodes.IntPoint(20).Set3(fop, 0., fop);
5212 Nodes.IntPoint(21).Set3(fop, 0., fop);
5213
5214 Nodes.IntPoint(22).Set3(2.*fop, fop, fop);
5215 Nodes.IntPoint(23).Set3(2.*fop, fop, fop);
5216
5217 Nodes.IntPoint(24).Set3(fop, 2.*fop, fop);
5218 Nodes.IntPoint(25).Set3(fop, 2.*fop, fop);
5219
5220 Nodes.IntPoint(26).Set3(0., fop, fop);
5221 Nodes.IntPoint(27).Set3(0., fop, fop);
5222
5223 {
5224 int n = 28;
5225 DenseMatrix I(n,n);
5226 DenseMatrix vecs(n,3);
5227 I = 0.0;
5228
5229 for (int i=0; i<n; i++)
5230 {
5231 CalcVShape(Nodes.IntPoint(i), vecs);
5232 for (int j=0; j<n; j++)
5233 {
5234 I(j,i) = vecs(j,0)*tk[i][0]+vecs(j,1)*tk[i][1]+vecs(j,2)*tk[i][2];
5235 }
5236 }
5237 }
5238}
5239
5241 DenseMatrix &shape) const
5242{
5243 shape = 0.0;
5244
5245 const real_t one = 1.0;
5246 const real_t x = ip.x, y = ip.y, z = ip.z;
5247 const real_t ox = one - x - z, oy = one - y - z, oz = one - z;
5248 const real_t sq3 = sqrt(3.0);
5249 const real_t tol = 1e-6;
5250
5251 if (oz <= tol)
5252 {
5253 // We must return the limit of the basis functions as z->1. In order to
5254 // remain inside the pyramid in this limit the x and y coordinates must
5255 // be approaching 0. The resulting limiting basis function values are:
5256 shape(0,0) = 0.;
5257 shape(0,1) = 0.;
5258 shape(0,2) = 0.;
5259
5260 shape(1,0) = 0.;
5261 shape(1,1) = 0.;
5262 shape(1,2) = 0.;
5263
5264 shape(2,0) = 0.;
5265 shape(2,1) = 0.;
5266 shape(2,2) = 0.;
5267
5268 shape(3,0) = 0.;
5269 shape(3,1) = 0.;
5270 shape(3,2) = 0.;
5271
5272 shape(4,0) = 0.;
5273 shape(4,1) = 0.;
5274 shape(4,2) = 0.;
5275
5276 shape(5,0) = 0.;
5277 shape(5,1) = 0.;
5278 shape(5,2) = 0.;
5279
5280 shape(6,0) = 0.;
5281 shape(6,1) = 0.;
5282 shape(6,2) = 0.;
5283
5284 shape(7,0) = 0.;
5285 shape(7,1) = 0.;
5286 shape(7,2) = 0.;
5287
5288 return;
5289 }
5290
5291 const real_t ozi = one / oz;
5292
5293 const real_t me0120[3] = {oy, 0., x * oy * ozi};
5294 const real_t me1120[3] = {(x - ox) * oy, 0., (x - ox) * x * oy * ozi};
5295
5296 const real_t me0121[3] = {y, 0., x * y * ozi};
5297 const real_t me1121[3] = {(x - ox) * y, 0., (x - ox) * x * y * ozi};
5298
5299 const real_t me0210[3] = {0., ox, ox * y * ozi};
5300 const real_t me1210[3] = {0., ox * (y - oy), ox * y * (y - oy) * ozi};
5301
5302 const real_t me0211[3] = {0., x, x * y * ozi};
5303 const real_t me1211[3] = {0., x * (y - oy), x * y * (y - oy) * ozi};
5304
5305 const real_t te01[3] = {oy * z * ozi, ox * z * ozi,
5306 (ox * oy + (x * oy + ox * y) * z) * ozi * ozi
5307 };
5308 const real_t te11[3] = {oy * z * (z * oz - ox * oy) * ozi * ozi,
5309 ox * z * (z * oz - ox * oy) * ozi * ozi,
5310 (ox * oy + z * (x * oy + ox * y)) *
5311 (z * oz - ox * oy) * ozi * ozi * ozi
5312 };
5313
5314 const real_t te02[3] = {-oy * z * ozi, x * z * ozi,
5315 x * (y * z + oy * oz) * ozi * ozi
5316 };
5317 const real_t te12[3] = {oy * z * (x * oy - z * oz) * ozi * ozi,
5318 -x * z * (x * oy - z * oz) * ozi * ozi,
5319 -x * (y * z + oy * oz) * (x * oy - z * oz)
5320 * ozi * ozi * ozi
5321 };
5322
5323 const real_t te03[3] = {-y * z * ozi, -x * z * ozi,
5324 x * y * (one - 2_r * z) * ozi * ozi
5325 };
5326 const real_t te13[3] = {y * z * (x * y - z * oz) * ozi * ozi,
5327 x * z * (x * y - z * oz) * ozi * ozi,
5328 -x * y * (one - 2_r * z) * (x * y - z * oz)
5329 * ozi * ozi * ozi
5330 };
5331
5332 const real_t te04[3] = {y * z * ozi, -ox * z * ozi,
5333 y * (x * z + ox * oz) * ozi * ozi
5334 };
5335 const real_t te14[3] = {-y * z * (ox * y - z * oz) * ozi * ozi,
5336 ox * z * (ox * y - z * oz) * ozi * ozi,
5337 -y * (x * z + ox * oz) * (ox * y - z * oz)
5338 * ozi * ozi * ozi
5339 };
5340
5341 const real_t qI02[3] = {-y * oy * ozi, 0., -x * y * oy * ozi * ozi};
5342 const real_t qI12[3] = {-(x - ox) * y * oy * ozi * ozi, 0.,
5343 -(x - ox) * x * y * oy * ozi * ozi * ozi
5344 };
5345
5346 const real_t qII02[3] = {0., -x * ox * ozi, -x * y * ox * ozi * ozi};
5347 const real_t qII12[3] = {0., -x * ox * (y - oy) * ozi * ozi,
5348 -x * ox * y * (y - oy) * ozi * ozi * ozi
5349 };
5350
5351 const real_t tI120[3] = {oy * z, 0., x * oy * z * ozi};
5352 const real_t tI121[3] = {y * z, 0., x * y * z * ozi};
5353 const real_t tI210[3] = {0., ox * z, ox * y * z * ozi};
5354 const real_t tI211[3] = {0., x * z, x * y * z * ozi};
5355
5356 const real_t tII120[3] = {-ox * oy * z * ozi, 0., x * ox * oy * ozi};
5357 const real_t tII121[3] = {-ox * y * z * ozi, 0., x * ox * y * ozi};
5358 const real_t tII210[3] = {0., -ox * oy * z * ozi, ox * y * oy * ozi};
5359 const real_t tII211[3] = {0., -x * oy * z * ozi, x * y * oy * ozi};
5360
5361 // Edge 0,1
5362 for (int d=0; d<3; d++)
5363 {
5364 shape(0,d) = 0.5 * me0120[d] + qI02[d]
5365 - sq3 * (0.5 * me1120[d] + qI12[d]) - 1.5 * tI120[d];
5366 }
5367 for (int d=0; d<3; d++)
5368 {
5369 shape(1,d) = 0.5 * me0120[d] + qI02[d]
5370 + sq3 * (0.5 * me1120[d] + qI12[d]) - 1.5 * tI120[d];
5371 }
5372
5373 // Edge 1,2
5374 for (int d=0; d<3; d++)
5375 {
5376 shape(2,d) = 0.5 * me0211[d] + qII02[d]
5377 - sq3 * (0.5 * me1211[d] + qII12[d]) - 1.5 * tI211[d];
5378 }
5379 for (int d=0; d<3; d++)
5380 {
5381 shape(3,d) = 0.5 * me0211[d] + qII02[d]
5382 + sq3 * (0.5 * me1211[d] + qII12[d]) - 1.5 * tI211[d];
5383 }
5384
5385 // Edge 3,2
5386 for (int d=0; d<3; d++)
5387 {
5388 shape(4,d) = 0.5 * me0121[d] + qI02[d]
5389 - sq3 * (0.5 * me1121[d] + qI12[d]) - 1.5 * tI121[d];
5390 }
5391 for (int d=0; d<3; d++)
5392 {
5393 shape(5,d) = 0.5 * me0121[d] + qI02[d]
5394 + sq3 * (0.5 * me1121[d] + qI12[d]) - 1.5 * tI121[d];
5395 }
5396
5397 // Edge 0,3
5398 for (int d=0; d<3; d++)
5399 {
5400 shape(6,d) = 0.5 * me0210[d] + qII02[d]
5401 - sq3 * (0.5 * me1210[d] + qII12[d]) - 1.5 * tI210[d];
5402 }
5403 for (int d=0; d<3; d++)
5404 {
5405 shape(7,d) = 0.5 * me0210[d] + qII02[d]
5406 + sq3 * (0.5 * me1210[d] + qII12[d]) - 1.5 * tI210[d];
5407 }
5408
5409 // Edge 0,4
5410 for (int d=0; d<3; d++)
5411 {
5412 shape(8,d) = 0.5 * te01[d] - sq3 * 0.5 * te11[d]
5413 - 1.5 * (tI120[d] + tII120[d] + tI210[d] + tII210[d]);
5414 }
5415 for (int d=0; d<3; d++)
5416 {
5417 shape(9,d) = 0.5 * te01[d] + sq3 * 0.5 * te11[d]
5418 - 1.5 * (tI120[d] + tII120[d] + tI210[d] + tII210[d]);
5419 }
5420
5421 // Edge 1,4
5422 for (int d=0; d<3; d++)
5423 {
5424 shape(10,d) = 0.5 * te02[d] - sq3 * 0.5 * te12[d]
5425 - 1.5 * (tII120[d] + tI211[d] + tII211[d]);
5426 }
5427 for (int d=0; d<3; d++)
5428 {
5429 shape(11,d) = 0.5 * te02[d] + sq3 * 0.5 * te12[d]
5430 - 1.5 * (tII120[d] + tI211[d] + tII211[d]);
5431 }
5432
5433 // Edge 2,4
5434 for (int d=0; d<3; d++)
5435 {
5436 shape(12,d) = 0.5 * te03[d] - sq3 * 0.5 * te13[d]
5437 - 1.5 * (tII211[d] + tII121[d]);
5438 }
5439 for (int d=0; d<3; d++)
5440 {
5441 shape(13,d) = 0.5 * te03[d] + sq3 * 0.5 * te13[d]
5442 - 1.5 * (tII211[d] + tII121[d]);
5443 }
5444
5445 // Edge 3,4
5446 for (int d=0; d<3; d++)
5447 {
5448 shape(14,d) = 0.5 * te04[d] - sq3 * 0.5 * te14[d]
5449 - 1.5 * (tI121[d] + tII121[d] + tII210[d]);
5450 }
5451 for (int d=0; d<3; d++)
5452 {
5453 shape(15,d) = 0.5 * te04[d] + sq3 * 0.5 * te14[d]
5454 - 1.5 * (tI121[d] + tII121[d] + tII210[d]);
5455 }
5456
5457 // Quadrilateral face
5458 for (int d=0; d<3; d++)
5459 {
5460 shape(16,d) = -2. * qI02[d] + 2. * sq3 * qI12[d];
5461 }
5462 for (int d=0; d<3; d++)
5463 {
5464 shape(17,d) = -2. * qI02[d] - 2. * sq3 * qI12[d];
5465 }
5466
5467 for (int d=0; d<3; d++)
5468 {
5469 shape(18,d) = 2. * qII02[d] - 2. * sq3 * qII12[d];
5470 }
5471 for (int d=0; d<3; d++)
5472 {
5473 shape(19,d) = 2. * qII02[d] + 2. * sq3 * qII12[d];
5474 }
5475
5476 // Triangular face 0,1,4
5477 for (int d=0; d<3; d++)
5478 {
5479 shape(20,d) = 3. * tI120[d] - 3. * tII120[d];
5480 }
5481 for (int d=0; d<3; d++)
5482 {
5483 shape(21,d) = 3. * tI120[d] + 6. * tII120[d];
5484 }
5485
5486 // Triangular face 1,2,4
5487 for (int d=0; d<3; d++)
5488 {
5489 shape(22,d) = 3. * tI211[d] - 3. * tII211[d];
5490 }
5491 for (int d=0; d<3; d++)
5492 {
5493 shape(23,d) = 3. * tI211[d] + 6. * tII211[d];
5494 }
5495
5496 // Triangular face 2,3,4
5497 for (int d=0; d<3; d++)
5498 {
5499 shape(24,d) = -6. * tI121[d] - 3. * tII121[d];
5500 }
5501 for (int d=0; d<3; d++)
5502 {
5503 shape(25,d) = 3. * tI121[d] + 6. * tII121[d];
5504 }
5505
5506 // Triangular face 3,0,4
5507 for (int d=0; d<3; d++)
5508 {
5509 shape(26,d) = -6. * tI210[d] - 3. * tII210[d];
5510 }
5511 for (int d=0; d<3; d++)
5512 {
5513 shape(27,d) = 3. * tI210[d] + 6. * tII210[d];
5514 }
5515}
5516
5518 DenseMatrix &curl_shape)
5519const
5520{
5521 const real_t one = 1.0;
5522 const real_t x = ip.x, y = ip.y, z = ip.z, z2 = 2. * z;
5523 const real_t ox = one - x - z, oy = one - y - z, oz = one - z;
5524
5525 const real_t tol = 1e-6;
5526
5527 if (oz <= tol)
5528 {
5529 // We must return the limit of the basis function derivatives as z->1.
5530 // In order to remain inside the pyramid in this limit the x and y
5531 // coordinates must be approaching 0. The resulting limiting basis
5532 // function values are:
5533 curl_shape(0,0) = 0.;
5534 curl_shape(0,1) = - 2.;
5535 curl_shape(0,2) = 1.;
5536
5537 curl_shape(1,0) = 0.;
5538 curl_shape(1,1) = 0.;
5539 curl_shape(1,2) = 1.;
5540
5541 curl_shape(2,0) = 0.;
5542 curl_shape(2,1) = 0.;
5543 curl_shape(2,2) = - 1.;
5544
5545 curl_shape(3,0) = 2.;
5546 curl_shape(3,1) = 0.;
5547 curl_shape(3,2) = - 1.;
5548
5549 curl_shape(4,0) = - 2.;
5550 curl_shape(4,1) = 2.;
5551 curl_shape(4,2) = 0.;
5552
5553 curl_shape(5,0) = 0.;
5554 curl_shape(5,1) = - 2.;
5555 curl_shape(5,2) = 0.;
5556
5557 curl_shape(6,0) = 0.;
5558 curl_shape(6,1) = 0.;
5559 curl_shape(6,2) = 0.;
5560
5561 curl_shape(7,0) = 2.;
5562 curl_shape(7,1) = 0.;
5563 curl_shape(7,2) = 0.;
5564
5565 return;
5566 }
5567
5568 real_t ozi = one / oz;
5569
5570 curl_shape(0,0) = - x * ozi;
5571 curl_shape(0,1) = - 2. + y * ozi;
5572 curl_shape(0,2) = 1.;
5573
5574 curl_shape(1,0) = x * ozi;
5575 curl_shape(1,1) = - y * ozi;
5576 curl_shape(1,2) = 1.;
5577
5578 curl_shape(2,0) = x * ozi;
5579 curl_shape(2,1) = - y * ozi;
5580 curl_shape(2,2) = - 1.;
5581
5582 curl_shape(3,0) = (2. - x - z2) * ozi;
5583 curl_shape(3,1) = y * ozi;
5584 curl_shape(3,2) = - 1.;
5585
5586 curl_shape(4,0) = - 2. * ox * ozi;
5587 curl_shape(4,1) = 2. * oy * ozi;
5588 curl_shape(4,2) = 0.;
5589
5590 curl_shape(5,0) = - 2. * x * ozi;
5591 curl_shape(5,1) = - 2. * oy * ozi;
5592 curl_shape(5,2) = 0.;
5593
5594 curl_shape(6,0) = 2. * x * ozi;
5595 curl_shape(6,1) = - 2. * y * ozi;
5596 curl_shape(6,2) = 0.;
5597
5598 curl_shape(7,0) = 2. * ox * ozi;
5599 curl_shape(7,1) = 2. * y * ozi;
5600 curl_shape(7,2) = 0.;
5601}
5602
5603const real_t Nedelec2PyrFiniteElement::tk[28][3] =
5604{
5605 {1,0,0}, {1,0,0}, {0,1,0}, {0,1,0},
5606 {1,0,0}, {1,0,0}, {0,1,0}, {0,1,0},
5607 {0,0,1}, {0,0,1}, {-1,0,1}, {-1,0,1},
5608 {-1,-1,1}, {-1,-1,1}, {0,-1,1}, {0,-1,1},
5609 {1,0,0}, {1,0,0}, {0,-1,0}, {0,-1,0},
5610 {1,0,0}, {0,0,1}, {0,1,0}, {-1,0,1},
5611 {-1,0,0}, {-1,-1,1}, {0,-1,0}, {0,-1,1}
5612};
5613
5615 ElementTransformation &Trans, DenseMatrix &I) const
5616{
5617 int k, j;
5618#ifdef MFEM_THREAD_SAFE
5620#endif
5621
5622#ifdef MFEM_DEBUG
5623 for (k = 0; k < dof; k++)
5624 {
5626 for (j = 0; j < dof; j++)
5627 {
5628 real_t d = ( vshape(j,0)*tk[k][0] + vshape(j,1)*tk[k][1] +
5629 vshape(j,2)*tk[k][2] );
5630 if (j == k) { d -= 1.0; }
5631 if (fabs(d) > 1.0e-12)
5632 {
5633 mfem::err << "Nedelec1PyrFiniteElement::GetLocalInterpolation (...)\n"
5634 " k = " << k << ", j = " << j << ", d = " << d << endl;
5635 mfem_error();
5636 }
5637 }
5638 }
5639#endif
5640
5642 ip.x = ip.y = ip.z = 0.0;
5643 Trans.SetIntPoint (&ip);
5644 // Trans must be linear
5645 const DenseMatrix &J = Trans.Jacobian();
5646 real_t vk[3];
5647 Vector xk (vk, 3);
5648
5649 for (k = 0; k < dof; k++)
5650 {
5651 Trans.Transform (Nodes.IntPoint (k), xk);
5652 ip.x = vk[0]; ip.y = vk[1]; ip.z = vk[2];
5653 CalcVShape (ip, vshape);
5654 // vk = J tk
5655 vk[0] = J(0,0)*tk[k][0]+J(0,1)*tk[k][1]+J(0,2)*tk[k][2];
5656 vk[1] = J(1,0)*tk[k][0]+J(1,1)*tk[k][1]+J(1,2)*tk[k][2];
5657 vk[2] = J(2,0)*tk[k][0]+J(2,1)*tk[k][1]+J(2,2)*tk[k][2];
5658 for (j = 0; j < dof; j++)
5659 if (fabs (I(k,j) = (vshape(j,0)*vk[0]+vshape(j,1)*vk[1]+
5660 vshape(j,2)*vk[2])) < 1.0e-12)
5661 {
5662 I(k,j) = 0.0;
5663 }
5664 }
5665}
5666
5669 Vector &dofs) const
5670{
5671 real_t vk[3];
5672 Vector xk (vk, 3);
5673
5674 for (int k = 0; k < dof; k++)
5675 {
5676 Trans.SetIntPoint (&Nodes.IntPoint (k));
5677 const DenseMatrix &J = Trans.Jacobian();
5678
5679 vc.Eval (xk, Trans, Nodes.IntPoint (k));
5680 // xk^t J tk
5681 dofs(k) =
5682 vk[0] * ( J(0,0)*tk[k][0]+J(0,1)*tk[k][1]+J(0,2)*tk[k][2] ) +
5683 vk[1] * ( J(1,0)*tk[k][0]+J(1,1)*tk[k][1]+J(1,2)*tk[k][2] ) +
5684 vk[2] * ( J(2,0)*tk[k][0]+J(2,1)*tk[k][1]+J(2,2)*tk[k][2] );
5685 }
5686}
5687
5689 ElementTransformation &Trans,
5690 DenseMatrix &grad) const
5691{
5692 DenseMatrix dshape(fe.GetDof(), 3);
5693 Vector grad_k(fe.GetDof());
5694
5695 grad.SetSize(dof, fe.GetDof());
5696 for (int k = 0; k < dof; k++)
5697 {
5698 fe.CalcDShape(Nodes.IntPoint(k), dshape);
5699 dshape.Mult(tk[k], grad_k);
5700 for (int j = 0; j < grad_k.Size(); j++)
5701 {
5702 grad(k,j) = (fabs(grad_k(j)) < 1e-12) ? 0.0 : grad_k(j);
5703 }
5704 }
5705}
5706
5707
5709 : VectorFiniteElement(3, Geometry::CUBE, 6, 1, H_DIV, FunctionSpace::Qk)
5710{
5711 // not real nodes ...
5712 // z = 0, y = 0, x = 1, y = 1, x = 0, z = 1
5713 Nodes.IntPoint(0).x = 0.5;
5714 Nodes.IntPoint(0).y = 0.5;
5715 Nodes.IntPoint(0).z = 0.0;
5716
5717 Nodes.IntPoint(1).x = 0.5;
5718 Nodes.IntPoint(1).y = 0.0;
5719 Nodes.IntPoint(1).z = 0.5;
5720
5721 Nodes.IntPoint(2).x = 1.0;
5722 Nodes.IntPoint(2).y = 0.5;
5723 Nodes.IntPoint(2).z = 0.5;
5724
5725 Nodes.IntPoint(3).x = 0.5;
5726 Nodes.IntPoint(3).y = 1.0;
5727 Nodes.IntPoint(3).z = 0.5;
5728
5729 Nodes.IntPoint(4).x = 0.0;
5730 Nodes.IntPoint(4).y = 0.5;
5731 Nodes.IntPoint(4).z = 0.5;
5732
5733 Nodes.IntPoint(5).x = 0.5;
5734 Nodes.IntPoint(5).y = 0.5;
5735 Nodes.IntPoint(5).z = 1.0;
5736}
5737
5739 DenseMatrix &shape) const
5740{
5741 real_t x = ip.x, y = ip.y, z = ip.z;
5742 // z = 0
5743 shape(0,0) = 0.;
5744 shape(0,1) = 0.;
5745 shape(0,2) = z - 1.;
5746 // y = 0
5747 shape(1,0) = 0.;
5748 shape(1,1) = y - 1.;
5749 shape(1,2) = 0.;
5750 // x = 1
5751 shape(2,0) = x;
5752 shape(2,1) = 0.;
5753 shape(2,2) = 0.;
5754 // y = 1
5755 shape(3,0) = 0.;
5756 shape(3,1) = y;
5757 shape(3,2) = 0.;
5758 // x = 0
5759 shape(4,0) = x - 1.;
5760 shape(4,1) = 0.;
5761 shape(4,2) = 0.;
5762 // z = 1
5763 shape(5,0) = 0.;
5764 shape(5,1) = 0.;
5765 shape(5,2) = z;
5766}
5767
5769 Vector &divshape) const
5770{
5771 divshape(0) = 1.;
5772 divshape(1) = 1.;
5773 divshape(2) = 1.;
5774 divshape(3) = 1.;
5775 divshape(4) = 1.;
5776 divshape(5) = 1.;
5777}
5778
5779const real_t RT0HexFiniteElement::nk[6][3] =
5780{{0,0,-1}, {0,-1,0}, {1,0,0}, {0,1,0}, {-1,0,0}, {0,0,1}};
5781
5783 ElementTransformation &Trans, DenseMatrix &I) const
5784{
5785 int k, j;
5786#ifdef MFEM_THREAD_SAFE
5788#endif
5789
5790#ifdef MFEM_DEBUG
5791 for (k = 0; k < 6; k++)
5792 {
5794 for (j = 0; j < 6; j++)
5795 {
5796 real_t d = ( vshape(j,0)*nk[k][0] + vshape(j,1)*nk[k][1] +
5797 vshape(j,2)*nk[k][2] );
5798 if (j == k) { d -= 1.0; }
5799 if (fabs(d) > 1.0e-12)
5800 {
5801 mfem::err << "RT0HexFiniteElement::GetLocalInterpolation (...)\n"
5802 " k = " << k << ", j = " << j << ", d = " << d << endl;
5803 mfem_error();
5804 }
5805 }
5806 }
5807#endif
5808
5810 ip.x = ip.y = ip.z = 0.0;
5811 Trans.SetIntPoint (&ip);
5812 // Trans must be linear
5813 // set Jinv = |J| J^{-t} = adj(J)^t
5814 const DenseMatrix &Jinv = Trans.TransposeAdjugateJacobian();
5815
5816 real_t vk[3];
5817 Vector xk (vk, 3);
5818
5819 for (k = 0; k < 6; k++)
5820 {
5821 Trans.Transform (Nodes.IntPoint (k), xk);
5822 ip.x = vk[0]; ip.y = vk[1]; ip.z = vk[2];
5823 CalcVShape (ip, vshape);
5824 // vk = |J| J^{-t} nk
5825 vk[0] = Jinv(0,0)*nk[k][0]+Jinv(0,1)*nk[k][1]+Jinv(0,2)*nk[k][2];
5826 vk[1] = Jinv(1,0)*nk[k][0]+Jinv(1,1)*nk[k][1]+Jinv(1,2)*nk[k][2];
5827 vk[2] = Jinv(2,0)*nk[k][0]+Jinv(2,1)*nk[k][1]+Jinv(2,2)*nk[k][2];
5828 for (j = 0; j < 6; j++)
5829 if (fabs (I(k,j) = (vshape(j,0)*vk[0]+vshape(j,1)*vk[1]+
5830 vshape(j,2)*vk[2])) < 1.0e-12)
5831 {
5832 I(k,j) = 0.0;
5833 }
5834 }
5835}
5836
5839 Vector &dofs) const
5840{
5841 real_t vk[3];
5842 Vector xk (vk, 3);
5843
5844 for (int k = 0; k < 6; k++)
5845 {
5846 Trans.SetIntPoint (&Nodes.IntPoint (k));
5847 // set Jinv = |J| J^{-t} = adj(J)^t
5848 const DenseMatrix &Jinv = Trans.TransposeAdjugateJacobian();
5849
5850 vc.Eval (xk, Trans, Nodes.IntPoint (k));
5851 // xk^t |J| J^{-t} nk
5852 dofs(k) =
5853 vk[0] * ( Jinv(0,0)*nk[k][0]+Jinv(0,1)*nk[k][1]+Jinv(0,2)*nk[k][2] ) +
5854 vk[1] * ( Jinv(1,0)*nk[k][0]+Jinv(1,1)*nk[k][1]+Jinv(1,2)*nk[k][2] ) +
5855 vk[2] * ( Jinv(2,0)*nk[k][0]+Jinv(2,1)*nk[k][1]+Jinv(2,2)*nk[k][2] );
5856 }
5857}
5858
5860 : VectorFiniteElement(3, Geometry::CUBE, 36, 2, H_DIV,
5861 FunctionSpace::Qk)
5862{
5863 // z = 0
5864 Nodes.IntPoint(2).x = 1./3.;
5865 Nodes.IntPoint(2).y = 1./3.;
5866 Nodes.IntPoint(2).z = 0.0;
5867 Nodes.IntPoint(3).x = 2./3.;
5868 Nodes.IntPoint(3).y = 1./3.;
5869 Nodes.IntPoint(3).z = 0.0;
5870 Nodes.IntPoint(0).x = 1./3.;
5871 Nodes.IntPoint(0).y = 2./3.;
5872 Nodes.IntPoint(0).z = 0.0;
5873 Nodes.IntPoint(1).x = 2./3.;
5874 Nodes.IntPoint(1).y = 2./3.;
5875 Nodes.IntPoint(1).z = 0.0;
5876 // y = 0
5877 Nodes.IntPoint(4).x = 1./3.;
5878 Nodes.IntPoint(4).y = 0.0;
5879 Nodes.IntPoint(4).z = 1./3.;
5880 Nodes.IntPoint(5).x = 2./3.;
5881 Nodes.IntPoint(5).y = 0.0;
5882 Nodes.IntPoint(5).z = 1./3.;
5883 Nodes.IntPoint(6).x = 1./3.;
5884 Nodes.IntPoint(6).y = 0.0;
5885 Nodes.IntPoint(6).z = 2./3.;
5886 Nodes.IntPoint(7).x = 2./3.;
5887 Nodes.IntPoint(7).y = 0.0;
5888 Nodes.IntPoint(7).z = 2./3.;
5889 // x = 1
5890 Nodes.IntPoint(8).x = 1.0;
5891 Nodes.IntPoint(8).y = 1./3.;
5892 Nodes.IntPoint(8).z = 1./3.;
5893 Nodes.IntPoint(9).x = 1.0;
5894 Nodes.IntPoint(9).y = 2./3.;
5895 Nodes.IntPoint(9).z = 1./3.;
5896 Nodes.IntPoint(10).x = 1.0;
5897 Nodes.IntPoint(10).y = 1./3.;
5898 Nodes.IntPoint(10).z = 2./3.;
5899 Nodes.IntPoint(11).x = 1.0;
5900 Nodes.IntPoint(11).y = 2./3.;
5901 Nodes.IntPoint(11).z = 2./3.;
5902 // y = 1
5903 Nodes.IntPoint(13).x = 1./3.;
5904 Nodes.IntPoint(13).y = 1.0;
5905 Nodes.IntPoint(13).z = 1./3.;
5906 Nodes.IntPoint(12).x = 2./3.;
5907 Nodes.IntPoint(12).y = 1.0;
5908 Nodes.IntPoint(12).z = 1./3.;
5909 Nodes.IntPoint(15).x = 1./3.;
5910 Nodes.IntPoint(15).y = 1.0;
5911 Nodes.IntPoint(15).z = 2./3.;
5912 Nodes.IntPoint(14).x = 2./3.;
5913 Nodes.IntPoint(14).y = 1.0;
5914 Nodes.IntPoint(14).z = 2./3.;
5915 // x = 0
5916 Nodes.IntPoint(17).x = 0.0;
5917 Nodes.IntPoint(17).y = 1./3.;
5918 Nodes.IntPoint(17).z = 1./3.;
5919 Nodes.IntPoint(16).x = 0.0;
5920 Nodes.IntPoint(16).y = 2./3.;
5921 Nodes.IntPoint(16).z = 1./3.;
5922 Nodes.IntPoint(19).x = 0.0;
5923 Nodes.IntPoint(19).y = 1./3.;
5924 Nodes.IntPoint(19).z = 2./3.;
5925 Nodes.IntPoint(18).x = 0.0;
5926 Nodes.IntPoint(18).y = 2./3.;
5927 Nodes.IntPoint(18).z = 2./3.;
5928 // z = 1
5929 Nodes.IntPoint(20).x = 1./3.;
5930 Nodes.IntPoint(20).y = 1./3.;
5931 Nodes.IntPoint(20).z = 1.0;
5932 Nodes.IntPoint(21).x = 2./3.;
5933 Nodes.IntPoint(21).y = 1./3.;
5934 Nodes.IntPoint(21).z = 1.0;
5935 Nodes.IntPoint(22).x = 1./3.;
5936 Nodes.IntPoint(22).y = 2./3.;
5937 Nodes.IntPoint(22).z = 1.0;
5938 Nodes.IntPoint(23).x = 2./3.;
5939 Nodes.IntPoint(23).y = 2./3.;
5940 Nodes.IntPoint(23).z = 1.0;
5941 // x = 0.5 (interior)
5942 Nodes.IntPoint(24).x = 0.5;
5943 Nodes.IntPoint(24).y = 1./3.;
5944 Nodes.IntPoint(24).z = 1./3.;
5945 Nodes.IntPoint(25).x = 0.5;
5946 Nodes.IntPoint(25).y = 1./3.;
5947 Nodes.IntPoint(25).z = 2./3.;
5948 Nodes.IntPoint(26).x = 0.5;
5949 Nodes.IntPoint(26).y = 2./3.;
5950 Nodes.IntPoint(26).z = 1./3.;
5951 Nodes.IntPoint(27).x = 0.5;
5952 Nodes.IntPoint(27).y = 2./3.;
5953 Nodes.IntPoint(27).z = 2./3.;
5954 // y = 0.5 (interior)
5955 Nodes.IntPoint(28).x = 1./3.;
5956 Nodes.IntPoint(28).y = 0.5;
5957 Nodes.IntPoint(28).z = 1./3.;
5958 Nodes.IntPoint(29).x = 1./3.;
5959 Nodes.IntPoint(29).y = 0.5;
5960 Nodes.IntPoint(29).z = 2./3.;
5961 Nodes.IntPoint(30).x = 2./3.;
5962 Nodes.IntPoint(30).y = 0.5;
5963 Nodes.IntPoint(30).z = 1./3.;
5964 Nodes.IntPoint(31).x = 2./3.;
5965 Nodes.IntPoint(31).y = 0.5;
5966 Nodes.IntPoint(31).z = 2./3.;
5967 // z = 0.5 (interior)
5968 Nodes.IntPoint(32).x = 1./3.;
5969 Nodes.IntPoint(32).y = 1./3.;
5970 Nodes.IntPoint(32).z = 0.5;
5971 Nodes.IntPoint(33).x = 1./3.;
5972 Nodes.IntPoint(33).y = 2./3.;
5973 Nodes.IntPoint(33).z = 0.5;
5974 Nodes.IntPoint(34).x = 2./3.;
5975 Nodes.IntPoint(34).y = 1./3.;
5976 Nodes.IntPoint(34).z = 0.5;
5977 Nodes.IntPoint(35).x = 2./3.;
5978 Nodes.IntPoint(35).y = 2./3.;
5979 Nodes.IntPoint(35).z = 0.5;
5980}
5981
5983 DenseMatrix &shape) const
5984{
5985 real_t x = ip.x, y = ip.y, z = ip.z;
5986 // z = 0
5987 shape(2,0) = 0.;
5988 shape(2,1) = 0.;
5989 shape(2,2) = -(1. - 3.*z + 2.*z*z)*( 2. - 3.*x)*( 2. - 3.*y);
5990 shape(3,0) = 0.;
5991 shape(3,1) = 0.;
5992 shape(3,2) = -(1. - 3.*z + 2.*z*z)*(-1. + 3.*x)*( 2. - 3.*y);
5993 shape(0,0) = 0.;
5994 shape(0,1) = 0.;
5995 shape(0,2) = -(1. - 3.*z + 2.*z*z)*( 2. - 3.*x)*(-1. + 3.*y);
5996 shape(1,0) = 0.;
5997 shape(1,1) = 0.;
5998 shape(1,2) = -(1. - 3.*z + 2.*z*z)*(-1. + 3.*x)*(-1. + 3.*y);
5999 // y = 0
6000 shape(4,0) = 0.;
6001 shape(4,1) = -(1. - 3.*y + 2.*y*y)*( 2. - 3.*x)*( 2. - 3.*z);
6002 shape(4,2) = 0.;
6003 shape(5,0) = 0.;
6004 shape(5,1) = -(1. - 3.*y + 2.*y*y)*(-1. + 3.*x)*( 2. - 3.*z);
6005 shape(5,2) = 0.;
6006 shape(6,0) = 0.;
6007 shape(6,1) = -(1. - 3.*y + 2.*y*y)*( 2. - 3.*x)*(-1. + 3.*z);
6008 shape(6,2) = 0.;
6009 shape(7,0) = 0.;
6010 shape(7,1) = -(1. - 3.*y + 2.*y*y)*(-1. + 3.*x)*(-1. + 3.*z);
6011 shape(7,2) = 0.;
6012 // x = 1
6013 shape(8,0) = (-x + 2.*x*x)*( 2. - 3.*y)*( 2. - 3.*z);
6014 shape(8,1) = 0.;
6015 shape(8,2) = 0.;
6016 shape(9,0) = (-x + 2.*x*x)*(-1. + 3.*y)*( 2. - 3.*z);
6017 shape(9,1) = 0.;
6018 shape(9,2) = 0.;
6019 shape(10,0) = (-x + 2.*x*x)*( 2. - 3.*y)*(-1. + 3.*z);
6020 shape(10,1) = 0.;
6021 shape(10,2) = 0.;
6022 shape(11,0) = (-x + 2.*x*x)*(-1. + 3.*y)*(-1. + 3.*z);
6023 shape(11,1) = 0.;
6024 shape(11,2) = 0.;
6025 // y = 1
6026 shape(13,0) = 0.;
6027 shape(13,1) = (-y + 2.*y*y)*( 2. - 3.*x)*( 2. - 3.*z);
6028 shape(13,2) = 0.;
6029 shape(12,0) = 0.;
6030 shape(12,1) = (-y + 2.*y*y)*(-1. + 3.*x)*( 2. - 3.*z);
6031 shape(12,2) = 0.;
6032 shape(15,0) = 0.;
6033 shape(15,1) = (-y + 2.*y*y)*( 2. - 3.*x)*(-1. + 3.*z);
6034 shape(15,2) = 0.;
6035 shape(14,0) = 0.;
6036 shape(14,1) = (-y + 2.*y*y)*(-1. + 3.*x)*(-1. + 3.*z);
6037 shape(14,2) = 0.;
6038 // x = 0
6039 shape(17,0) = -(1. - 3.*x + 2.*x*x)*( 2. - 3.*y)*( 2. - 3.*z);
6040 shape(17,1) = 0.;
6041 shape(17,2) = 0.;
6042 shape(16,0) = -(1. - 3.*x + 2.*x*x)*(-1. + 3.*y)*( 2. - 3.*z);
6043 shape(16,1) = 0.;
6044 shape(16,2) = 0.;
6045 shape(19,0) = -(1. - 3.*x + 2.*x*x)*( 2. - 3.*y)*(-1. + 3.*z);
6046 shape(19,1) = 0.;
6047 shape(19,2) = 0.;
6048 shape(18,0) = -(1. - 3.*x + 2.*x*x)*(-1. + 3.*y)*(-1. + 3.*z);
6049 shape(18,1) = 0.;
6050 shape(18,2) = 0.;
6051 // z = 1
6052 shape(20,0) = 0.;
6053 shape(20,1) = 0.;
6054 shape(20,2) = (-z + 2.*z*z)*( 2. - 3.*x)*( 2. - 3.*y);
6055 shape(21,0) = 0.;
6056 shape(21,1) = 0.;
6057 shape(21,2) = (-z + 2.*z*z)*(-1. + 3.*x)*( 2. - 3.*y);
6058 shape(22,0) = 0.;
6059 shape(22,1) = 0.;
6060 shape(22,2) = (-z + 2.*z*z)*( 2. - 3.*x)*(-1. + 3.*y);
6061 shape(23,0) = 0.;
6062 shape(23,1) = 0.;
6063 shape(23,2) = (-z + 2.*z*z)*(-1. + 3.*x)*(-1. + 3.*y);
6064 // x = 0.5 (interior)
6065 shape(24,0) = (4.*x - 4.*x*x)*( 2. - 3.*y)*( 2. - 3.*z);
6066 shape(24,1) = 0.;
6067 shape(24,2) = 0.;
6068 shape(25,0) = (4.*x - 4.*x*x)*( 2. - 3.*y)*(-1. + 3.*z);
6069 shape(25,1) = 0.;
6070 shape(25,2) = 0.;
6071 shape(26,0) = (4.*x - 4.*x*x)*(-1. + 3.*y)*( 2. - 3.*z);
6072 shape(26,1) = 0.;
6073 shape(26,2) = 0.;
6074 shape(27,0) = (4.*x - 4.*x*x)*(-1. + 3.*y)*(-1. + 3.*z);
6075 shape(27,1) = 0.;
6076 shape(27,2) = 0.;
6077 // y = 0.5 (interior)
6078 shape(28,0) = 0.;
6079 shape(28,1) = (4.*y - 4.*y*y)*( 2. - 3.*x)*( 2. - 3.*z);
6080 shape(28,2) = 0.;
6081 shape(29,0) = 0.;
6082 shape(29,1) = (4.*y - 4.*y*y)*( 2. - 3.*x)*(-1. + 3.*z);
6083 shape(29,2) = 0.;
6084 shape(30,0) = 0.;
6085 shape(30,1) = (4.*y - 4.*y*y)*(-1. + 3.*x)*( 2. - 3.*z);
6086 shape(30,2) = 0.;
6087 shape(31,0) = 0.;
6088 shape(31,1) = (4.*y - 4.*y*y)*(-1. + 3.*x)*(-1. + 3.*z);
6089 shape(31,2) = 0.;
6090 // z = 0.5 (interior)
6091 shape(32,0) = 0.;
6092 shape(32,1) = 0.;
6093 shape(32,2) = (4.*z - 4.*z*z)*( 2. - 3.*x)*( 2. - 3.*y);
6094 shape(33,0) = 0.;
6095 shape(33,1) = 0.;
6096 shape(33,2) = (4.*z - 4.*z*z)*( 2. - 3.*x)*(-1. + 3.*y);
6097 shape(34,0) = 0.;
6098 shape(34,1) = 0.;
6099 shape(34,2) = (4.*z - 4.*z*z)*(-1. + 3.*x)*( 2. - 3.*y);
6100 shape(35,0) = 0.;
6101 shape(35,1) = 0.;
6102 shape(35,2) = (4.*z - 4.*z*z)*(-1. + 3.*x)*(-1. + 3.*y);
6103}
6104
6106 Vector &divshape) const
6107{
6108 real_t x = ip.x, y = ip.y, z = ip.z;
6109 // z = 0
6110 divshape(2) = -(-3. + 4.*z)*( 2. - 3.*x)*( 2. - 3.*y);
6111 divshape(3) = -(-3. + 4.*z)*(-1. + 3.*x)*( 2. - 3.*y);
6112 divshape(0) = -(-3. + 4.*z)*( 2. - 3.*x)*(-1. + 3.*y);
6113 divshape(1) = -(-3. + 4.*z)*(-1. + 3.*x)*(-1. + 3.*y);
6114 // y = 0
6115 divshape(4) = -(-3. + 4.*y)*( 2. - 3.*x)*( 2. - 3.*z);
6116 divshape(5) = -(-3. + 4.*y)*(-1. + 3.*x)*( 2. - 3.*z);
6117 divshape(6) = -(-3. + 4.*y)*( 2. - 3.*x)*(-1. + 3.*z);
6118 divshape(7) = -(-3. + 4.*y)*(-1. + 3.*x)*(-1. + 3.*z);
6119 // x = 1
6120 divshape(8) = (-1. + 4.*x)*( 2. - 3.*y)*( 2. - 3.*z);
6121 divshape(9) = (-1. + 4.*x)*(-1. + 3.*y)*( 2. - 3.*z);
6122 divshape(10) = (-1. + 4.*x)*( 2. - 3.*y)*(-1. + 3.*z);
6123 divshape(11) = (-1. + 4.*x)*(-1. + 3.*y)*(-1. + 3.*z);
6124 // y = 1
6125 divshape(13) = (-1. + 4.*y)*( 2. - 3.*x)*( 2. - 3.*z);
6126 divshape(12) = (-1. + 4.*y)*(-1. + 3.*x)*( 2. - 3.*z);
6127 divshape(15) = (-1. + 4.*y)*( 2. - 3.*x)*(-1. + 3.*z);
6128 divshape(14) = (-1. + 4.*y)*(-1. + 3.*x)*(-1. + 3.*z);
6129 // x = 0
6130 divshape(17) = -(-3. + 4.*x)*( 2. - 3.*y)*( 2. - 3.*z);
6131 divshape(16) = -(-3. + 4.*x)*(-1. + 3.*y)*( 2. - 3.*z);
6132 divshape(19) = -(-3. + 4.*x)*( 2. - 3.*y)*(-1. + 3.*z);
6133 divshape(18) = -(-3. + 4.*x)*(-1. + 3.*y)*(-1. + 3.*z);
6134 // z = 1
6135 divshape(20) = (-1. + 4.*z)*( 2. - 3.*x)*( 2. - 3.*y);
6136 divshape(21) = (-1. + 4.*z)*(-1. + 3.*x)*( 2. - 3.*y);
6137 divshape(22) = (-1. + 4.*z)*( 2. - 3.*x)*(-1. + 3.*y);
6138 divshape(23) = (-1. + 4.*z)*(-1. + 3.*x)*(-1. + 3.*y);
6139 // x = 0.5 (interior)
6140 divshape(24) = ( 4. - 8.*x)*( 2. - 3.*y)*( 2. - 3.*z);
6141 divshape(25) = ( 4. - 8.*x)*( 2. - 3.*y)*(-1. + 3.*z);
6142 divshape(26) = ( 4. - 8.*x)*(-1. + 3.*y)*( 2. - 3.*z);
6143 divshape(27) = ( 4. - 8.*x)*(-1. + 3.*y)*(-1. + 3.*z);
6144 // y = 0.5 (interior)
6145 divshape(28) = ( 4. - 8.*y)*( 2. - 3.*x)*( 2. - 3.*z);
6146 divshape(29) = ( 4. - 8.*y)*( 2. - 3.*x)*(-1. + 3.*z);
6147 divshape(30) = ( 4. - 8.*y)*(-1. + 3.*x)*( 2. - 3.*z);
6148 divshape(31) = ( 4. - 8.*y)*(-1. + 3.*x)*(-1. + 3.*z);
6149 // z = 0.5 (interior)
6150 divshape(32) = ( 4. - 8.*z)*( 2. - 3.*x)*( 2. - 3.*y);
6151 divshape(33) = ( 4. - 8.*z)*( 2. - 3.*x)*(-1. + 3.*y);
6152 divshape(34) = ( 4. - 8.*z)*(-1. + 3.*x)*( 2. - 3.*y);
6153 divshape(35) = ( 4. - 8.*z)*(-1. + 3.*x)*(-1. + 3.*y);
6154}
6155
6156const real_t RT1HexFiniteElement::nk[36][3] =
6157{
6158 {0, 0,-1}, {0, 0,-1}, {0, 0,-1}, {0, 0,-1},
6159 {0,-1, 0}, {0,-1, 0}, {0,-1, 0}, {0,-1, 0},
6160 {1, 0, 0}, {1, 0, 0}, {1, 0, 0}, {1, 0, 0},
6161 {0, 1, 0}, {0, 1, 0}, {0, 1, 0}, {0, 1, 0},
6162 {-1,0, 0}, {-1,0, 0}, {-1,0, 0}, {-1,0, 0},
6163 {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1},
6164 {1, 0, 0}, {1, 0, 0}, {1, 0, 0}, {1, 0, 0},
6165 {0, 1, 0}, {0, 1, 0}, {0, 1, 0}, {0, 1, 0},
6166 {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}
6167};
6168
6170 ElementTransformation &Trans, DenseMatrix &I) const
6171{
6172 int k, j;
6173#ifdef MFEM_THREAD_SAFE
6175#endif
6176
6177#ifdef MFEM_DEBUG
6178 for (k = 0; k < 36; k++)
6179 {
6181 for (j = 0; j < 36; j++)
6182 {
6183 real_t d = ( vshape(j,0)*nk[k][0] + vshape(j,1)*nk[k][1] +
6184 vshape(j,2)*nk[k][2] );
6185 if (j == k) { d -= 1.0; }
6186 if (fabs(d) > 1.0e-12)
6187 {
6188 mfem::err << "RT0HexFiniteElement::GetLocalInterpolation (...)\n"
6189 " k = " << k << ", j = " << j << ", d = " << d << endl;
6190 mfem_error();
6191 }
6192 }
6193 }
6194#endif
6195
6197 ip.x = ip.y = ip.z = 0.0;
6198 Trans.SetIntPoint (&ip);
6199 // Trans must be linear
6200 // set Jinv = |J| J^{-t} = adj(J)^t
6201 const DenseMatrix &Jinv = Trans.TransposeAdjugateJacobian();
6202
6203 real_t vk[3];
6204 Vector xk (vk, 3);
6205
6206 for (k = 0; k < 36; k++)
6207 {
6208 Trans.Transform (Nodes.IntPoint (k), xk);
6209 ip.x = vk[0]; ip.y = vk[1]; ip.z = vk[2];
6210 CalcVShape (ip, vshape);
6211 // vk = |J| J^{-t} nk
6212 vk[0] = Jinv(0,0)*nk[k][0]+Jinv(0,1)*nk[k][1]+Jinv(0,2)*nk[k][2];
6213 vk[1] = Jinv(1,0)*nk[k][0]+Jinv(1,1)*nk[k][1]+Jinv(1,2)*nk[k][2];
6214 vk[2] = Jinv(2,0)*nk[k][0]+Jinv(2,1)*nk[k][1]+Jinv(2,2)*nk[k][2];
6215 for (j = 0; j < 36; j++)
6216 if (fabs (I(k,j) = (vshape(j,0)*vk[0]+vshape(j,1)*vk[1]+
6217 vshape(j,2)*vk[2])) < 1.0e-12)
6218 {
6219 I(k,j) = 0.0;
6220 }
6221 }
6222}
6223
6226 Vector &dofs) const
6227{
6228 real_t vk[3];
6229 Vector xk (vk, 3);
6230
6231 for (int k = 0; k < 36; k++)
6232 {
6233 Trans.SetIntPoint (&Nodes.IntPoint (k));
6234 // set Jinv = |J| J^{-t} = adj(J)^t
6235 const DenseMatrix &Jinv = Trans.TransposeAdjugateJacobian();
6236
6237 vc.Eval (xk, Trans, Nodes.IntPoint (k));
6238 // xk^t |J| J^{-t} nk
6239 dofs(k) =
6240 vk[0] * ( Jinv(0,0)*nk[k][0]+Jinv(0,1)*nk[k][1]+Jinv(0,2)*nk[k][2] ) +
6241 vk[1] * ( Jinv(1,0)*nk[k][0]+Jinv(1,1)*nk[k][1]+Jinv(1,2)*nk[k][2] ) +
6242 vk[2] * ( Jinv(2,0)*nk[k][0]+Jinv(2,1)*nk[k][1]+Jinv(2,2)*nk[k][2] );
6243 }
6244}
6245
6247 : VectorFiniteElement(3, Geometry::TETRAHEDRON, 4, 1, H_DIV)
6248{
6249 // not real nodes ...
6250 Nodes.IntPoint(0).x = 0.33333333333333333333;
6251 Nodes.IntPoint(0).y = 0.33333333333333333333;
6252 Nodes.IntPoint(0).z = 0.33333333333333333333;
6253
6254 Nodes.IntPoint(1).x = 0.0;
6255 Nodes.IntPoint(1).y = 0.33333333333333333333;
6256 Nodes.IntPoint(1).z = 0.33333333333333333333;
6257
6258 Nodes.IntPoint(2).x = 0.33333333333333333333;
6259 Nodes.IntPoint(2).y = 0.0;
6260 Nodes.IntPoint(2).z = 0.33333333333333333333;
6261
6262 Nodes.IntPoint(3).x = 0.33333333333333333333;
6263 Nodes.IntPoint(3).y = 0.33333333333333333333;
6264 Nodes.IntPoint(3).z = 0.0;
6265}
6266
6268 DenseMatrix &shape) const
6269{
6270 real_t x2 = 2.0*ip.x, y2 = 2.0*ip.y, z2 = 2.0*ip.z;
6271
6272 shape(0,0) = x2;
6273 shape(0,1) = y2;
6274 shape(0,2) = z2;
6275
6276 shape(1,0) = x2 - 2.0;
6277 shape(1,1) = y2;
6278 shape(1,2) = z2;
6279
6280 shape(2,0) = x2;
6281 shape(2,1) = y2 - 2.0;
6282 shape(2,2) = z2;
6283
6284 shape(3,0) = x2;
6285 shape(3,1) = y2;
6286 shape(3,2) = z2 - 2.0;
6287}
6288
6290 Vector &divshape) const
6291{
6292 divshape(0) = 6.0;
6293 divshape(1) = 6.0;
6294 divshape(2) = 6.0;
6295 divshape(3) = 6.0;
6296}
6297
6298const real_t RT0TetFiniteElement::nk[4][3] =
6299{{.5,.5,.5}, {-.5,0,0}, {0,-.5,0}, {0,0,-.5}};
6300
6302 ElementTransformation &Trans, DenseMatrix &I) const
6303{
6304 int k, j;
6305#ifdef MFEM_THREAD_SAFE
6307#endif
6308
6309#ifdef MFEM_DEBUG
6310 for (k = 0; k < 4; k++)
6311 {
6313 for (j = 0; j < 4; j++)
6314 {
6315 real_t d = ( vshape(j,0)*nk[k][0] + vshape(j,1)*nk[k][1] +
6316 vshape(j,2)*nk[k][2] );
6317 if (j == k) { d -= 1.0; }
6318 if (fabs(d) > 1.0e-12)
6319 {
6320 mfem::err << "RT0TetFiniteElement::GetLocalInterpolation (...)\n"
6321 " k = " << k << ", j = " << j << ", d = " << d << endl;
6322 mfem_error();
6323 }
6324 }
6325 }
6326#endif
6327
6329 ip.x = ip.y = ip.z = 0.0;
6330 Trans.SetIntPoint (&ip);
6331 // Trans must be linear
6332 // set Jinv = |J| J^{-t} = adj(J)^t
6333 const DenseMatrix &Jinv = Trans.TransposeAdjugateJacobian();
6334
6335 real_t vk[3];
6336 Vector xk (vk, 3);
6337
6338 for (k = 0; k < 4; k++)
6339 {
6340 Trans.Transform (Nodes.IntPoint (k), xk);
6341 ip.x = vk[0]; ip.y = vk[1]; ip.z = vk[2];
6342 CalcVShape (ip, vshape);
6343 // vk = |J| J^{-t} nk
6344 vk[0] = Jinv(0,0)*nk[k][0]+Jinv(0,1)*nk[k][1]+Jinv(0,2)*nk[k][2];
6345 vk[1] = Jinv(1,0)*nk[k][0]+Jinv(1,1)*nk[k][1]+Jinv(1,2)*nk[k][2];
6346 vk[2] = Jinv(2,0)*nk[k][0]+Jinv(2,1)*nk[k][1]+Jinv(2,2)*nk[k][2];
6347 for (j = 0; j < 4; j++)
6348 if (fabs (I(k,j) = (vshape(j,0)*vk[0]+vshape(j,1)*vk[1]+
6349 vshape(j,2)*vk[2])) < 1.0e-12)
6350 {
6351 I(k,j) = 0.0;
6352 }
6353 }
6354}
6355
6358 Vector &dofs) const
6359{
6360 real_t vk[3];
6361 Vector xk (vk, 3);
6362
6363 for (int k = 0; k < 4; k++)
6364 {
6365 Trans.SetIntPoint (&Nodes.IntPoint (k));
6366 // set Jinv = |J| J^{-t} = adj(J)^t
6367 const DenseMatrix &Jinv = Trans.TransposeAdjugateJacobian();
6368
6369 vc.Eval (xk, Trans, Nodes.IntPoint (k));
6370 // xk^t |J| J^{-t} nk
6371 dofs(k) =
6372 vk[0] * ( Jinv(0,0)*nk[k][0]+Jinv(0,1)*nk[k][1]+Jinv(0,2)*nk[k][2] ) +
6373 vk[1] * ( Jinv(1,0)*nk[k][0]+Jinv(1,1)*nk[k][1]+Jinv(1,2)*nk[k][2] ) +
6374 vk[2] * ( Jinv(2,0)*nk[k][0]+Jinv(2,1)*nk[k][1]+Jinv(2,2)*nk[k][2] );
6375 }
6376}
6377
6379 : VectorFiniteElement(3, Geometry::PRISM, 5, 1, H_DIV, FunctionSpace::Pk)
6380{
6381 // not real nodes ...
6382 Nodes.IntPoint(0).x = 0.33333333333333333333;
6383 Nodes.IntPoint(0).y = 0.33333333333333333333;
6384 Nodes.IntPoint(0).z = 0.0;
6385
6386 Nodes.IntPoint(1).x = 0.33333333333333333333;
6387 Nodes.IntPoint(1).y = 0.33333333333333333333;
6388 Nodes.IntPoint(1).z = 1.0;
6389
6390 Nodes.IntPoint(2).x = 0.5;
6391 Nodes.IntPoint(2).y = 0.0;
6392 Nodes.IntPoint(2).z = 0.5;
6393
6394 Nodes.IntPoint(3).x = 0.5;
6395 Nodes.IntPoint(3).y = 0.5;
6396 Nodes.IntPoint(3).z = 0.5;
6397
6398 Nodes.IntPoint(4).x = 0.0;
6399 Nodes.IntPoint(4).y = 0.5;
6400 Nodes.IntPoint(4).z = 0.5;
6401}
6402
6404 DenseMatrix &shape) const
6405{
6406 real_t x = ip.x, y = ip.y, z2 = 2.0*ip.z;
6407
6408 shape(0,0) = 0.0;
6409 shape(0,1) = 0.0;
6410 shape(0,2) = z2 - 2.0;
6411
6412 shape(1,0) = 0.0;
6413 shape(1,1) = 0.0;
6414 shape(1,2) = z2;
6415
6416 shape(2,0) = x;
6417 shape(2,1) = y - 1.0;
6418 shape(2,2) = 0.0;
6419
6420 shape(3,0) = x;
6421 shape(3,1) = y;
6422 shape(3,2) = 0.0;
6423
6424 shape(4,0) = x - 1.0;
6425 shape(4,1) = y;
6426 shape(4,2) = 0.0;
6427}
6428
6430 Vector &divshape) const
6431{
6432 divshape(0) = 2.0;
6433 divshape(1) = 2.0;
6434 divshape(2) = 2.0;
6435 divshape(3) = 2.0;
6436 divshape(4) = 2.0;
6437}
6438
6439const real_t RT0WdgFiniteElement::nk[5][3] =
6440{{0.,0.,-.5}, {0.,0.,.5}, {0,-1.,0}, {1.,1.,0}, {-1.,0,0}};
6441
6443 ElementTransformation &Trans, DenseMatrix &I) const
6444{
6445 int k, j;
6446#ifdef MFEM_THREAD_SAFE
6448#endif
6449
6450#ifdef MFEM_DEBUG
6451 for (k = 0; k < dof; k++)
6452 {
6454 for (j = 0; j < dof; j++)
6455 {
6456 real_t d = ( vshape(j,0)*nk[k][0] + vshape(j,1)*nk[k][1] +
6457 vshape(j,2)*nk[k][2] );
6458 if (j == k) { d -= 1.0; }
6459 if (fabs(d) > 1.0e-12)
6460 {
6461 mfem::err << "RT0WdgFiniteElement::GetLocalInterpolation (...)\n"
6462 " k = " << k << ", j = " << j << ", d = " << d << endl;
6463 mfem_error();
6464 }
6465 }
6466 }
6467#endif
6468
6470 ip.x = ip.y = ip.z = 0.0;
6471 Trans.SetIntPoint (&ip);
6472 // Trans must be linear
6473 // set Jinv = |J| J^{-t} = adj(J)^t
6474 const DenseMatrix &Jinv = Trans.TransposeAdjugateJacobian();
6475
6476 real_t vk[3];
6477 Vector xk (vk, 3);
6478
6479 for (k = 0; k < dof; k++)
6480 {
6481 Trans.Transform (Nodes.IntPoint (k), xk);
6482 ip.x = vk[0]; ip.y = vk[1]; ip.z = vk[2];
6483 CalcVShape (ip, vshape);
6484 // vk = |J| J^{-t} nk
6485 vk[0] = Jinv(0,0)*nk[k][0]+Jinv(0,1)*nk[k][1]+Jinv(0,2)*nk[k][2];
6486 vk[1] = Jinv(1,0)*nk[k][0]+Jinv(1,1)*nk[k][1]+Jinv(1,2)*nk[k][2];
6487 vk[2] = Jinv(2,0)*nk[k][0]+Jinv(2,1)*nk[k][1]+Jinv(2,2)*nk[k][2];
6488 for (j = 0; j < dof; j++)
6489 if (fabs (I(k,j) = (vshape(j,0)*vk[0]+vshape(j,1)*vk[1]+
6490 vshape(j,2)*vk[2])) < 1.0e-12)
6491 {
6492 I(k,j) = 0.0;
6493 }
6494 }
6495}
6496
6499 Vector &dofs) const
6500{
6501 real_t vk[3];
6502 Vector xk (vk, 3);
6503
6504 for (int k = 0; k < 5; k++)
6505 {
6506 Trans.SetIntPoint (&Nodes.IntPoint (k));
6507 // set Jinv = |J| J^{-t} = adj(J)^t
6508 const DenseMatrix &Jinv = Trans.TransposeAdjugateJacobian();
6509
6510 vc.Eval (xk, Trans, Nodes.IntPoint (k));
6511 // xk^t |J| J^{-t} nk
6512 dofs(k) =
6513 vk[0] * ( Jinv(0,0)*nk[k][0]+Jinv(0,1)*nk[k][1]+Jinv(0,2)*nk[k][2] ) +
6514 vk[1] * ( Jinv(1,0)*nk[k][0]+Jinv(1,1)*nk[k][1]+Jinv(1,2)*nk[k][2] ) +
6515 vk[2] * ( Jinv(2,0)*nk[k][0]+Jinv(2,1)*nk[k][1]+Jinv(2,2)*nk[k][2] );
6516 }
6517}
6518
6520 ElementTransformation &Trans,
6521 DenseMatrix &curl) const
6522{
6523 DenseMatrix curl_shape(fe.GetDof(), dim);
6524 Vector curl_k(fe.GetDof());
6525
6526 curl.SetSize(dof, fe.GetDof());
6527 for (int k = 0; k < dof; k++)
6528 {
6529 fe.CalcCurlShape(Nodes.IntPoint(k), curl_shape);
6530 curl_shape.Mult(nk[k], curl_k);
6531 for (int j = 0; j < curl_k.Size(); j++)
6532 {
6533 curl(k,j) = (fabs(curl_k(j)) < 1e-12) ? 0.0 : curl_k(j);
6534 }
6535 }
6536}
6537
6539 : VectorFiniteElement(3, Geometry::PYRAMID, 5, 1, H_DIV, FunctionSpace::Uk),
6540 rt0(rt0tets)
6541{
6542 // not real nodes ...
6543 Nodes.IntPoint(0).x = 0.5;
6544 Nodes.IntPoint(0).y = 0.5;
6545 Nodes.IntPoint(0).z = 0.0;
6546
6547 Nodes.IntPoint(1).x = 0.33333333333333333333;
6548 Nodes.IntPoint(1).y = 0.0;
6549 Nodes.IntPoint(1).z = 0.33333333333333333333;
6550
6551 Nodes.IntPoint(2).x = 0.66666666666666666667;
6552 Nodes.IntPoint(2).y = 0.33333333333333333333;
6553 Nodes.IntPoint(2).z = 0.33333333333333333333;
6554
6555 Nodes.IntPoint(3).x = 0.33333333333333333333;
6556 Nodes.IntPoint(3).y = 0.66666666666666666667;
6557 Nodes.IntPoint(3).z = 0.33333333333333333333;
6558
6559 Nodes.IntPoint(4).x = 0.0;
6560 Nodes.IntPoint(4).y = 0.33333333333333333333;
6561 Nodes.IntPoint(4).z = 0.33333333333333333333;
6562}
6563
6565 DenseMatrix &shape) const
6566{
6567 real_t x = ip.x, y = ip.y, z = ip.z, oz = 1.0 - z;
6568 real_t x2 = 2.0*ip.x, y2 = 2.0*ip.y, z2 = 2.0*ip.z;
6569
6570 real_t tol = 1e-6;
6571
6572 if (oz <= tol)
6573 {
6574 // We must return the limit of the basis functions as z->1. In order to
6575 // remain inside the pyramid in this limit the x and y coordinates must
6576 // be approaching 0. Unfortunately we obtain different limits if we
6577 // approach (0,0,1) from different directions. The values provided below
6578 // are the limits of the average over the square cross section
6579 // [0,epsilon]x[0,epsilon] at the height z = 1-epsilon as epsilon -> 0.
6580 shape(0,0) = 0.0;
6581 shape(0,1) = 0.0;
6582 shape(0,2) = 0.0;
6583
6584 shape(1,0) = - 0.5;
6585 shape(1,1) = - 1.5;
6586 shape(1,2) = 1.;
6587
6588 shape(2,0) = 0.5;
6589 shape(2,1) = - 0.5;
6590 shape(2,2) = 1.0;
6591
6592 shape(3,0) = - 0.5;
6593 shape(3,1) = 0.5;
6594 shape(3,2) = 1.0;
6595
6596 shape(4,0) = - 1.5;
6597 shape(4,1) = - 0.5;
6598 shape(4,2) = 1.0;
6599
6600 if (!rt0)
6601 {
6602 for (int i=1; i<5; i++)
6603 for (int j=0; j<3; j++)
6604 {
6605 shape(i, j) *= 0.5;
6606 }
6607 }
6608
6609 return;
6610 }
6611
6612 real_t ozi = 1.0 / oz;
6613
6614 shape(0,0) = x;
6615 shape(0,1) = y;
6616 shape(0,2) = z - 1.;
6617
6618 shape(1,0) = - x * z * ozi;
6619 shape(1,1) = (y2 + z2 - y * z - 2.0) * ozi;
6620 shape(1,2) = z;
6621
6622 shape(2,0) = x * (2.0 - z) * ozi;
6623 shape(2,1) = - y * z * ozi;
6624 shape(2,2) = z;
6625
6626 shape(3,0) = - x * z * ozi;
6627 shape(3,1) = y * (2.0 - z) * ozi;
6628 shape(3,2) = z;
6629
6630 shape(4,0) = (x2 + z2 - x * z - 2.0) * ozi;
6631 shape(4,1) = - y * z * ozi;
6632 shape(4,2) = z;
6633
6634 if (!rt0)
6635 {
6636 for (int i=1; i<5; i++)
6637 for (int j=0; j<3; j++)
6638 {
6639 shape(i, j) *= 0.5;
6640 }
6641 }
6642}
6643
6645 Vector &divshape) const
6646{
6647 divshape(0) = 3.0;
6648 divshape(1) = 3.0;
6649 divshape(2) = 3.0;
6650 divshape(3) = 3.0;
6651 divshape(4) = 3.0;
6652
6653 if (!rt0)
6654 {
6655 for (int i=1; i<5; i++)
6656 {
6657 divshape(i) *= 0.5;
6658 }
6659 }
6660}
6661
6662const real_t RT0PyrFiniteElement::nk[5][3] =
6663{{0.,0.,-1}, {0,-1,0}, {1,0,1}, {0,1,1}, {-1,0,0}};
6664
6666 ElementTransformation &Trans, DenseMatrix &I) const
6667{
6668 int k, j;
6669#ifdef MFEM_THREAD_SAFE
6671#endif
6672
6673#ifdef MFEM_DEBUG
6674 for (k = 0; k < dof; k++)
6675 {
6677 for (j = 0; j < dof; j++)
6678 {
6679 real_t d = ( vshape(j,0)*nk[k][0] + vshape(j,1)*nk[k][1] +
6680 vshape(j,2)*nk[k][2] );
6681 if (j == k) { d -= 1.0; }
6682 if (fabs(d) > 1.0e-12)
6683 {
6684 mfem::err << "RT0PyrFiniteElement::GetLocalInterpolation (...)\n"
6685 " k = " << k << ", j = " << j << ", d = " << d << endl;
6686 mfem_error();
6687 }
6688 }
6689 }
6690#endif
6691
6693 ip.x = ip.y = ip.z = 0.0;
6694 Trans.SetIntPoint (&ip);
6695 // Trans must be linear
6696 // set Jinv = |J| J^{-t} = adj(J)^t
6697 const DenseMatrix &Jinv = Trans.TransposeAdjugateJacobian();
6698
6699 real_t vk[3];
6700 Vector xk (vk, 3);
6701
6702 for (k = 0; k < dof; k++)
6703 {
6704 Trans.Transform (Nodes.IntPoint (k), xk);
6705 ip.x = vk[0]; ip.y = vk[1]; ip.z = vk[2];
6706 CalcVShape (ip, vshape);
6707 // vk = |J| J^{-t} nk
6708 vk[0] = Jinv(0,0)*nk[k][0]+Jinv(0,1)*nk[k][1]+Jinv(0,2)*nk[k][2];
6709 vk[1] = Jinv(1,0)*nk[k][0]+Jinv(1,1)*nk[k][1]+Jinv(1,2)*nk[k][2];
6710 vk[2] = Jinv(2,0)*nk[k][0]+Jinv(2,1)*nk[k][1]+Jinv(2,2)*nk[k][2];
6711 for (j = 0; j < dof; j++)
6712 if (fabs (I(k,j) = (vshape(j,0)*vk[0]+vshape(j,1)*vk[1]+
6713 vshape(j,2)*vk[2])) < 1.0e-12)
6714 {
6715 I(k,j) = 0.0;
6716 }
6717 }
6718}
6719
6722 Vector &dofs) const
6723{
6724 real_t vk[3];
6725 Vector xk (vk, 3);
6726
6727 for (int k = 0; k < dof; k++)
6728 {
6729 Trans.SetIntPoint (&Nodes.IntPoint (k));
6730 // set Jinv = |J| J^{-t} = adj(J)^t
6731 const DenseMatrix &Jinv = Trans.TransposeAdjugateJacobian();
6732
6733 vc.Eval (xk, Trans, Nodes.IntPoint (k));
6734 // xk^t |J| J^{-t} nk
6735 dofs(k) =
6736 vk[0] * ( Jinv(0,0)*nk[k][0]+Jinv(0,1)*nk[k][1]+Jinv(0,2)*nk[k][2] ) +
6737 vk[1] * ( Jinv(1,0)*nk[k][0]+Jinv(1,1)*nk[k][1]+Jinv(1,2)*nk[k][2] ) +
6738 vk[2] * ( Jinv(2,0)*nk[k][0]+Jinv(2,1)*nk[k][1]+Jinv(2,2)*nk[k][2] );
6739 if (!rt0 && k > 0) { dofs[k] *= 2.0; }
6740 }
6741}
6742
6744 ElementTransformation &Trans,
6745 DenseMatrix &curl) const
6746{
6747 DenseMatrix curl_shape(fe.GetDof(), dim);
6748 Vector curl_k(fe.GetDof());
6749
6750 curl.SetSize(dof, fe.GetDof());
6751 for (int k = 0; k < dof; k++)
6752 {
6753 fe.CalcCurlShape(Nodes.IntPoint(k), curl_shape);
6754 curl_shape.Mult(nk[k], curl_k);
6755 if (!rt0 && k > 0) { curl_k *= 2.0; }
6756 for (int j = 0; j < curl_k.Size(); j++)
6757 {
6758 curl(k,j) = (fabs(curl_k(j)) < 1e-12) ? 0.0 : curl_k(j);
6759 }
6760 }
6761}
6762
6764 : NodalFiniteElement(3, Geometry::CUBE, 6, 2, FunctionSpace::Qk)
6765{
6766 Nodes.IntPoint(0).x = 0.5;
6767 Nodes.IntPoint(0).y = 0.5;
6768 Nodes.IntPoint(0).z = 0.0;
6769
6770 Nodes.IntPoint(1).x = 0.5;
6771 Nodes.IntPoint(1).y = 0.0;
6772 Nodes.IntPoint(1).z = 0.5;
6773
6774 Nodes.IntPoint(2).x = 1.0;
6775 Nodes.IntPoint(2).y = 0.5;
6776 Nodes.IntPoint(2).z = 0.5;
6777
6778 Nodes.IntPoint(3).x = 0.5;
6779 Nodes.IntPoint(3).y = 1.0;
6780 Nodes.IntPoint(3).z = 0.5;
6781
6782 Nodes.IntPoint(4).x = 0.0;
6783 Nodes.IntPoint(4).y = 0.5;
6784 Nodes.IntPoint(4).z = 0.5;
6785
6786 Nodes.IntPoint(5).x = 0.5;
6787 Nodes.IntPoint(5).y = 0.5;
6788 Nodes.IntPoint(5).z = 1.0;
6789}
6790
6792 Vector &shape) const
6793{
6794 real_t x = 2. * ip.x - 1.;
6795 real_t y = 2. * ip.y - 1.;
6796 real_t z = 2. * ip.z - 1.;
6797 real_t f5 = x * x - y * y;
6798 real_t f6 = y * y - z * z;
6799
6800 shape(0) = (1./6.) * (1. - 3. * z - f5 - 2. * f6);
6801 shape(1) = (1./6.) * (1. - 3. * y - f5 + f6);
6802 shape(2) = (1./6.) * (1. + 3. * x + 2. * f5 + f6);
6803 shape(3) = (1./6.) * (1. + 3. * y - f5 + f6);
6804 shape(4) = (1./6.) * (1. - 3. * x + 2. * f5 + f6);
6805 shape(5) = (1./6.) * (1. + 3. * z - f5 - 2. * f6);
6806}
6807
6809 DenseMatrix &dshape) const
6810{
6811 const real_t a = 2./3.;
6812
6813 real_t xt = a * (1. - 2. * ip.x);
6814 real_t yt = a * (1. - 2. * ip.y);
6815 real_t zt = a * (1. - 2. * ip.z);
6816
6817 dshape(0,0) = xt;
6818 dshape(0,1) = yt;
6819 dshape(0,2) = -1. - 2. * zt;
6820
6821 dshape(1,0) = xt;
6822 dshape(1,1) = -1. - 2. * yt;
6823 dshape(1,2) = zt;
6824
6825 dshape(2,0) = 1. - 2. * xt;
6826 dshape(2,1) = yt;
6827 dshape(2,2) = zt;
6828
6829 dshape(3,0) = xt;
6830 dshape(3,1) = 1. - 2. * yt;
6831 dshape(3,2) = zt;
6832
6833 dshape(4,0) = -1. - 2. * xt;
6834 dshape(4,1) = yt;
6835 dshape(4,2) = zt;
6836
6837 dshape(5,0) = xt;
6838 dshape(5,1) = yt;
6839 dshape(5,2) = 1. - 2. * zt;
6840}
6841
6842}
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
Definition array.hpp:869
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
BiCubic2DFiniteElement()
Construct the BiCubic2DFiniteElement.
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
void CalcHessian(const IntegrationPoint &ip, DenseMatrix &h) const override
Compute the Hessian of second order partial derivatives at ip.
void CalcHessian(const IntegrationPoint &ip, DenseMatrix &h) const override
Evaluate the Hessians of all shape functions of a scalar finite element in reference space at the giv...
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
BiLinear2DFiniteElement()
Construct the BiLinear2DFiniteElement.
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
BiQuad2DFiniteElement()
Construct the BiQuad2DFiniteElement.
void ProjectDelta(int vertex, Vector &dofs) const override
Project a delta function centered on the given vertex in the local finite dimensional space represent...
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
CrouzeixRaviartFiniteElement()
Construct the CrouzeixRaviartFiniteElement.
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
CrouzeixRaviartQuadFiniteElement()
Construct the CrouzeixRaviartQuadFiniteElement.
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Cubic1DFiniteElement()
Construct the Cubic1DFiniteElement.
Cubic2DFiniteElement()
Construct the Cubic2DFiniteElement.
void CalcHessian(const IntegrationPoint &ip, DenseMatrix &h) const override
Evaluate the Hessians of all shape functions of a scalar finite element in reference space at the giv...
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Cubic3DFiniteElement()
Construct the Cubic3DFiniteElement.
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Data type dense matrix using column-major storage.
Definition densemat.hpp:24
void Mult(const real_t *x, real_t *y) const
Matrix vector multiplication.
Definition densemat.cpp:108
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
Definition densemat.hpp:125
void Invert()
Replaces the current matrix with its inverse.
Definition densemat.cpp:674
const DenseMatrix & TransposeAdjugateJacobian()
Return the transpose of the adjugate of the Jacobian matrix of the transformation at the currently se...
Definition eltrans.hpp:153
const DenseMatrix & Jacobian()
Return the Jacobian matrix of the transformation at the currently set IntegrationPoint,...
Definition eltrans.hpp:132
void SetIntPoint(const IntegrationPoint *ip)
Set the integration point ip that weights and Jacobians will be evaluated at.
Definition eltrans.hpp:106
virtual void Transform(const IntegrationPoint &, Vector &)=0
Transform integration point from reference coordinates to physical coordinates and store them in the ...
Abstract class for all finite elements.
Definition fe_base.hpp:294
int dof
Number of degrees of freedom.
Definition fe_base.hpp:303
int GetOrder() const
Returns the order of the finite element. In the case of anisotropic orders, returns the maximum order...
Definition fe_base.hpp:414
virtual void CalcCurlShape(const IntegrationPoint &ip, DenseMatrix &curl_shape) const
Evaluate the curl of all shape functions of a vector finite element in reference space at the given p...
Definition fe_base.cpp:75
IntegrationRule Nodes
Definition fe_base.hpp:306
const IntegrationRule & GetNodes() const
Get a const reference to the nodes of the element.
Definition fe_base.hpp:476
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const =0
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
DenseMatrix vshape
Definition fe_base.hpp:308
int GetDof() const
Returns the number of degrees of freedom in the finite element.
Definition fe_base.hpp:410
int dim
Dimension of reference space.
Definition fe_base.hpp:296
Describes the function space on each element.
Definition fe_base.hpp:276
void ProjectDelta(int vertex, Vector &dofs) const override
Project a delta function centered on the given vertex in the local finite dimensional space represent...
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
GaussBiLinear2DFiniteElement()
Construct the FiniteElement.
GaussBiQuad2DFiniteElement()
Construct the GaussBiQuad2DFiniteElement.
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
void ProjectDelta(int vertex, Vector &dofs) const override
Project a delta function centered on the given vertex in the local finite dimensional space represent...
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
GaussLinear2DFiniteElement()
Construct the GaussLinear2DFiniteElement.
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
GaussQuad2DFiniteElement()
Construct the GaussQuad2DFiniteElement.
Class for integration point with weight.
Definition intrules.hpp:35
void Set3(const real_t x1, const real_t x2, const real_t x3)
Definition intrules.hpp:57
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
Definition intrules.hpp:258
A 1D element with uniform nodes.
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Lagrange1DFiniteElement(int degree)
Construct the Lagrange1DFiniteElement with the provided degree.
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
LagrangeHexFiniteElement(int degree)
Construct the LagrangeHexFiniteElement with the provided degree.
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Linear1DFiniteElement()
Construct the Linear1DFiniteElement.
void CalcHessian(const IntegrationPoint &ip, DenseMatrix &h) const override
Evaluate the Hessians of all shape functions of a scalar finite element in reference space at the giv...
Linear2DFiniteElement()
Construct the Linear2DFiniteElement.
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
void CalcHessian(const IntegrationPoint &ip, DenseMatrix &h) const override
Evaluate the Hessians of all shape functions of a scalar finite element in reference space at the giv...
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
virtual function which evaluates the values of all partial derivatives of all shape functions at a gi...
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
virtual function which evaluates the values of all shape functions at a given point ip and stores the...
void GetFaceDofs(int face, int **dofs, int *ndofs) const override
Get the dofs associated with the given face. *dofs is set to an internal array of the local dofc on t...
Linear3DFiniteElement()
Construct the Linear3DFiniteElement.
void CalcHessian(const IntegrationPoint &ip, DenseMatrix &h) const override
Evaluate the Hessians of all shape functions of a scalar finite element in reference space at the giv...
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
virtual function which evaluates the values of all partial derivatives of all shape functions at a gi...
LinearPyramidFiniteElement()
Construct the LinearPyramidFiniteElement.
void GetFaceDofs(int face, int **dofs, int *ndofs) const override
Get the dofs associated with the given face. *dofs is set to an internal array of the local dofc on t...
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
virtual function which evaluates the values of all shape functions at a given point ip and stores the...
void GetFaceDofs(int face, int **dofs, int *ndofs) const override
Get the dofs associated with the given face. *dofs is set to an internal array of the local dofc on t...
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
virtual function which evaluates the values of all partial derivatives of all shape functions at a gi...
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
virtual function which evaluates the values of all shape functions at a given point ip and stores the...
LinearWedgeFiniteElement()
Construct the LinearWedgeFiniteElement.
void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const override
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const override
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
Nedelec1HexFiniteElement()
Construct the Nedelec1HexFiniteElement.
void Project(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const override
Given a vector coefficient and a transformation, compute its projection (approximation) in the local ...
void CalcCurlShape(const IntegrationPoint &ip, DenseMatrix &curl_shape) const override
Evaluate the curl of all shape functions of a vector finite element in reference space at the given p...
void ProjectGrad(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &grad) const override
Compute the discrete gradient matrix from the given FiniteElement onto 'this' FiniteElement....
Nedelec1PyrFiniteElement()
Construct the Nedelec1PyrFiniteElement.
void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const override
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
void CalcCurlShape(const IntegrationPoint &ip, DenseMatrix &curl_shape) const override
Evaluate the curl of all shape functions of a vector finite element in reference space at the given p...
void ProjectGrad(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &grad) const override
Compute the discrete gradient matrix from the given FiniteElement onto 'this' FiniteElement....
void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const override
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
void Project(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const override
Given a vector coefficient and a transformation, compute its projection (approximation) in the local ...
Nedelec1TetFiniteElement()
Construct the Nedelec1TetFiniteElement.
void Project(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const override
Given a vector coefficient and a transformation, compute its projection (approximation) in the local ...
void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const override
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
void CalcCurlShape(const IntegrationPoint &ip, DenseMatrix &curl_shape) const override
Evaluate the curl of all shape functions of a vector finite element in reference space at the given p...
void ProjectGrad(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &grad) const override
Compute the discrete gradient matrix from the given FiniteElement onto 'this' FiniteElement....
void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const override
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
void ProjectGrad(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &grad) const override
Compute the discrete gradient matrix from the given FiniteElement onto 'this' FiniteElement....
void Project(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const override
Given a vector coefficient and a transformation, compute its projection (approximation) in the local ...
void CalcCurlShape(const IntegrationPoint &ip, DenseMatrix &curl_shape) const override
Evaluate the curl of all shape functions of a vector finite element in reference space at the given p...
Nedelec1WdgFiniteElement()
Construct the Nedelec1WdgFiniteElement.
void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const override
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const override
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
virtual void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
Nedelec2PyrFiniteElement()
Construct the Nedelec2PyrFiniteElement.
virtual void Project(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const
Given a vector coefficient and a transformation, compute its projection (approximation) in the local ...
virtual void ProjectGrad(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &grad) const
Compute the discrete gradient matrix from the given FiniteElement onto 'this' FiniteElement....
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
virtual void CalcCurlShape(const IntegrationPoint &ip, DenseMatrix &curl_shape) const
Evaluate the curl of all shape functions of a vector finite element in reference space at the given p...
Class for standard nodal finite elements.
Definition fe_base.hpp:798
Array< int > lex_ordering
Definition fe_base.hpp:803
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
Definition operator.hpp:68
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
P0HexFiniteElement()
Construct the P0HexFiniteElement.
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
P0PyrFiniteElement()
Construct the P0PyrFiniteElement.
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
P0QuadFiniteElement()
Construct the P0QuadFiniteElement.
P0SegmentFiniteElement(int Ord=0)
Construct the P0SegmentFiniteElement with dummy order Ord.
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
P0TetFiniteElement()
Construct the P0TetFiniteElement.
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
evaluate derivatives of shape function - constant 0
P0TriangleFiniteElement()
Construct the P0TriangleFiniteElement.
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
evaluate shape function - constant 1
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
P0WdgFiniteElement()
Construct the P0WdgFiniteElement.
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
P1OnQuadFiniteElement()
Construct the P1OnQuadFiniteElement.
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
P1SegmentFiniteElement()
Construct the P1SegmentFiniteElement.
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
P1TetNonConfFiniteElement()
Construct the P1TetNonConfFiniteElement.
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
P2SegmentFiniteElement()
Construct the P2SegmentFiniteElement.
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
PointFiniteElement()
Construct the PointFiniteElement.
const real_t * OpenPoints(const int p, const int btype=BasisType::GaussLegendre, bool on_device=false)
Get coordinates of an open (GaussLegendre) set of points if degree p.
Definition fe_base.hpp:1193
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Quad1DFiniteElement()
Construct the Quad1DFiniteElement.
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Quad2DFiniteElement()
Construct the Quad2DFiniteElement.
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
void ProjectDelta(int vertex, Vector &dofs) const override
Project a delta function centered on the given vertex in the local finite dimensional space represent...
void CalcHessian(const IntegrationPoint &ip, DenseMatrix &h) const override
Evaluate the Hessians of all shape functions of a scalar finite element in reference space at the giv...
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Quadratic3DFiniteElement()
Construct the Quadratic3DFiniteElement.
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
RT0HexFiniteElement()
Construct the RT0HexFiniteElement.
void CalcDivShape(const IntegrationPoint &ip, Vector &divshape) const override
Evaluate the divergence of all shape functions of a vector finite element in reference space at the g...
void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const override
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
void Project(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const override
Given a vector coefficient and a transformation, compute its projection (approximation) in the local ...
void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const override
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
void ProjectCurl(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &curl) const override
Compute the discrete curl matrix from the given FiniteElement onto 'this' FiniteElement....
void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const override
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
void Project(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const override
Given a vector coefficient and a transformation, compute its projection (approximation) in the local ...
void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const override
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
void CalcDivShape(const IntegrationPoint &ip, Vector &divshape) const override
Evaluate the divergence of all shape functions of a vector finite element in reference space at the g...
RT0PyrFiniteElement(bool rt0tets=true)
Construct the RT0PyrFiniteElement.
RT0QuadFiniteElement()
Construct the RT0QuadFiniteElement.
void Project(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const override
Given a vector coefficient and a transformation, compute its projection (approximation) in the local ...
void CalcDivShape(const IntegrationPoint &ip, Vector &divshape) const override
Evaluate the divergence of all shape functions of a vector finite element in reference space at the g...
void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const override
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const override
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const override
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const override
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
RT0TetFiniteElement()
Construct the RT0TetFiniteElement.
void CalcDivShape(const IntegrationPoint &ip, Vector &divshape) const override
Evaluate the divergence of all shape functions of a vector finite element in reference space at the g...
void Project(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const override
Given a vector coefficient and a transformation, compute its projection (approximation) in the local ...
void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const override
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
void CalcDivShape(const IntegrationPoint &ip, Vector &divshape) const override
Evaluate the divergence of all shape functions of a vector finite element in reference space at the g...
RT0TriangleFiniteElement()
Construct the RT0TriangleFiniteElement.
void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const override
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
void Project(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const override
Given a vector coefficient and a transformation, compute its projection (approximation) in the local ...
void ProjectCurl(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &curl) const override
Compute the discrete curl matrix from the given FiniteElement onto 'this' FiniteElement....
void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const override
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
void CalcDivShape(const IntegrationPoint &ip, Vector &divshape) const override
Evaluate the divergence of all shape functions of a vector finite element in reference space at the g...
RT0WdgFiniteElement()
Construct the RT0WdgFiniteElement.
void Project(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const override
Given a vector coefficient and a transformation, compute its projection (approximation) in the local ...
void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const override
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const override
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
RT1HexFiniteElement()
Construct the RT1HexFiniteElement.
void CalcDivShape(const IntegrationPoint &ip, Vector &divshape) const override
Evaluate the divergence of all shape functions of a vector finite element in reference space at the g...
void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const override
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
void Project(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const override
Given a vector coefficient and a transformation, compute its projection (approximation) in the local ...
RT1QuadFiniteElement()
Construct the RT1QuadFiniteElement.
void CalcDivShape(const IntegrationPoint &ip, Vector &divshape) const override
Evaluate the divergence of all shape functions of a vector finite element in reference space at the g...
void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const override
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
void Project(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const override
Given a vector coefficient and a transformation, compute its projection (approximation) in the local ...
void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const override
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
void Project(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const override
Given a vector coefficient and a transformation, compute its projection (approximation) in the local ...
RT1TriangleFiniteElement()
Construct the RT1TriangleFiniteElement.
void CalcDivShape(const IntegrationPoint &ip, Vector &divshape) const override
Evaluate the divergence of all shape functions of a vector finite element in reference space at the g...
void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const override
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const override
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const override
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
RT2QuadFiniteElement()
Construct the RT2QuadFiniteElement.
void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const override
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
void Project(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const override
Given a vector coefficient and a transformation, compute its projection (approximation) in the local ...
void CalcDivShape(const IntegrationPoint &ip, Vector &divshape) const override
Evaluate the divergence of all shape functions of a vector finite element in reference space at the g...
void CalcDivShape(const IntegrationPoint &ip, Vector &divshape) const override
Evaluate the divergence of all shape functions of a vector finite element in reference space at the g...
void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const override
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
RT2TriangleFiniteElement()
Construct the RT2TriangleFiniteElement.
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
RefinedBiLinear2DFiniteElement()
Construct the RefinedBiLinear2DFiniteElement.
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
RefinedLinear1DFiniteElement()
Construct the RefinedLinear1DFiniteElement.
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
RefinedLinear2DFiniteElement()
Construct the RefinedLinear2DFiniteElement.
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
RefinedLinear3DFiniteElement()
Construct the RefinedLinear3DFiniteElement.
RefinedTriLinear3DFiniteElement()
Construct the RefinedTriLinear3DFiniteElement.
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
RotTriLinearHexFiniteElement()
Construct the RotTriLinearHexFiniteElement.
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
TriLinear3DFiniteElement()
Construct the TriLinear3DFiniteElement.
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
void CalcHessian(const IntegrationPoint &ip, DenseMatrix &h) const override
Evaluate the Hessians of all shape functions of a scalar finite element in reference space at the giv...
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Base class for vector Coefficients that optionally depend on time and space.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)=0
Evaluate the vector coefficient in the element described by T at the point ip, storing the result in ...
Intermediate class for finite elements whose basis functions return vector values.
Definition fe_base.hpp:890
Vector data type.
Definition vector.hpp:82
int Size() const
Returns the size of the vector.
Definition vector.hpp:234
void SetSize(int s)
Resize the vector to size s.
Definition vector.hpp:633
real_t a
Definition lissajous.cpp:41
mfem::real_t real_t
void mfem_error(const char *msg)
Definition error.cpp:154
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
Definition table.cpp:505
OutStream err(std::cerr)
Global stream used by the library for standard error output. Initially it uses the same std::streambu...
Definition globals.hpp:71
float real_t
Definition config.hpp:46
Poly_1D poly1d
Definition fe.cpp:28
STL namespace.
real_t p(const Vector &x, real_t t)