Reference documentation for deal.II version GIT relicensing-1399-g2b3a69e058 2024-08-09 08:50:02+00:00
Searching...
No Matches
polynomials_nedelec.cc
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
4// Copyright (C) 2013 - 2024 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
19
20#include <iomanip>
21#include <iostream>
22#include <memory>
23
25
26
27template <int dim>
29 : TensorPolynomialsBase<dim>(k, n_polynomials(k))
30 , polynomial_space(create_polynomials(k))
31{}
32
33template <int dim>
34std::vector<std::vector<Polynomials::Polynomial<double>>>
36{
37 std::vector<std::vector<Polynomials::Polynomial<double>>> pols(dim);
38
40
41 for (unsigned int i = 1; i < dim; ++i)
43
44 return pols;
45}
46
47
49// and double gradients of the
50// polynomial at the given point.
51template <int dim>
52void
54 const Point<dim> &unit_point,
55 std::vector<Tensor<1, dim>> &values,
59 std::vector<Tensor<5, dim>> &fourth_derivatives) const
60{
61 Assert(values.size() == this->n() || values.empty(),
62 ExcDimensionMismatch(values.size(), this->n()));
67 Assert(third_derivatives.size() == this->n() || third_derivatives.empty(),
69 Assert(fourth_derivatives.size() == this->n() || fourth_derivatives.empty(),
71
72 // third and fourth derivatives not implemented
77
78 // Declare the values, derivatives
79 // and second derivatives vectors of
80 // <tt>polynomial_space</tt> at
81 // <tt>unit_point</tt>
82 const unsigned int n_basis = polynomial_space.n();
83 const unsigned int my_degree = this->degree();
84 std::vector<double> unit_point_values((values.empty()) ? 0 : n_basis);
88 std::vector<Tensor<3, dim>> empty_vector_of_3rd_order_tensors;
89 std::vector<Tensor<4, dim>> empty_vector_of_4th_order_tensors;
90
91 switch (dim)
92 {
93 case 1:
94 {
95 polynomial_space.evaluate(unit_point,
101
102 // Assign the correct values to the
103 // corresponding shape functions.
104 if (values.size() > 0)
105 for (unsigned int i = 0; i < unit_point_values.size(); ++i)
106 values[i][0] = unit_point_values[i];
107
109 for (unsigned int i = 0; i < unit_point_grads.size(); ++i)
111
115
116 break;
117 }
118
119 case 2:
120 {
121 polynomial_space.evaluate(unit_point,
127
128 // Declare the values, derivatives and
129 // second derivatives vectors of
130 // <tt>polynomial_space</tt> at
131 // <tt>unit_point</tt> with coordinates
132 // shifted one step in positive direction
133 Point<dim> p;
134
135 p[0] = unit_point[1];
136 p[1] = unit_point[0];
137
138 std::vector<double> p_values((values.empty()) ? 0 : n_basis);
142
143 polynomial_space.evaluate(p,
144 p_values,
149
150 // Assign the correct values to the
151 // corresponding shape functions.
152 if (values.size() > 0)
153 {
154 for (unsigned int i = 0; i <= my_degree; ++i)
155 for (unsigned int j = 0; j < 2; ++j)
156 {
157 values[i + j * (my_degree + 1)][0] = 0.0;
158 values[i + j * (my_degree + 1)][1] =
159 p_values[i + j * (my_degree + 1)];
160 values[i + (j + 2) * (my_degree + 1)][0] =
161 unit_point_values[i + j * (my_degree + 1)];
162 values[i + (j + 2) * (my_degree + 1)][1] = 0.0;
163 }
164
165 if (my_degree > 0)
166 for (unsigned int i = 0; i <= my_degree; ++i)
167 for (unsigned int j = 0; j < my_degree; ++j)
168 {
170 my_degree +
172 unit_point_values[i + (j + 2) * (my_degree + 1)];
174 my_degree +
176 values[i + (j + my_degree +
178 (my_degree + 1)][0] = 0.0;
179 values[i + (j + my_degree +
181 (my_degree + 1)][1] =
182 p_values[i + (j + 2) * (my_degree + 1)];
183 }
184 }
185
187 {
188 for (unsigned int i = 0; i <= my_degree; ++i)
189 for (unsigned int j = 0; j < 2; ++j)
190 {
191 for (unsigned int k = 0; k < dim; ++k)
192 {
193 grads[i + j * (my_degree + 1)][0][k] = 0.0;
194 grads[i + (j + 2) * (my_degree + 1)][0][k] =
195 unit_point_grads[i + j * (my_degree + 1)][k];
196 grads[i + (j + 2) * (my_degree + 1)][1][k] = 0.0;
197 }
198
199 grads[i + j * (my_degree + 1)][1][0] =
200 p_grads[i + j * (my_degree + 1)][1];
201 grads[i + j * (my_degree + 1)][1][1] =
202 p_grads[i + j * (my_degree + 1)][0];
203 }
204
205 if (my_degree > 0)
206 for (unsigned int i = 0; i <= my_degree; ++i)
207 for (unsigned int j = 0; j < my_degree; ++j)
208 {
209 for (unsigned int k = 0; k < dim; ++k)
210 {
212 my_degree +
214 unit_point_grads[i + (j + 2) * (my_degree + 1)][k];
216 my_degree +
218 0.0;
219 grads[i + (j + my_degree +
221 (my_degree + 1)][0][k] = 0.0;
222 }
223
224 grads[i + (j + my_degree +
226 (my_degree + 1)][1][0] =
227 p_grads[i + (j + 2) * (my_degree + 1)][1];
228 grads[i + (j + my_degree +
230 (my_degree + 1)][1][1] =
231 p_grads[i + (j + 2) * (my_degree + 1)][0];
232 }
233 }
234
236 {
237 for (unsigned int i = 0; i <= my_degree; ++i)
238 for (unsigned int j = 0; j < 2; ++j)
239 {
240 for (unsigned int k = 0; k < dim; ++k)
241 for (unsigned int l = 0; l < dim; ++l)
242 {
246 [l];
248 0.0;
249 }
250
259 }
260
261 if (my_degree > 0)
262 for (unsigned int i = 0; i <= my_degree; ++i)
263 for (unsigned int j = 0; j < my_degree; ++j)
264 {
265 for (unsigned int k = 0; k < dim; ++k)
266 for (unsigned int l = 0; l < dim; ++l)
267 {
269 my_degree +
272 [i + (j + 2) * (my_degree + 1)][k][l];
274 my_degree +
276 [k][l] = 0.0;
279 (my_degree + 1)][0][k][l] = 0.0;
280 }
281
284 (my_degree + 1)][1][0][0] =
288 (my_degree + 1)][1][0][1] =
292 (my_degree + 1)][1][1][0] =
296 (my_degree + 1)][1][1][1] =
298 }
299 }
300
301 break;
302 }
303
304 case 3:
305 {
306 polynomial_space.evaluate(unit_point,
312
313 // Declare the values, derivatives
314 // and second derivatives vectors of
315 // <tt>polynomial_space</tt> at
316 // <tt>unit_point</tt> with coordinates
317 // shifted two steps in positive
318 // direction
320 std::vector<double> p1_values((values.empty()) ? 0 : n_basis);
324 std::vector<double> p2_values((values.empty()) ? 0 : n_basis);
328
329 p1[0] = unit_point[1];
330 p1[1] = unit_point[2];
331 p1[2] = unit_point[0];
332 polynomial_space.evaluate(p1,
333 p1_values,
338 p2[0] = unit_point[2];
339 p2[1] = unit_point[0];
340 p2[2] = unit_point[1];
341 polynomial_space.evaluate(p2,
342 p2_values,
347
348 // Assign the correct values to the
349 // corresponding shape functions.
350 if (values.size() > 0)
351 {
352 for (unsigned int i = 0; i <= my_degree; ++i)
353 {
354 for (unsigned int j = 0; j < 2; ++j)
355 {
356 for (unsigned int k = 0; k < 2; ++k)
357 {
358 for (unsigned int l = 0; l < 2; ++l)
359 {
360 values[i + (j + 4 * k) * (my_degree + 1)][2 * l] =
361 0.0;
362 values[i + (j + 4 * k + 2) * (my_degree + 1)]
363 [l + 1] = 0.0;
364 values[i + (j + 2 * (k + 4)) * (my_degree + 1)]
365 [l] = 0.0;
366 }
367
368 values[i + (j + 4 * k + 2) * (my_degree + 1)][0] =
369 unit_point_values[i + (j + k * (my_degree + 2)) *
370 (my_degree + 1)];
371 values[i + (j + 2 * (k + 4)) * (my_degree + 1)][2] =
372 p2_values[i + (j + k * (my_degree + 2)) *
373 (my_degree + 1)];
374 }
375
376 values[i + j * (my_degree + 1)][1] =
377 p1_values[i + j * (my_degree + 1) * (my_degree + 2)];
378 }
379
380 values[i + 4 * (my_degree + 1)][1] =
381 p1_values[i + my_degree + 1];
382 values[i + 5 * (my_degree + 1)][1] =
383 p1_values[i + (my_degree + 1) * (my_degree + 3)];
384 }
385
386 if (my_degree > 0)
387 for (unsigned int i = 0; i <= my_degree; ++i)
388 for (unsigned int j = 0; j < my_degree; ++j)
389 {
390 for (unsigned int k = 0; k < my_degree; ++k)
391 {
392 for (unsigned int l = 0; l < 2; ++l)
393 {
394 values[((i +
396 my_degree +
399 my_degree +
401 [l + 1] = 0.0;
402 values[(i +
403 (j +
405 my_degree) *
406 (my_degree + 1) +
408 my_degree +
410 [2 * l] = 0.0;
411 values[i +
412 (j +
413 (k +
415 my_degree)) *
416 my_degree +
418 (my_degree + 1)][l] = 0.0;
419 }
420
422 my_degree +
425 my_degree +
428 (j + (k + 2) * (my_degree + 2) +
429 2) *
430 (my_degree + 1)];
431 values[(i +
433 my_degree) *
434 (my_degree + 1) +
436 my_degree +
438 p1_values[i + ((j + 2) * (my_degree + 2) + k + 2) *
439 (my_degree + 1)];
440 values[i +
441 (j +
443 my_degree)) *
444 my_degree +
446 (my_degree + 1)][2] =
447 p2_values[i + (j + (k + 2) * (my_degree + 2) + 2) *
448 (my_degree + 1)];
449 }
450
451 for (unsigned int k = 0; k < 2; ++k)
452 {
453 for (unsigned int l = 0; l < 2; ++l)
454 {
455 for (unsigned int m = 0; m < 2; ++m)
456 {
457 values[i +
458 (j +
459 (2 * (k + 2 * l) + 1) * my_degree +
461 (my_degree + 1)][m + l] = 0.0;
462 values[(i +
463 2 * (k + 2 * (l + 1)) *
464 (my_degree + 1) +
466 my_degree +
468 [m + l] = 0.0;
469 }
470
471 values[(i + 2 * k * (my_degree + 1) +
473 my_degree +
475 [2 * l] = 0.0;
476 values[i + (j + (2 * k + 9) * my_degree +
478 (my_degree + 1)][2 * l] = 0.0;
479 }
480
481 values[(i + 2 * k * (my_degree + 1) +
483 my_degree +
485 p1_values[i + (j + k * (my_degree + 2) + 2) *
486 (my_degree + 1)];
487 values[i + (j + (2 * k + 1) * my_degree +
489 (my_degree + 1)][2] =
490 p2_values[i + ((j + 2) * (my_degree + 2) + k) *
491 (my_degree + 1)];
492 values[(i + 2 * (k + 2) * (my_degree + 1) +
494 my_degree +
496 p2_values[i + (j + k * (my_degree + 2) + 2) *
497 (my_degree + 1)];
498 values[i + (j + (2 * k + 5) * my_degree +
500 (my_degree + 1)][0] =
502 ((j + 2) * (my_degree + 2) + k) *
503 (my_degree + 1)];
504 values[(i + 2 * (k + 4) * (my_degree + 1) +
506 my_degree +
509 (j + k * (my_degree + 2) + 2) *
510 (my_degree + 1)];
511 values[i + (j + (2 * k + 9) * my_degree +
513 (my_degree + 1)][1] =
514 p1_values[i + ((j + 2) * (my_degree + 2) + k) *
515 (my_degree + 1)];
516 }
517 }
518 }
519
521 {
522 for (unsigned int i = 0; i <= my_degree; ++i)
523 {
524 for (unsigned int j = 0; j < 2; ++j)
525 {
526 for (unsigned int k = 0; k < 2; ++k)
527 {
528 for (unsigned int l = 0; l < 2; ++l)
529 for (unsigned int m = 0; m < dim; ++m)
530 {
531 grads[i + (j + 4 * k) * (my_degree + 1)][2 * l]
532 [m] = 0.0;
533 grads[i + (j + 4 * k + 2) * (my_degree + 1)]
534 [l + 1][m] = 0.0;
535 grads[i + (j + 2 * (k + 4)) * (my_degree + 1)]
536 [l][m] = 0.0;
537 }
538
539 for (unsigned int l = 0; l < dim; ++l)
540 grads[i + (j + 4 * k + 2) * (my_degree + 1)][0][l] =
541 unit_point_grads[i + (j + k * (my_degree + 2)) *
542 (my_degree + 1)][l];
543
544 grads[i + (j + 2 * (k + 4)) * (my_degree + 1)][2][0] =
545 p2_grads[i + (j + k * (my_degree + 2)) *
546 (my_degree + 1)][1];
547 grads[i + (j + 2 * (k + 4)) * (my_degree + 1)][2][1] =
548 p2_grads[i + (j + k * (my_degree + 2)) *
549 (my_degree + 1)][2];
550 grads[i + (j + 2 * (k + 4)) * (my_degree + 1)][2][2] =
551 p2_grads[i + (j + k * (my_degree + 2)) *
552 (my_degree + 1)][0];
553 }
554
555 grads[i + j * (my_degree + 1)][1][0] =
556 p1_grads[i + j * (my_degree + 1) * (my_degree + 2)][2];
557 grads[i + j * (my_degree + 1)][1][1] =
558 p1_grads[i + j * (my_degree + 1) * (my_degree + 2)][0];
559 grads[i + j * (my_degree + 1)][1][2] =
560 p1_grads[i + j * (my_degree + 1) * (my_degree + 2)][1];
561 }
562
563 grads[i + 4 * (my_degree + 1)][1][0] =
564 p1_grads[i + my_degree + 1][2];
565 grads[i + 4 * (my_degree + 1)][1][1] =
566 p1_grads[i + my_degree + 1][0];
567 grads[i + 4 * (my_degree + 1)][1][2] =
568 p1_grads[i + my_degree + 1][1];
569 grads[i + 5 * (my_degree + 1)][1][0] =
570 p1_grads[i + (my_degree + 1) * (my_degree + 3)][2];
571 grads[i + 5 * (my_degree + 1)][1][1] =
572 p1_grads[i + (my_degree + 1) * (my_degree + 3)][0];
573 grads[i + 5 * (my_degree + 1)][1][2] =
574 p1_grads[i + (my_degree + 1) * (my_degree + 3)][1];
575 }
576
577 if (my_degree > 0)
578 for (unsigned int i = 0; i <= my_degree; ++i)
579 for (unsigned int j = 0; j < my_degree; ++j)
580 {
581 for (unsigned int k = 0; k < my_degree; ++k)
582 {
583 for (unsigned int l = 0; l < dim; ++l)
584 {
585 for (unsigned int m = 0; m < 2; ++m)
586 {
588 [((i +
590 my_degree +
593 my_degree +
595 [m + 1][l] = 0.0;
597 (j +
598 2 *
600 my_degree) *
601 (my_degree + 1) +
603 my_degree +
605 [2 * m][l] = 0.0;
607 (j +
608 (k +
609 2 *
611 my_degree)) *
612 my_degree +
614 (my_degree + 1)][m][l] = 0.0;
615 }
616
619 my_degree +
622 my_degree +
625 [i + (j + (k + 2) * (my_degree + 2) + 2) *
626 (my_degree + 1)][l];
627 }
628
631 my_degree) *
632 (my_degree + 1) +
634 my_degree +
636 p1_grads[i + ((j + 2) * (my_degree + 2) + k + 2) *
637 (my_degree + 1)][2];
640 my_degree) *
641 (my_degree + 1) +
643 my_degree +
645 p1_grads[i + ((j + 2) * (my_degree + 2) + k + 2) *
646 (my_degree + 1)][0];
649 my_degree) *
650 (my_degree + 1) +
652 my_degree +
654 p1_grads[i + ((j + 2) * (my_degree + 2) + k + 2) *
655 (my_degree + 1)][1];
657 (j +
659 my_degree)) *
660 my_degree +
662 (my_degree + 1)][2][0] =
663 p2_grads[i + (j + (k + 2) * (my_degree + 2) + 2) *
664 (my_degree + 1)][1];
666 (j +
668 my_degree)) *
669 my_degree +
671 (my_degree + 1)][2][1] =
672 p2_grads[i + (j + (k + 2) * (my_degree + 2) + 2) *
673 (my_degree + 1)][2];
675 (j +
677 my_degree)) *
678 my_degree +
680 (my_degree + 1)][2][2] =
681 p2_grads[i + (j + (k + 2) * (my_degree + 2) + 2) *
682 (my_degree + 1)][0];
683 }
684
685 for (unsigned int k = 0; k < 2; ++k)
686 {
687 for (unsigned int l = 0; l < 2; ++l)
688 for (unsigned int m = 0; m < dim; ++m)
689 {
690 for (unsigned int n = 0; n < 2; ++n)
691 {
693 (j +
694 (2 * (k + 2 * l) + 1) * my_degree +
696 (my_degree + 1)][n + l][m] = 0.0;
698 2 * (k + 2 * (l + 1)) *
699 (my_degree + 1) +
701 my_degree +
703 [n + l][m] = 0.0;
704 }
705
706 grads[(i + 2 * k * (my_degree + 1) +
708 my_degree +
710 [2 * l][m] = 0.0;
711 grads[i + (j + (2 * k + 9) * my_degree +
713 (my_degree + 1)][2 * l][m] = 0.0;
714 }
715
716 for (unsigned int l = 0; l < dim; ++l)
717 {
718 grads[i + (j + (2 * k + 5) * my_degree +
720 (my_degree + 1)][0][l] =
722 ((j + 2) * (my_degree + 2) +
723 k) *
724 (my_degree + 1)][l];
725 grads[(i + 2 * (k + 4) * (my_degree + 1) +
727 my_degree +
728 j +
731 (j + k * (my_degree + 2) + 2) *
732 (my_degree + 1)][l];
733 }
734
735 grads[(i + 2 * k * (my_degree + 1) +
737 my_degree +
739 p1_grads[i + (j + k * (my_degree + 2) + 2) *
740 (my_degree + 1)][2];
741 grads[(i + 2 * k * (my_degree + 1) +
743 my_degree +
745 p1_grads[i + (j + k * (my_degree + 2) + 2) *
746 (my_degree + 1)][0];
747 grads[(i + 2 * k * (my_degree + 1) +
749 my_degree +
751 p1_grads[i + (j + k * (my_degree + 2) + 2) *
752 (my_degree + 1)][1];
753 grads[i + (j + (2 * k + 1) * my_degree +
755 (my_degree + 1)][2][0] =
756 p2_grads[i + ((j + 2) * (my_degree + 2) + k) *
757 (my_degree + 1)][1];
758 grads[i + (j + (2 * k + 1) * my_degree +
760 (my_degree + 1)][2][1] =
761 p2_grads[i + ((j + 2) * (my_degree + 2) + k) *
762 (my_degree + 1)][2];
763 grads[i + (j + (2 * k + 1) * my_degree +
765 (my_degree + 1)][2][2] =
766 p2_grads[i + ((j + 2) * (my_degree + 2) + k) *
767 (my_degree + 1)][0];
768 grads[(i + 2 * (k + 2) * (my_degree + 1) +
770 my_degree +
772 p2_grads[i + (j + k * (my_degree + 2) + 2) *
773 (my_degree + 1)][1];
774 grads[(i + 2 * (k + 2) * (my_degree + 1) +
776 my_degree +
778 p2_grads[i + (j + k * (my_degree + 2) + 2) *
779 (my_degree + 1)][2];
780 grads[(i + 2 * (k + 2) * (my_degree + 1) +
782 my_degree +
784 p2_grads[i + (j + k * (my_degree + 2) + 2) *
785 (my_degree + 1)][0];
786 grads[i + (j + (2 * k + 9) * my_degree +
788 (my_degree + 1)][1][0] =
789 p1_grads[i + ((j + 2) * (my_degree + 2) + k) *
790 (my_degree + 1)][2];
791 grads[i + (j + (2 * k + 9) * my_degree +
793 (my_degree + 1)][1][1] =
794 p1_grads[i + ((j + 2) * (my_degree + 2) + k) *
795 (my_degree + 1)][0];
796 grads[i + (j + (2 * k + 9) * my_degree +
798 (my_degree + 1)][1][2] =
799 p1_grads[i + ((j + 2) * (my_degree + 2) + k) *
800 (my_degree + 1)][1];
801 }
802 }
803 }
804
806 {
807 for (unsigned int i = 0; i <= my_degree; ++i)
808 {
809 for (unsigned int j = 0; j < 2; ++j)
810 {
811 for (unsigned int k = 0; k < 2; ++k)
812 {
813 for (unsigned int l = 0; l < dim; ++l)
814 for (unsigned int m = 0; m < dim; ++m)
815 {
816 for (unsigned int n = 0; n < 2; ++n)
817 {
819 (j + 4 * k) * (my_degree + 1)]
820 [2 * n][l][m] = 0.0;
822 (my_degree + 1)][n + 1][l]
823 [m] = 0.0;
825 (my_degree + 1)][n][l][m] =
826 0.0;
827 }
828
830 (my_degree + 1)][0][l][m] =
832 [i + (j + k * (my_degree + 2)) *
833 (my_degree + 1)][l][m];
834 }
835
837 (my_degree + 1)][2][0][0] =
839 (my_degree + 1)][1][1];
841 (my_degree + 1)][2][0][1] =
843 (my_degree + 1)][1][2];
845 (my_degree + 1)][2][0][2] =
847 (my_degree + 1)][1][0];
849 (my_degree + 1)][2][1][0] =
851 (my_degree + 1)][2][1];
853 (my_degree + 1)][2][1][1] =
855 (my_degree + 1)][2][2];
857 (my_degree + 1)][2][1][2] =
859 (my_degree + 1)][2][0];
861 (my_degree + 1)][2][2][0] =
863 (my_degree + 1)][0][1];
865 (my_degree + 1)][2][2][1] =
867 (my_degree + 1)][0][2];
869 (my_degree + 1)][2][2][2] =
871 (my_degree + 1)][0][0];
872 }
873
875 p1_grad_grads[i + j * (my_degree + 1) * (my_degree + 2)]
876 [2][2];
878 p1_grad_grads[i + j * (my_degree + 1) * (my_degree + 2)]
879 [2][0];
881 p1_grad_grads[i + j * (my_degree + 1) * (my_degree + 2)]
882 [2][1];
884 p1_grad_grads[i + j * (my_degree + 1) * (my_degree + 2)]
885 [0][2];
887 p1_grad_grads[i + j * (my_degree + 1) * (my_degree + 2)]
888 [0][0];
890 p1_grad_grads[i + j * (my_degree + 1) * (my_degree + 2)]
891 [0][1];
893 p1_grad_grads[i + j * (my_degree + 1) * (my_degree + 2)]
894 [1][2];
896 p1_grad_grads[i + j * (my_degree + 1) * (my_degree + 2)]
897 [1][0];
899 p1_grad_grads[i + j * (my_degree + 1) * (my_degree + 2)]
900 [1][1];
901 }
902
939 }
940
941 if (my_degree > 0)
942 for (unsigned int i = 0; i <= my_degree; ++i)
943 for (unsigned int j = 0; j < my_degree; ++j)
944 {
945 for (unsigned int k = 0; k < my_degree; ++k)
946 {
947 for (unsigned int l = 0; l < dim; ++l)
948 for (unsigned int m = 0; m < dim; ++m)
949 {
950 for (unsigned int n = 0; n < 2; ++n)
951 {
953 [((i +
954 2 *
956 my_degree +
959 my_degree +
961 [n + 1][l][m] = 0.0;
963 [(i +
964 (j +
966 my_degree) *
967 (my_degree + 1) +
969 my_degree +
971 [2 * n][l][m] = 0.0;
973 [i + (j +
974 (k + 2 * (GeometryInfo<
975 dim>::faces_per_cell +
976 my_degree)) *
977 my_degree +
979 (my_degree + 1)][n][l][m] = 0.0;
980 }
981
983 [((i +
985 my_degree +
988 my_degree +
991 [i + (j + (k + 2) * (my_degree + 2) + 2) *
992 (my_degree + 1)][l][m];
993 }
994
996 [(i +
998 my_degree) *
999 (my_degree + 1) +
1001 my_degree +
1003 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k +
1004 2) *
1005 (my_degree + 1)][2][2];
1007 [(i +
1009 my_degree) *
1010 (my_degree + 1) +
1012 my_degree +
1014 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k +
1015 2) *
1016 (my_degree + 1)][2][0];
1018 [(i +
1020 my_degree) *
1021 (my_degree + 1) +
1023 my_degree +
1025 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k +
1026 2) *
1027 (my_degree + 1)][2][1];
1029 [(i +
1031 my_degree) *
1032 (my_degree + 1) +
1034 my_degree +
1036 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k +
1037 2) *
1038 (my_degree + 1)][0][2];
1040 [(i +
1042 my_degree) *
1043 (my_degree + 1) +
1045 my_degree +
1047 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k +
1048 2) *
1049 (my_degree + 1)][0][0];
1051 [(i +
1053 my_degree) *
1054 (my_degree + 1) +
1056 my_degree +
1058 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k +
1059 2) *
1060 (my_degree + 1)][0][1];
1062 [(i +
1064 my_degree) *
1065 (my_degree + 1) +
1067 my_degree +
1069 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k +
1070 2) *
1071 (my_degree + 1)][1][2];
1073 [(i +
1075 my_degree) *
1076 (my_degree + 1) +
1078 my_degree +
1080 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k +
1081 2) *
1082 (my_degree + 1)][1][0];
1084 [(i +
1086 my_degree) *
1087 (my_degree + 1) +
1089 my_degree +
1091 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k +
1092 2) *
1093 (my_degree + 1)][1][1];
1095 (j +
1096 (k +
1098 my_degree)) *
1099 my_degree +
1101 (my_degree + 1)][2][0][0] =
1103 (j + (k + 2) * (my_degree + 2) + 2) *
1104 (my_degree + 1)][1][1];
1106 (j +
1107 (k +
1109 my_degree)) *
1110 my_degree +
1112 (my_degree + 1)][2][0][1] =
1114 (j + (k + 2) * (my_degree + 2) + 2) *
1115 (my_degree + 1)][1][2];
1117 (j +
1118 (k +
1120 my_degree)) *
1121 my_degree +
1123 (my_degree + 1)][2][0][2] =
1125 (j + (k + 2) * (my_degree + 2) + 2) *
1126 (my_degree + 1)][1][0];
1128 (j +
1129 (k +
1131 my_degree)) *
1132 my_degree +
1134 (my_degree + 1)][2][1][0] =
1136 (j + (k + 2) * (my_degree + 2) + 2) *
1137 (my_degree + 1)][2][1];
1139 (j +
1140 (k +
1142 my_degree)) *
1143 my_degree +
1145 (my_degree + 1)][2][1][1] =
1147 (j + (k + 2) * (my_degree + 2) + 2) *
1148 (my_degree + 1)][2][2];
1150 (j +
1151 (k +
1153 my_degree)) *
1154 my_degree +
1156 (my_degree + 1)][2][1][2] =
1158 (j + (k + 2) * (my_degree + 2) + 2) *
1159 (my_degree + 1)][2][0];
1161 (j +
1162 (k +
1164 my_degree)) *
1165 my_degree +
1167 (my_degree + 1)][2][2][0] =
1169 (j + (k + 2) * (my_degree + 2) + 2) *
1170 (my_degree + 1)][0][1];
1172 (j +
1173 (k +
1175 my_degree)) *
1176 my_degree +
1178 (my_degree + 1)][2][2][1] =
1180 (j + (k + 2) * (my_degree + 2) + 2) *
1181 (my_degree + 1)][0][2];
1183 (j +
1184 (k +
1186 my_degree)) *
1187 my_degree +
1189 (my_degree + 1)][2][2][2] =
1191 (j + (k + 2) * (my_degree + 2) + 2) *
1192 (my_degree + 1)][0][0];
1193 }
1194
1195 for (unsigned int k = 0; k < 2; ++k)
1196 {
1197 for (unsigned int l = 0; l < dim; ++l)
1198 for (unsigned int m = 0; m < dim; ++m)
1199 {
1200 for (unsigned int n = 0; n < 2; ++n)
1201 {
1202 for (unsigned int o = 0; o < 2; ++o)
1203 {
1205 [i +
1206 (j +
1207 (2 * (k + 2 * n) + 1) * my_degree +
1209 (my_degree + 1)][o + n][l][m] =
1210 0.0;
1212 [(i +
1213 2 * (k + 2 * (n + 1)) *
1214 (my_degree + 1) +
1216 my_degree +
1217 j +
1219 [o + k][l][m] = 0.0;
1220 }
1221
1223 [(i + 2 * k * (my_degree + 1) +
1225 my_degree +
1227 [2 * n][l][m] = 0.0;
1229 [i + (j + (2 * k + 9) * my_degree +
1231 (my_degree + 1)][2 * n][l][m] =
1232 0.0;
1233 }
1234
1236 (j + (2 * k + 5) * my_degree +
1238 (my_degree + 1)][0][l][m] =
1240 [i + ((j + 2) * (my_degree + 2) + k) *
1241 (my_degree + 1)][l][m];
1242 grad_grads[(i + 2 * (k + 4) * (my_degree + 1) +
1244 my_degree +
1245 j +
1248 [i + (j + k * (my_degree + 2) + 2) *
1249 (my_degree + 1)][l][m];
1250 }
1251
1253 [(i + 2 * k * (my_degree + 1) +
1255 my_degree +
1257 p1_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1258 (my_degree + 1)][2][2];
1260 [(i + 2 * k * (my_degree + 1) +
1262 my_degree +
1264 p1_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1265 (my_degree + 1)][2][0];
1267 [(i + 2 * k * (my_degree + 1) +
1269 my_degree +
1271 p1_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1272 (my_degree + 1)][2][1];
1274 [(i + 2 * k * (my_degree + 1) +
1276 my_degree +
1278 p1_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1279 (my_degree + 1)][0][2];
1281 [(i + 2 * k * (my_degree + 1) +
1283 my_degree +
1285 p1_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1286 (my_degree + 1)][0][0];
1288 [(i + 2 * k * (my_degree + 1) +
1290 my_degree +
1292 p1_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1293 (my_degree + 1)][0][1];
1295 [(i + 2 * k * (my_degree + 1) +
1297 my_degree +
1299 p1_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1300 (my_degree + 1)][1][2];
1302 [(i + 2 * k * (my_degree + 1) +
1304 my_degree +
1306 p1_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1307 (my_degree + 1)][1][0];
1309 [(i + 2 * k * (my_degree + 1) +
1311 my_degree +
1313 p1_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1314 (my_degree + 1)][1][1];
1315 grad_grads[i + (j + (2 * k + 1) * my_degree +
1317 (my_degree + 1)][2][0][0] =
1318 p2_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1319 (my_degree + 1)][1][1];
1320 grad_grads[i + (j + (2 * k + 1) * my_degree +
1322 (my_degree + 1)][2][0][1] =
1323 p2_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1324 (my_degree + 1)][1][2];
1325 grad_grads[i + (j + (2 * k + 1) * my_degree +
1327 (my_degree + 1)][2][0][2] =
1328 p2_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1329 (my_degree + 1)][1][0];
1330 grad_grads[i + (j + (2 * k + 1) * my_degree +
1332 (my_degree + 1)][2][1][0] =
1333 p2_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1334 (my_degree + 1)][2][1];
1335 grad_grads[i + (j + (2 * k + 1) * my_degree +
1337 (my_degree + 1)][2][1][1] =
1338 p2_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1339 (my_degree + 1)][2][2];
1340 grad_grads[i + (j + (2 * k + 1) * my_degree +
1342 (my_degree + 1)][2][1][2] =
1343 p2_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1344 (my_degree + 1)][2][0];
1345 grad_grads[i + (j + (2 * k + 1) * my_degree +
1347 (my_degree + 1)][2][2][0] =
1348 p2_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1349 (my_degree + 1)][0][1];
1350 grad_grads[i + (j + (2 * k + 1) * my_degree +
1352 (my_degree + 1)][2][2][1] =
1353 p2_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1354 (my_degree + 1)][0][2];
1355 grad_grads[i + (j + (2 * k + 1) * my_degree +
1357 (my_degree + 1)][2][2][2] =
1358 p2_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1359 (my_degree + 1)][0][0];
1361 [(i + 2 * (k + 2) * (my_degree + 1) +
1363 my_degree +
1365 p2_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1366 (my_degree + 1)][1][1];
1368 [(i + 2 * (k + 2) * (my_degree + 1) +
1370 my_degree +
1372 p2_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1373 (my_degree + 1)][1][2];
1375 [(i + 2 * (k + 2) * (my_degree + 1) +
1377 my_degree +
1379 p2_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1380 (my_degree + 1)][1][0];
1382 [(i + 2 * (k + 2) * (my_degree + 1) +
1384 my_degree +
1386 p2_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1387 (my_degree + 1)][2][1];
1389 [(i + 2 * (k + 2) * (my_degree + 1) +
1391 my_degree +
1393 p2_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1394 (my_degree + 1)][2][2];
1396 [(i + 2 * (k + 2) * (my_degree + 1) +
1398 my_degree +
1400 p2_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1401 (my_degree + 1)][2][0];
1403 [(i + 2 * (k + 2) * (my_degree + 1) +
1405 my_degree +
1407 p2_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1408 (my_degree + 1)][0][1];
1410 [(i + 2 * (k + 2) * (my_degree + 1) +
1412 my_degree +
1414 p2_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1415 (my_degree + 1)][0][2];
1417 [(i + 2 * (k + 2) * (my_degree + 1) +
1419 my_degree +
1421 p2_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1422 (my_degree + 1)][0][0];
1423 grad_grads[i + (j + (2 * k + 9) * my_degree +
1425 (my_degree + 1)][1][0][0] =
1426 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1427 (my_degree + 1)][2][2];
1428 grad_grads[i + (j + (2 * k + 9) * my_degree +
1430 (my_degree + 1)][1][0][1] =
1431 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1432 (my_degree + 1)][2][0];
1433 grad_grads[i + (j + (2 * k + 9) * my_degree +
1435 (my_degree + 1)][1][0][2] =
1436 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1437 (my_degree + 1)][2][1];
1438 grad_grads[i + (j + (2 * k + 9) * my_degree +
1440 (my_degree + 1)][1][1][0] =
1441 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1442 (my_degree + 1)][0][2];
1443 grad_grads[i + (j + (2 * k + 9) * my_degree +
1445 (my_degree + 1)][1][1][1] =
1446 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1447 (my_degree + 1)][0][0];
1448 grad_grads[i + (j + (2 * k + 9) * my_degree +
1450 (my_degree + 1)][1][1][2] =
1451 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1452 (my_degree + 1)][0][1];
1453 grad_grads[i + (j + (2 * k + 9) * my_degree +
1455 (my_degree + 1)][1][2][0] =
1456 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1457 (my_degree + 1)][1][2];
1458 grad_grads[i + (j + (2 * k + 9) * my_degree +
1460 (my_degree + 1)][1][2][1] =
1461 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1462 (my_degree + 1)][1][0];
1463 grad_grads[i + (j + (2 * k + 9) * my_degree +
1465 (my_degree + 1)][1][2][2] =
1466 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1467 (my_degree + 1)][1][1];
1468 }
1469 }
1470 }
1471
1472 break;
1473 }
1474
1475 default:
1477 }
1478}
1479
1480
1481template <int dim>
1482unsigned int
1484{
1485 switch (dim)
1486 {
1487 case 1:
1488 return k + 1;
1489
1490 case 2:
1491 return 2 * (k + 1) * (k + 2);
1492
1493 case 3:
1494 return 3 * (k + 1) * (k + 2) * (k + 2);
1495
1496 default:
1497 {
1499 return 0;
1500 }
1501 }
1502}
1503
1504
1505template <int dim>
1506std::unique_ptr<TensorPolynomialsBase<dim>>
1508{
1509 return std::make_unique<PolynomialsNedelec<dim>>(*this);
1510}
1511
1512
1513template class PolynomialsNedelec<1>;
1514template class PolynomialsNedelec<2>;
1515template class PolynomialsNedelec<3>;
1516
1517
virtual std::unique_ptr< TensorPolynomialsBase< dim > > clone() const override
void evaluate(const Point< dim > &unit_point, std::vector< Tensor< 1, dim > > &values, std::vector< Tensor< 2, dim > > &grads, std::vector< Tensor< 3, dim > > &grad_grads, std::vector< Tensor< 4, dim > > &third_derivatives, std::vector< Tensor< 5, dim > > &fourth_derivatives) const override
PolynomialsNedelec(const unsigned int k)
static std::vector< std::vector< Polynomials::Polynomial< double > > > create_polynomials(const unsigned int k)
static unsigned int n_polynomials(const unsigned int degree)
static std::vector< Polynomial< double > > generate_complete_basis(const unsigned int degree)
static std::vector< Polynomial< double > > generate_complete_basis(const unsigned int p)
friend class Tensor
Definition tensor.h:868
std::conditional_t< rank_==1, std::array< Number, dim >, std::array< Tensor< rank_ - 1, dim, Number >, dim > > values
Definition tensor.h:854
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:503
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:504
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
#define DEAL_II_NOT_IMPLEMENTED()