Reference documentation for deal.II version 9.5.0
Searching...
No Matches
polynomials_nedelec.cc
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (C) 2013 - 2020 by the deal.II authors
4//
5// This file is part of the deal.II library.
6//
7// The deal.II library is free software; you can use it, redistribute
8// it, and/or modify it under the terms of the GNU Lesser General
10// version 2.1 of the License, or (at your option) any later version.
11// The full text of the license can be found in the file LICENSE.md at
12// the top level directory of deal.II.
13//
14// ---------------------------------------------------------------------
15
20
21#include <iomanip>
22#include <iostream>
23#include <memory>
24
26
27
28template <int dim>
30 : TensorPolynomialsBase<dim>(k, n_polynomials(k))
31 , polynomial_space(create_polynomials(k))
32{}
33
34template <int dim>
35std::vector<std::vector<Polynomials::Polynomial<double>>>
37{
38 std::vector<std::vector<Polynomials::Polynomial<double>>> pols(dim);
39
41
42 for (unsigned int i = 1; i < dim; ++i)
44
45 return pols;
46}
47
48
50// and double gradients of the
51// polynomial at the given point.
52template <int dim>
53void
55 const Point<dim> & unit_point,
56 std::vector<Tensor<1, dim>> &values,
59 std::vector<Tensor<4, dim>> &third_derivatives,
60 std::vector<Tensor<5, dim>> &fourth_derivatives) const
61{
62 Assert(values.size() == this->n() || values.size() == 0,
63 ExcDimensionMismatch(values.size(), this->n()));
68 Assert(third_derivatives.size() == this->n() || third_derivatives.size() == 0,
69 ExcDimensionMismatch(third_derivatives.size(), this->n()));
70 Assert(fourth_derivatives.size() == this->n() ||
71 fourth_derivatives.size() == 0,
72 ExcDimensionMismatch(fourth_derivatives.size(), this->n()));
73
74 // third and fourth derivatives not implemented
75 (void)third_derivatives;
76 Assert(third_derivatives.size() == 0, ExcNotImplemented());
77 (void)fourth_derivatives;
78 Assert(fourth_derivatives.size() == 0, ExcNotImplemented());
79
80 // Declare the values, derivatives
81 // and second derivatives vectors of
82 // <tt>polynomial_space</tt> at
83 // <tt>unit_point</tt>
84 const unsigned int n_basis = polynomial_space.n();
85 const unsigned int my_degree = this->degree();
86 std::vector<double> unit_point_values((values.size() == 0) ? 0 : n_basis);
88 n_basis);
91 std::vector<Tensor<3, dim>> empty_vector_of_3rd_order_tensors;
92 std::vector<Tensor<4, dim>> empty_vector_of_4th_order_tensors;
93
94 switch (dim)
95 {
96 case 1:
97 {
98 polynomial_space.evaluate(unit_point,
99 unit_point_values,
102 empty_vector_of_3rd_order_tensors,
103 empty_vector_of_4th_order_tensors);
104
105 // Assign the correct values to the
106 // corresponding shape functions.
107 if (values.size() > 0)
108 for (unsigned int i = 0; i < unit_point_values.size(); ++i)
109 values[i][0] = unit_point_values[i];
110
112 for (unsigned int i = 0; i < unit_point_grads.size(); ++i)
114
118
119 break;
120 }
121
122 case 2:
123 {
124 polynomial_space.evaluate(unit_point,
125 unit_point_values,
128 empty_vector_of_3rd_order_tensors,
129 empty_vector_of_4th_order_tensors);
130
131 // Declare the values, derivatives and
132 // second derivatives vectors of
133 // <tt>polynomial_space</tt> at
134 // <tt>unit_point</tt> with coordinates
135 // shifted one step in positive direction
136 Point<dim> p;
137
138 p(0) = unit_point(1);
139 p(1) = unit_point(0);
140
141 std::vector<double> p_values((values.size() == 0) ? 0 : n_basis);
143 n_basis);
146
147 polynomial_space.evaluate(p,
148 p_values,
151 empty_vector_of_3rd_order_tensors,
152 empty_vector_of_4th_order_tensors);
153
154 // Assign the correct values to the
155 // corresponding shape functions.
156 if (values.size() > 0)
157 {
158 for (unsigned int i = 0; i <= my_degree; ++i)
159 for (unsigned int j = 0; j < 2; ++j)
160 {
161 values[i + j * (my_degree + 1)][0] = 0.0;
162 values[i + j * (my_degree + 1)][1] =
163 p_values[i + j * (my_degree + 1)];
164 values[i + (j + 2) * (my_degree + 1)][0] =
165 unit_point_values[i + j * (my_degree + 1)];
166 values[i + (j + 2) * (my_degree + 1)][1] = 0.0;
167 }
168
169 if (my_degree > 0)
170 for (unsigned int i = 0; i <= my_degree; ++i)
171 for (unsigned int j = 0; j < my_degree; ++j)
172 {
174 my_degree +
176 unit_point_values[i + (j + 2) * (my_degree + 1)];
178 my_degree +
180 values[i + (j + my_degree +
182 (my_degree + 1)][0] = 0.0;
183 values[i + (j + my_degree +
185 (my_degree + 1)][1] =
186 p_values[i + (j + 2) * (my_degree + 1)];
187 }
188 }
189
191 {
192 for (unsigned int i = 0; i <= my_degree; ++i)
193 for (unsigned int j = 0; j < 2; ++j)
194 {
195 for (unsigned int k = 0; k < dim; ++k)
196 {
197 grads[i + j * (my_degree + 1)][0][k] = 0.0;
198 grads[i + (j + 2) * (my_degree + 1)][0][k] =
199 unit_point_grads[i + j * (my_degree + 1)][k];
200 grads[i + (j + 2) * (my_degree + 1)][1][k] = 0.0;
201 }
202
203 grads[i + j * (my_degree + 1)][1][0] =
204 p_grads[i + j * (my_degree + 1)][1];
205 grads[i + j * (my_degree + 1)][1][1] =
206 p_grads[i + j * (my_degree + 1)][0];
207 }
208
209 if (my_degree > 0)
210 for (unsigned int i = 0; i <= my_degree; ++i)
211 for (unsigned int j = 0; j < my_degree; ++j)
212 {
213 for (unsigned int k = 0; k < dim; ++k)
214 {
216 my_degree +
218 unit_point_grads[i + (j + 2) * (my_degree + 1)][k];
220 my_degree +
222 0.0;
223 grads[i + (j + my_degree +
225 (my_degree + 1)][0][k] = 0.0;
226 }
227
228 grads[i + (j + my_degree +
230 (my_degree + 1)][1][0] =
231 p_grads[i + (j + 2) * (my_degree + 1)][1];
232 grads[i + (j + my_degree +
234 (my_degree + 1)][1][1] =
235 p_grads[i + (j + 2) * (my_degree + 1)][0];
236 }
237 }
238
240 {
241 for (unsigned int i = 0; i <= my_degree; ++i)
242 for (unsigned int j = 0; j < 2; ++j)
243 {
244 for (unsigned int k = 0; k < dim; ++k)
245 for (unsigned int l = 0; l < dim; ++l)
246 {
250 [l];
252 0.0;
253 }
254
263 }
264
265 if (my_degree > 0)
266 for (unsigned int i = 0; i <= my_degree; ++i)
267 for (unsigned int j = 0; j < my_degree; ++j)
268 {
269 for (unsigned int k = 0; k < dim; ++k)
270 for (unsigned int l = 0; l < dim; ++l)
271 {
273 my_degree +
276 [i + (j + 2) * (my_degree + 1)][k][l];
278 my_degree +
280 [k][l] = 0.0;
283 (my_degree + 1)][0][k][l] = 0.0;
284 }
285
288 (my_degree + 1)][1][0][0] =
292 (my_degree + 1)][1][0][1] =
296 (my_degree + 1)][1][1][0] =
300 (my_degree + 1)][1][1][1] =
302 }
303 }
304
305 break;
306 }
307
308 case 3:
309 {
310 polynomial_space.evaluate(unit_point,
311 unit_point_values,
314 empty_vector_of_3rd_order_tensors,
315 empty_vector_of_4th_order_tensors);
316
317 // Declare the values, derivatives
318 // and second derivatives vectors of
319 // <tt>polynomial_space</tt> at
320 // <tt>unit_point</tt> with coordinates
321 // shifted two steps in positive
322 // direction
323 Point<dim> p1, p2;
324 std::vector<double> p1_values((values.size() == 0) ? 0 : n_basis);
326 n_basis);
329 std::vector<double> p2_values((values.size() == 0) ? 0 : n_basis);
331 n_basis);
334
335 p1(0) = unit_point(1);
336 p1(1) = unit_point(2);
337 p1(2) = unit_point(0);
338 polynomial_space.evaluate(p1,
339 p1_values,
342 empty_vector_of_3rd_order_tensors,
343 empty_vector_of_4th_order_tensors);
344 p2(0) = unit_point(2);
345 p2(1) = unit_point(0);
346 p2(2) = unit_point(1);
347 polynomial_space.evaluate(p2,
348 p2_values,
351 empty_vector_of_3rd_order_tensors,
352 empty_vector_of_4th_order_tensors);
353
354 // Assign the correct values to the
355 // corresponding shape functions.
356 if (values.size() > 0)
357 {
358 for (unsigned int i = 0; i <= my_degree; ++i)
359 {
360 for (unsigned int j = 0; j < 2; ++j)
361 {
362 for (unsigned int k = 0; k < 2; ++k)
363 {
364 for (unsigned int l = 0; l < 2; ++l)
365 {
366 values[i + (j + 4 * k) * (my_degree + 1)][2 * l] =
367 0.0;
368 values[i + (j + 4 * k + 2) * (my_degree + 1)]
369 [l + 1] = 0.0;
370 values[i + (j + 2 * (k + 4)) * (my_degree + 1)]
371 [l] = 0.0;
372 }
373
374 values[i + (j + 4 * k + 2) * (my_degree + 1)][0] =
375 unit_point_values[i + (j + k * (my_degree + 2)) *
376 (my_degree + 1)];
377 values[i + (j + 2 * (k + 4)) * (my_degree + 1)][2] =
378 p2_values[i + (j + k * (my_degree + 2)) *
379 (my_degree + 1)];
380 }
381
382 values[i + j * (my_degree + 1)][1] =
383 p1_values[i + j * (my_degree + 1) * (my_degree + 2)];
384 }
385
386 values[i + 4 * (my_degree + 1)][1] =
387 p1_values[i + my_degree + 1];
388 values[i + 5 * (my_degree + 1)][1] =
389 p1_values[i + (my_degree + 1) * (my_degree + 3)];
390 }
391
392 if (my_degree > 0)
393 for (unsigned int i = 0; i <= my_degree; ++i)
394 for (unsigned int j = 0; j < my_degree; ++j)
395 {
396 for (unsigned int k = 0; k < my_degree; ++k)
397 {
398 for (unsigned int l = 0; l < 2; ++l)
399 {
400 values[((i +
402 my_degree +
405 my_degree +
407 [l + 1] = 0.0;
408 values[(i +
409 (j +
411 my_degree) *
412 (my_degree + 1) +
414 my_degree +
416 [2 * l] = 0.0;
417 values[i +
418 (j +
419 (k +
421 my_degree)) *
422 my_degree +
424 (my_degree + 1)][l] = 0.0;
425 }
426
427 values[((i + 2 * GeometryInfo<dim>::faces_per_cell) *
428 my_degree +
431 my_degree +
433 unit_point_values[i +
434 (j + (k + 2) * (my_degree + 2) +
435 2) *
436 (my_degree + 1)];
437 values[(i +
439 my_degree) *
440 (my_degree + 1) +
442 my_degree +
444 p1_values[i + ((j + 2) * (my_degree + 2) + k + 2) *
445 (my_degree + 1)];
446 values[i +
447 (j +
449 my_degree)) *
450 my_degree +
452 (my_degree + 1)][2] =
453 p2_values[i + (j + (k + 2) * (my_degree + 2) + 2) *
454 (my_degree + 1)];
455 }
456
457 for (unsigned int k = 0; k < 2; ++k)
458 {
459 for (unsigned int l = 0; l < 2; ++l)
460 {
461 for (unsigned int m = 0; m < 2; ++m)
462 {
463 values[i +
464 (j +
465 (2 * (k + 2 * l) + 1) * my_degree +
467 (my_degree + 1)][m + l] = 0.0;
468 values[(i +
469 2 * (k + 2 * (l + 1)) *
470 (my_degree + 1) +
472 my_degree +
474 [m + l] = 0.0;
475 }
476
477 values[(i + 2 * k * (my_degree + 1) +
479 my_degree +
481 [2 * l] = 0.0;
482 values[i + (j + (2 * k + 9) * my_degree +
484 (my_degree + 1)][2 * l] = 0.0;
485 }
486
487 values[(i + 2 * k * (my_degree + 1) +
489 my_degree +
491 p1_values[i + (j + k * (my_degree + 2) + 2) *
492 (my_degree + 1)];
493 values[i + (j + (2 * k + 1) * my_degree +
495 (my_degree + 1)][2] =
496 p2_values[i + ((j + 2) * (my_degree + 2) + k) *
497 (my_degree + 1)];
498 values[(i + 2 * (k + 2) * (my_degree + 1) +
500 my_degree +
502 p2_values[i + (j + k * (my_degree + 2) + 2) *
503 (my_degree + 1)];
504 values[i + (j + (2 * k + 5) * my_degree +
506 (my_degree + 1)][0] =
507 unit_point_values[i +
508 ((j + 2) * (my_degree + 2) + k) *
509 (my_degree + 1)];
510 values[(i + 2 * (k + 4) * (my_degree + 1) +
512 my_degree +
514 unit_point_values[i +
515 (j + k * (my_degree + 2) + 2) *
516 (my_degree + 1)];
517 values[i + (j + (2 * k + 9) * my_degree +
519 (my_degree + 1)][1] =
520 p1_values[i + ((j + 2) * (my_degree + 2) + k) *
521 (my_degree + 1)];
522 }
523 }
524 }
525
527 {
528 for (unsigned int i = 0; i <= my_degree; ++i)
529 {
530 for (unsigned int j = 0; j < 2; ++j)
531 {
532 for (unsigned int k = 0; k < 2; ++k)
533 {
534 for (unsigned int l = 0; l < 2; ++l)
535 for (unsigned int m = 0; m < dim; ++m)
536 {
537 grads[i + (j + 4 * k) * (my_degree + 1)][2 * l]
538 [m] = 0.0;
539 grads[i + (j + 4 * k + 2) * (my_degree + 1)]
540 [l + 1][m] = 0.0;
541 grads[i + (j + 2 * (k + 4)) * (my_degree + 1)]
542 [l][m] = 0.0;
543 }
544
545 for (unsigned int l = 0; l < dim; ++l)
546 grads[i + (j + 4 * k + 2) * (my_degree + 1)][0][l] =
547 unit_point_grads[i + (j + k * (my_degree + 2)) *
548 (my_degree + 1)][l];
549
550 grads[i + (j + 2 * (k + 4)) * (my_degree + 1)][2][0] =
551 p2_grads[i + (j + k * (my_degree + 2)) *
552 (my_degree + 1)][1];
553 grads[i + (j + 2 * (k + 4)) * (my_degree + 1)][2][1] =
554 p2_grads[i + (j + k * (my_degree + 2)) *
555 (my_degree + 1)][2];
556 grads[i + (j + 2 * (k + 4)) * (my_degree + 1)][2][2] =
557 p2_grads[i + (j + k * (my_degree + 2)) *
558 (my_degree + 1)][0];
559 }
560
561 grads[i + j * (my_degree + 1)][1][0] =
562 p1_grads[i + j * (my_degree + 1) * (my_degree + 2)][2];
563 grads[i + j * (my_degree + 1)][1][1] =
564 p1_grads[i + j * (my_degree + 1) * (my_degree + 2)][0];
565 grads[i + j * (my_degree + 1)][1][2] =
566 p1_grads[i + j * (my_degree + 1) * (my_degree + 2)][1];
567 }
568
569 grads[i + 4 * (my_degree + 1)][1][0] =
570 p1_grads[i + my_degree + 1][2];
571 grads[i + 4 * (my_degree + 1)][1][1] =
572 p1_grads[i + my_degree + 1][0];
573 grads[i + 4 * (my_degree + 1)][1][2] =
574 p1_grads[i + my_degree + 1][1];
575 grads[i + 5 * (my_degree + 1)][1][0] =
576 p1_grads[i + (my_degree + 1) * (my_degree + 3)][2];
577 grads[i + 5 * (my_degree + 1)][1][1] =
578 p1_grads[i + (my_degree + 1) * (my_degree + 3)][0];
579 grads[i + 5 * (my_degree + 1)][1][2] =
580 p1_grads[i + (my_degree + 1) * (my_degree + 3)][1];
581 }
582
583 if (my_degree > 0)
584 for (unsigned int i = 0; i <= my_degree; ++i)
585 for (unsigned int j = 0; j < my_degree; ++j)
586 {
587 for (unsigned int k = 0; k < my_degree; ++k)
588 {
589 for (unsigned int l = 0; l < dim; ++l)
590 {
591 for (unsigned int m = 0; m < 2; ++m)
592 {
594 [((i +
596 my_degree +
599 my_degree +
601 [m + 1][l] = 0.0;
603 (j +
604 2 *
606 my_degree) *
607 (my_degree + 1) +
609 my_degree +
611 [2 * m][l] = 0.0;
613 (j +
614 (k +
615 2 *
617 my_degree)) *
618 my_degree +
620 (my_degree + 1)][m][l] = 0.0;
621 }
622
625 my_degree +
628 my_degree +
631 [i + (j + (k + 2) * (my_degree + 2) + 2) *
632 (my_degree + 1)][l];
633 }
634
637 my_degree) *
638 (my_degree + 1) +
640 my_degree +
642 p1_grads[i + ((j + 2) * (my_degree + 2) + k + 2) *
643 (my_degree + 1)][2];
646 my_degree) *
647 (my_degree + 1) +
649 my_degree +
651 p1_grads[i + ((j + 2) * (my_degree + 2) + k + 2) *
652 (my_degree + 1)][0];
655 my_degree) *
656 (my_degree + 1) +
658 my_degree +
660 p1_grads[i + ((j + 2) * (my_degree + 2) + k + 2) *
661 (my_degree + 1)][1];
663 (j +
665 my_degree)) *
666 my_degree +
668 (my_degree + 1)][2][0] =
669 p2_grads[i + (j + (k + 2) * (my_degree + 2) + 2) *
670 (my_degree + 1)][1];
672 (j +
674 my_degree)) *
675 my_degree +
677 (my_degree + 1)][2][1] =
678 p2_grads[i + (j + (k + 2) * (my_degree + 2) + 2) *
679 (my_degree + 1)][2];
681 (j +
683 my_degree)) *
684 my_degree +
686 (my_degree + 1)][2][2] =
687 p2_grads[i + (j + (k + 2) * (my_degree + 2) + 2) *
688 (my_degree + 1)][0];
689 }
690
691 for (unsigned int k = 0; k < 2; ++k)
692 {
693 for (unsigned int l = 0; l < 2; ++l)
694 for (unsigned int m = 0; m < dim; ++m)
695 {
696 for (unsigned int n = 0; n < 2; ++n)
697 {
699 (j +
700 (2 * (k + 2 * l) + 1) * my_degree +
702 (my_degree + 1)][n + l][m] = 0.0;
704 2 * (k + 2 * (l + 1)) *
705 (my_degree + 1) +
707 my_degree +
709 [n + l][m] = 0.0;
710 }
711
712 grads[(i + 2 * k * (my_degree + 1) +
714 my_degree +
716 [2 * l][m] = 0.0;
717 grads[i + (j + (2 * k + 9) * my_degree +
719 (my_degree + 1)][2 * l][m] = 0.0;
720 }
721
722 for (unsigned int l = 0; l < dim; ++l)
723 {
724 grads[i + (j + (2 * k + 5) * my_degree +
726 (my_degree + 1)][0][l] =
728 ((j + 2) * (my_degree + 2) +
729 k) *
730 (my_degree + 1)][l];
731 grads[(i + 2 * (k + 4) * (my_degree + 1) +
733 my_degree +
734 j +
737 (j + k * (my_degree + 2) + 2) *
738 (my_degree + 1)][l];
739 }
740
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)][2];
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)][0];
753 grads[(i + 2 * k * (my_degree + 1) +
755 my_degree +
757 p1_grads[i + (j + k * (my_degree + 2) + 2) *
758 (my_degree + 1)][1];
759 grads[i + (j + (2 * k + 1) * my_degree +
761 (my_degree + 1)][2][0] =
762 p2_grads[i + ((j + 2) * (my_degree + 2) + k) *
763 (my_degree + 1)][1];
764 grads[i + (j + (2 * k + 1) * my_degree +
766 (my_degree + 1)][2][1] =
767 p2_grads[i + ((j + 2) * (my_degree + 2) + k) *
768 (my_degree + 1)][2];
769 grads[i + (j + (2 * k + 1) * my_degree +
771 (my_degree + 1)][2][2] =
772 p2_grads[i + ((j + 2) * (my_degree + 2) + k) *
773 (my_degree + 1)][0];
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)][1];
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)][2];
786 grads[(i + 2 * (k + 2) * (my_degree + 1) +
788 my_degree +
790 p2_grads[i + (j + k * (my_degree + 2) + 2) *
791 (my_degree + 1)][0];
792 grads[i + (j + (2 * k + 9) * my_degree +
794 (my_degree + 1)][1][0] =
795 p1_grads[i + ((j + 2) * (my_degree + 2) + k) *
796 (my_degree + 1)][2];
797 grads[i + (j + (2 * k + 9) * my_degree +
799 (my_degree + 1)][1][1] =
800 p1_grads[i + ((j + 2) * (my_degree + 2) + k) *
801 (my_degree + 1)][0];
802 grads[i + (j + (2 * k + 9) * my_degree +
804 (my_degree + 1)][1][2] =
805 p1_grads[i + ((j + 2) * (my_degree + 2) + k) *
806 (my_degree + 1)][1];
807 }
808 }
809 }
810
812 {
813 for (unsigned int i = 0; i <= my_degree; ++i)
814 {
815 for (unsigned int j = 0; j < 2; ++j)
816 {
817 for (unsigned int k = 0; k < 2; ++k)
818 {
819 for (unsigned int l = 0; l < dim; ++l)
820 for (unsigned int m = 0; m < dim; ++m)
821 {
822 for (unsigned int n = 0; n < 2; ++n)
823 {
825 (j + 4 * k) * (my_degree + 1)]
826 [2 * n][l][m] = 0.0;
828 (my_degree + 1)][n + 1][l]
829 [m] = 0.0;
831 (my_degree + 1)][n][l][m] =
832 0.0;
833 }
834
836 (my_degree + 1)][0][l][m] =
838 [i + (j + k * (my_degree + 2)) *
839 (my_degree + 1)][l][m];
840 }
841
843 (my_degree + 1)][2][0][0] =
845 (my_degree + 1)][1][1];
847 (my_degree + 1)][2][0][1] =
849 (my_degree + 1)][1][2];
851 (my_degree + 1)][2][0][2] =
853 (my_degree + 1)][1][0];
855 (my_degree + 1)][2][1][0] =
857 (my_degree + 1)][2][1];
859 (my_degree + 1)][2][1][1] =
861 (my_degree + 1)][2][2];
863 (my_degree + 1)][2][1][2] =
865 (my_degree + 1)][2][0];
867 (my_degree + 1)][2][2][0] =
869 (my_degree + 1)][0][1];
871 (my_degree + 1)][2][2][1] =
873 (my_degree + 1)][0][2];
875 (my_degree + 1)][2][2][2] =
877 (my_degree + 1)][0][0];
878 }
879
881 p1_grad_grads[i + j * (my_degree + 1) * (my_degree + 2)]
882 [2][2];
884 p1_grad_grads[i + j * (my_degree + 1) * (my_degree + 2)]
885 [2][0];
887 p1_grad_grads[i + j * (my_degree + 1) * (my_degree + 2)]
888 [2][1];
890 p1_grad_grads[i + j * (my_degree + 1) * (my_degree + 2)]
891 [0][2];
893 p1_grad_grads[i + j * (my_degree + 1) * (my_degree + 2)]
894 [0][0];
896 p1_grad_grads[i + j * (my_degree + 1) * (my_degree + 2)]
897 [0][1];
899 p1_grad_grads[i + j * (my_degree + 1) * (my_degree + 2)]
900 [1][2];
902 p1_grad_grads[i + j * (my_degree + 1) * (my_degree + 2)]
903 [1][0];
905 p1_grad_grads[i + j * (my_degree + 1) * (my_degree + 2)]
906 [1][1];
907 }
908
945 }
946
947 if (my_degree > 0)
948 for (unsigned int i = 0; i <= my_degree; ++i)
949 for (unsigned int j = 0; j < my_degree; ++j)
950 {
951 for (unsigned int k = 0; k < my_degree; ++k)
952 {
953 for (unsigned int l = 0; l < dim; ++l)
954 for (unsigned int m = 0; m < dim; ++m)
955 {
956 for (unsigned int n = 0; n < 2; ++n)
957 {
959 [((i +
960 2 *
962 my_degree +
965 my_degree +
967 [n + 1][l][m] = 0.0;
969 [(i +
970 (j +
972 my_degree) *
973 (my_degree + 1) +
975 my_degree +
977 [2 * n][l][m] = 0.0;
979 [i + (j +
980 (k + 2 * (GeometryInfo<
981 dim>::faces_per_cell +
982 my_degree)) *
983 my_degree +
985 (my_degree + 1)][n][l][m] = 0.0;
986 }
987
989 [((i +
991 my_degree +
994 my_degree +
997 [i + (j + (k + 2) * (my_degree + 2) + 2) *
998 (my_degree + 1)][l][m];
999 }
1000
1002 [(i +
1004 my_degree) *
1005 (my_degree + 1) +
1007 my_degree +
1008 k + GeometryInfo<dim>::lines_per_cell][1][0][0] =
1009 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k +
1010 2) *
1011 (my_degree + 1)][2][2];
1013 [(i +
1015 my_degree) *
1016 (my_degree + 1) +
1018 my_degree +
1019 k + GeometryInfo<dim>::lines_per_cell][1][0][1] =
1020 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k +
1021 2) *
1022 (my_degree + 1)][2][0];
1024 [(i +
1026 my_degree) *
1027 (my_degree + 1) +
1029 my_degree +
1030 k + GeometryInfo<dim>::lines_per_cell][1][0][2] =
1031 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k +
1032 2) *
1033 (my_degree + 1)][2][1];
1035 [(i +
1037 my_degree) *
1038 (my_degree + 1) +
1040 my_degree +
1041 k + GeometryInfo<dim>::lines_per_cell][1][1][0] =
1042 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k +
1043 2) *
1044 (my_degree + 1)][0][2];
1046 [(i +
1048 my_degree) *
1049 (my_degree + 1) +
1051 my_degree +
1052 k + GeometryInfo<dim>::lines_per_cell][1][1][1] =
1053 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k +
1054 2) *
1055 (my_degree + 1)][0][0];
1057 [(i +
1059 my_degree) *
1060 (my_degree + 1) +
1062 my_degree +
1063 k + GeometryInfo<dim>::lines_per_cell][1][1][2] =
1064 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k +
1065 2) *
1066 (my_degree + 1)][0][1];
1068 [(i +
1070 my_degree) *
1071 (my_degree + 1) +
1073 my_degree +
1074 k + GeometryInfo<dim>::lines_per_cell][1][2][0] =
1075 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k +
1076 2) *
1077 (my_degree + 1)][1][2];
1079 [(i +
1081 my_degree) *
1082 (my_degree + 1) +
1084 my_degree +
1085 k + GeometryInfo<dim>::lines_per_cell][1][2][1] =
1086 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k +
1087 2) *
1088 (my_degree + 1)][1][0];
1090 [(i +
1092 my_degree) *
1093 (my_degree + 1) +
1095 my_degree +
1096 k + GeometryInfo<dim>::lines_per_cell][1][2][2] =
1097 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k +
1098 2) *
1099 (my_degree + 1)][1][1];
1101 (j +
1102 (k +
1104 my_degree)) *
1105 my_degree +
1107 (my_degree + 1)][2][0][0] =
1109 (j + (k + 2) * (my_degree + 2) + 2) *
1110 (my_degree + 1)][1][1];
1112 (j +
1113 (k +
1115 my_degree)) *
1116 my_degree +
1118 (my_degree + 1)][2][0][1] =
1120 (j + (k + 2) * (my_degree + 2) + 2) *
1121 (my_degree + 1)][1][2];
1123 (j +
1124 (k +
1126 my_degree)) *
1127 my_degree +
1129 (my_degree + 1)][2][0][2] =
1131 (j + (k + 2) * (my_degree + 2) + 2) *
1132 (my_degree + 1)][1][0];
1134 (j +
1135 (k +
1137 my_degree)) *
1138 my_degree +
1140 (my_degree + 1)][2][1][0] =
1142 (j + (k + 2) * (my_degree + 2) + 2) *
1143 (my_degree + 1)][2][1];
1145 (j +
1146 (k +
1148 my_degree)) *
1149 my_degree +
1151 (my_degree + 1)][2][1][1] =
1153 (j + (k + 2) * (my_degree + 2) + 2) *
1154 (my_degree + 1)][2][2];
1156 (j +
1157 (k +
1159 my_degree)) *
1160 my_degree +
1162 (my_degree + 1)][2][1][2] =
1164 (j + (k + 2) * (my_degree + 2) + 2) *
1165 (my_degree + 1)][2][0];
1167 (j +
1168 (k +
1170 my_degree)) *
1171 my_degree +
1173 (my_degree + 1)][2][2][0] =
1175 (j + (k + 2) * (my_degree + 2) + 2) *
1176 (my_degree + 1)][0][1];
1178 (j +
1179 (k +
1181 my_degree)) *
1182 my_degree +
1184 (my_degree + 1)][2][2][1] =
1186 (j + (k + 2) * (my_degree + 2) + 2) *
1187 (my_degree + 1)][0][2];
1189 (j +
1190 (k +
1192 my_degree)) *
1193 my_degree +
1195 (my_degree + 1)][2][2][2] =
1197 (j + (k + 2) * (my_degree + 2) + 2) *
1198 (my_degree + 1)][0][0];
1199 }
1200
1201 for (unsigned int k = 0; k < 2; ++k)
1202 {
1203 for (unsigned int l = 0; l < dim; ++l)
1204 for (unsigned int m = 0; m < dim; ++m)
1205 {
1206 for (unsigned int n = 0; n < 2; ++n)
1207 {
1208 for (unsigned int o = 0; o < 2; ++o)
1209 {
1211 [i +
1212 (j +
1213 (2 * (k + 2 * n) + 1) * my_degree +
1215 (my_degree + 1)][o + n][l][m] =
1216 0.0;
1218 [(i +
1219 2 * (k + 2 * (n + 1)) *
1220 (my_degree + 1) +
1222 my_degree +
1223 j +
1225 [o + k][l][m] = 0.0;
1226 }
1227
1229 [(i + 2 * k * (my_degree + 1) +
1231 my_degree +
1233 [2 * n][l][m] = 0.0;
1235 [i + (j + (2 * k + 9) * my_degree +
1237 (my_degree + 1)][2 * n][l][m] =
1238 0.0;
1239 }
1240
1242 (j + (2 * k + 5) * my_degree +
1244 (my_degree + 1)][0][l][m] =
1246 [i + ((j + 2) * (my_degree + 2) + k) *
1247 (my_degree + 1)][l][m];
1248 grad_grads[(i + 2 * (k + 4) * (my_degree + 1) +
1250 my_degree +
1251 j +
1254 [i + (j + k * (my_degree + 2) + 2) *
1255 (my_degree + 1)][l][m];
1256 }
1257
1259 [(i + 2 * k * (my_degree + 1) +
1261 my_degree +
1262 j + GeometryInfo<dim>::lines_per_cell][1][0][0] =
1263 p1_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1264 (my_degree + 1)][2][2];
1266 [(i + 2 * k * (my_degree + 1) +
1268 my_degree +
1269 j + GeometryInfo<dim>::lines_per_cell][1][0][1] =
1270 p1_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1271 (my_degree + 1)][2][0];
1273 [(i + 2 * k * (my_degree + 1) +
1275 my_degree +
1276 j + GeometryInfo<dim>::lines_per_cell][1][0][2] =
1277 p1_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1278 (my_degree + 1)][2][1];
1280 [(i + 2 * k * (my_degree + 1) +
1282 my_degree +
1283 j + GeometryInfo<dim>::lines_per_cell][1][1][0] =
1284 p1_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1285 (my_degree + 1)][0][2];
1287 [(i + 2 * k * (my_degree + 1) +
1289 my_degree +
1290 j + GeometryInfo<dim>::lines_per_cell][1][1][1] =
1291 p1_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1292 (my_degree + 1)][0][0];
1294 [(i + 2 * k * (my_degree + 1) +
1296 my_degree +
1297 j + GeometryInfo<dim>::lines_per_cell][1][1][2] =
1298 p1_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1299 (my_degree + 1)][0][1];
1301 [(i + 2 * k * (my_degree + 1) +
1303 my_degree +
1304 j + GeometryInfo<dim>::lines_per_cell][1][2][0] =
1305 p1_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1306 (my_degree + 1)][1][2];
1308 [(i + 2 * k * (my_degree + 1) +
1310 my_degree +
1311 j + GeometryInfo<dim>::lines_per_cell][1][2][1] =
1312 p1_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1313 (my_degree + 1)][1][0];
1315 [(i + 2 * k * (my_degree + 1) +
1317 my_degree +
1318 j + GeometryInfo<dim>::lines_per_cell][1][2][2] =
1319 p1_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1320 (my_degree + 1)][1][1];
1321 grad_grads[i + (j + (2 * k + 1) * my_degree +
1323 (my_degree + 1)][2][0][0] =
1324 p2_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1325 (my_degree + 1)][1][1];
1326 grad_grads[i + (j + (2 * k + 1) * my_degree +
1328 (my_degree + 1)][2][0][1] =
1329 p2_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1330 (my_degree + 1)][1][2];
1331 grad_grads[i + (j + (2 * k + 1) * my_degree +
1333 (my_degree + 1)][2][0][2] =
1334 p2_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1335 (my_degree + 1)][1][0];
1336 grad_grads[i + (j + (2 * k + 1) * my_degree +
1338 (my_degree + 1)][2][1][0] =
1339 p2_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1340 (my_degree + 1)][2][1];
1341 grad_grads[i + (j + (2 * k + 1) * my_degree +
1343 (my_degree + 1)][2][1][1] =
1344 p2_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1345 (my_degree + 1)][2][2];
1346 grad_grads[i + (j + (2 * k + 1) * my_degree +
1348 (my_degree + 1)][2][1][2] =
1349 p2_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1350 (my_degree + 1)][2][0];
1351 grad_grads[i + (j + (2 * k + 1) * my_degree +
1353 (my_degree + 1)][2][2][0] =
1354 p2_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1355 (my_degree + 1)][0][1];
1356 grad_grads[i + (j + (2 * k + 1) * my_degree +
1358 (my_degree + 1)][2][2][1] =
1359 p2_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1360 (my_degree + 1)][0][2];
1361 grad_grads[i + (j + (2 * k + 1) * my_degree +
1363 (my_degree + 1)][2][2][2] =
1364 p2_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1365 (my_degree + 1)][0][0];
1367 [(i + 2 * (k + 2) * (my_degree + 1) +
1369 my_degree +
1370 j + GeometryInfo<dim>::lines_per_cell][2][0][0] =
1371 p2_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1372 (my_degree + 1)][1][1];
1374 [(i + 2 * (k + 2) * (my_degree + 1) +
1376 my_degree +
1377 j + GeometryInfo<dim>::lines_per_cell][2][0][1] =
1378 p2_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1379 (my_degree + 1)][1][2];
1381 [(i + 2 * (k + 2) * (my_degree + 1) +
1383 my_degree +
1384 j + GeometryInfo<dim>::lines_per_cell][2][0][2] =
1385 p2_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1386 (my_degree + 1)][1][0];
1388 [(i + 2 * (k + 2) * (my_degree + 1) +
1390 my_degree +
1391 j + GeometryInfo<dim>::lines_per_cell][2][1][0] =
1392 p2_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1393 (my_degree + 1)][2][1];
1395 [(i + 2 * (k + 2) * (my_degree + 1) +
1397 my_degree +
1398 j + GeometryInfo<dim>::lines_per_cell][2][1][1] =
1399 p2_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1400 (my_degree + 1)][2][2];
1402 [(i + 2 * (k + 2) * (my_degree + 1) +
1404 my_degree +
1405 j + GeometryInfo<dim>::lines_per_cell][2][1][2] =
1406 p2_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1407 (my_degree + 1)][2][0];
1409 [(i + 2 * (k + 2) * (my_degree + 1) +
1411 my_degree +
1412 j + GeometryInfo<dim>::lines_per_cell][2][2][0] =
1413 p2_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1414 (my_degree + 1)][0][1];
1416 [(i + 2 * (k + 2) * (my_degree + 1) +
1418 my_degree +
1419 j + GeometryInfo<dim>::lines_per_cell][2][2][1] =
1420 p2_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1421 (my_degree + 1)][0][2];
1423 [(i + 2 * (k + 2) * (my_degree + 1) +
1425 my_degree +
1426 j + GeometryInfo<dim>::lines_per_cell][2][2][2] =
1427 p2_grad_grads[i + (j + k * (my_degree + 2) + 2) *
1428 (my_degree + 1)][0][0];
1429 grad_grads[i + (j + (2 * k + 9) * my_degree +
1431 (my_degree + 1)][1][0][0] =
1432 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1433 (my_degree + 1)][2][2];
1434 grad_grads[i + (j + (2 * k + 9) * my_degree +
1436 (my_degree + 1)][1][0][1] =
1437 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1438 (my_degree + 1)][2][0];
1439 grad_grads[i + (j + (2 * k + 9) * my_degree +
1441 (my_degree + 1)][1][0][2] =
1442 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1443 (my_degree + 1)][2][1];
1444 grad_grads[i + (j + (2 * k + 9) * my_degree +
1446 (my_degree + 1)][1][1][0] =
1447 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1448 (my_degree + 1)][0][2];
1449 grad_grads[i + (j + (2 * k + 9) * my_degree +
1451 (my_degree + 1)][1][1][1] =
1452 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1453 (my_degree + 1)][0][0];
1454 grad_grads[i + (j + (2 * k + 9) * my_degree +
1456 (my_degree + 1)][1][1][2] =
1457 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1458 (my_degree + 1)][0][1];
1459 grad_grads[i + (j + (2 * k + 9) * my_degree +
1461 (my_degree + 1)][1][2][0] =
1462 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1463 (my_degree + 1)][1][2];
1464 grad_grads[i + (j + (2 * k + 9) * my_degree +
1466 (my_degree + 1)][1][2][1] =
1467 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1468 (my_degree + 1)][1][0];
1469 grad_grads[i + (j + (2 * k + 9) * my_degree +
1471 (my_degree + 1)][1][2][2] =
1472 p1_grad_grads[i + ((j + 2) * (my_degree + 2) + k) *
1473 (my_degree + 1)][1][1];
1474 }
1475 }
1476 }
1477
1478 break;
1479 }
1480
1481 default:
1482 Assert(false, ExcNotImplemented());
1483 }
1484}
1485
1486
1487template <int dim>
1488unsigned int
1490{
1491 switch (dim)
1492 {
1493 case 1:
1494 return k + 1;
1495
1496 case 2:
1497 return 2 * (k + 1) * (k + 2);
1498
1499 case 3:
1500 return 3 * (k + 1) * (k + 2) * (k + 2);
1501
1502 default:
1503 {
1504 Assert(false, ExcNotImplemented());
1505 return 0;
1506 }
1507 }
1508}
1509
1510
1511template <int dim>
1512std::unique_ptr<TensorPolynomialsBase<dim>>
1514{
1515 return std::make_unique<PolynomialsNedelec<dim>>(*this);
1516}
1517
1518
1519template class PolynomialsNedelec<1>;
1520template class PolynomialsNedelec<2>;
1521template class PolynomialsNedelec<3>;
1522
1523
Definition point.h:112
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)
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:472
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:473
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)