52 template <
int spacedim>
54 get_face_sign_change_rt(const ::Triangulation<1>::cell_iterator &,
56 const std::vector<MappingKind> &,
57 std::vector<double> &)
66 get_face_sign_change_rt(
67 const ::Triangulation<2>::cell_iterator &cell,
69 const std::vector<MappingKind> & mapping_kind,
70 std::vector<double> & face_sign)
72 const unsigned int dim = 2;
73 const unsigned int spacedim = 2;
76 f < GeometryInfo<dim>::faces_per_cell;
81 if (!face->at_boundary())
83 const unsigned int nn = cell->neighbor_face_no(f);
92 Assert(mapping_kind.size() == 1 ||
93 cell_j < mapping_kind.size(),
98 if ((mapping_kind.size() > 1 ?
99 mapping_kind[cell_j] :
109 template <
int spacedim>
111 get_face_sign_change_rt(
112 const ::Triangulation<3>::cell_iterator & ,
114 const std::vector<MappingKind> & ,
115 std::vector<double> & )
122 template <
int spacedim>
124 get_face_sign_change_nedelec(
125 const ::Triangulation<1>::cell_iterator & ,
127 const std::vector<MappingKind> & ,
128 std::vector<double> & )
135 template <
int spacedim>
137 get_face_sign_change_nedelec(
138 const ::Triangulation<2>::cell_iterator & ,
140 const std::vector<MappingKind> & ,
141 std::vector<double> & )
147 template <
int spacedim>
149 get_face_sign_change_nedelec(
150 const ::Triangulation<3>::cell_iterator &cell,
152 const std::vector<MappingKind> &mapping_kind,
153 std::vector<double> & face_sign)
155 const unsigned int dim = 3;
158 for (
unsigned int l = 0; l < GeometryInfo<dim>::lines_per_cell; ++
l)
159 if (!(cell->line_orientation(
l)) &&
169 template <
int dim,
int spacedim>
173 const std::vector<bool> & restriction_is_additive_flags,
174 const std::vector<ComponentMask> &nonzero_components)
176 restriction_is_additive_flags,
179 , poly_space(polynomials.clone())
181 cached_point(0) = -1;
189 for (
unsigned int comp = 0; comp < this->
n_components(); ++comp)
190 this->component_to_base_table[comp].
first.second = comp;
195 template <
int dim,
int spacedim>
198 , mapping_kind(fe.mapping_kind)
199 , poly_space(fe.poly_space->clone())
200 , inverse_node_matrix(fe.inverse_node_matrix)
205 template <
int dim,
int spacedim>
209 return mapping_kind.size() == 1;
214 template <
int dim,
int spacedim>
218 if (single_mapping_kind())
219 return mapping_kind[0];
222 return mapping_kind[i];
227 template <
int dim,
int spacedim>
239 template <
int dim,
int spacedim>
242 const unsigned int i,
244 const unsigned int component)
const
249 std::lock_guard<std::mutex> lock(cache_mutex);
251 if (cached_point != p || cached_values.size() == 0)
254 cached_values.resize(poly_space->n());
256 std::vector<Tensor<4, dim>> dummy1;
257 std::vector<Tensor<5, dim>> dummy2;
258 poly_space->evaluate(
259 p, cached_values, cached_grads, cached_grad_grads, dummy1, dummy2);
263 if (inverse_node_matrix.n_cols() == 0)
264 return cached_values[i][component];
266 for (
unsigned int j = 0; j < inverse_node_matrix.n_cols(); ++j)
267 s += inverse_node_matrix(j, i) * cached_values[j][component];
273 template <
int dim,
int spacedim>
284 template <
int dim,
int spacedim>
287 const unsigned int i,
289 const unsigned int component)
const
294 std::lock_guard<std::mutex> lock(cache_mutex);
296 if (cached_point != p || cached_grads.size() == 0)
299 cached_grads.resize(poly_space->n());
301 std::vector<Tensor<4, dim>> dummy1;
302 std::vector<Tensor<5, dim>> dummy2;
303 poly_space->evaluate(
304 p, cached_values, cached_grads, cached_grad_grads, dummy1, dummy2);
308 if (inverse_node_matrix.n_cols() == 0)
309 return cached_grads[i][component];
311 for (
unsigned int j = 0; j < inverse_node_matrix.n_cols(); ++j)
312 s += inverse_node_matrix(j, i) * cached_grads[j][component];
319 template <
int dim,
int spacedim>
330 template <
int dim,
int spacedim>
333 const unsigned int i,
335 const unsigned int component)
const
340 std::lock_guard<std::mutex> lock(cache_mutex);
342 if (cached_point != p || cached_grad_grads.size() == 0)
345 cached_grad_grads.resize(poly_space->n());
347 std::vector<Tensor<4, dim>> dummy1;
348 std::vector<Tensor<5, dim>> dummy2;
349 poly_space->evaluate(
350 p, cached_values, cached_grads, cached_grad_grads, dummy1, dummy2);
354 if (inverse_node_matrix.n_cols() == 0)
355 return cached_grad_grads[i][component];
357 for (
unsigned int j = 0; j < inverse_node_matrix.n_cols(); ++j)
358 s += inverse_node_matrix(i, j) * cached_grad_grads[j][component];
368 template <
int dim,
int spacedim>
376 const ::internal::FEValuesImplementation::MappingRelatedData<dim,
388 Assert(
dynamic_cast<const InternalData *
>(&fe_internal) !=
nullptr,
390 const InternalData &fe_data =
static_cast<const InternalData &
>(fe_internal);
392 const unsigned int n_q_points = quadrature.
size();
395 fe_data.shape_values.size()[0] == this->dofs_per_cell,
397 this->dofs_per_cell));
399 fe_data.shape_values.size()[1] == n_q_points,
408 std::fill(fe_data.sign_change.begin(), fe_data.sign_change.end(), 1.0);
410 internal::FE_PolyTensor::get_face_sign_change_rt(cell,
413 fe_data.sign_change);
415 internal::FE_PolyTensor::get_face_sign_change_nedelec(cell,
418 fe_data.sign_change);
421 for (
unsigned int i = 0; i < this->dofs_per_cell; ++i)
423 const MappingKind mapping_kind = get_mapping_kind(i);
425 const unsigned int first =
426 output_data.shape_function_to_row_table[i * this->
n_components() +
427 this->get_nonzero_components(i)
428 .first_selected_component()];
442 switch (mapping_kind)
446 for (
unsigned int k = 0; k < n_q_points; ++k)
447 for (
unsigned int d = 0;
d < dim; ++
d)
448 output_data.shape_values(
first +
d, k) =
449 fe_data.shape_values[i][k][
d];
460 fe_data.transformed_shape_values));
462 for (
unsigned int k = 0; k < n_q_points; ++k)
463 for (
unsigned int d = 0;
d < dim; ++
d)
464 output_data.shape_values(
first +
d, k) =
465 fe_data.transformed_shape_values[k][
d];
477 fe_data.transformed_shape_values));
478 for (
unsigned int k = 0; k < n_q_points; ++k)
479 for (
unsigned int d = 0;
d < dim; ++
d)
480 output_data.shape_values(
first +
d, k) =
481 fe_data.sign_change[i] *
482 fe_data.transformed_shape_values[k][
d];
492 fe_data.transformed_shape_values));
494 for (
unsigned int k = 0; k < n_q_points; ++k)
495 for (
unsigned int d = 0;
d < dim; ++
d)
496 output_data.shape_values(
first +
d, k) =
497 fe_data.sign_change[i] *
498 fe_data.transformed_shape_values[k][
d];
516 switch (mapping_kind)
524 fe_data.transformed_shape_grads));
525 for (
unsigned int k = 0; k < n_q_points; ++k)
526 for (
unsigned int d = 0;
d < dim; ++
d)
527 output_data.shape_gradients[
first +
d][k] =
528 fe_data.transformed_shape_grads[k][
d];
537 fe_data.transformed_shape_grads));
539 for (
unsigned int k = 0; k < n_q_points; ++k)
540 for (
unsigned int d = 0;
d < spacedim; ++
d)
541 for (
unsigned int n = 0; n < spacedim; ++n)
542 fe_data.transformed_shape_grads[k][
d] -=
543 output_data.shape_values(
first + n, k) *
544 mapping_data.jacobian_pushed_forward_grads[k][n][
d];
546 for (
unsigned int k = 0; k < n_q_points; ++k)
547 for (
unsigned int d = 0;
d < dim; ++
d)
548 output_data.shape_gradients[
first +
d][k] =
549 fe_data.transformed_shape_grads[k][
d];
555 for (
unsigned int k = 0; k < n_q_points; ++k)
556 fe_data.untransformed_shape_grads[k] =
557 fe_data.shape_grads[i][k];
564 for (
unsigned int k = 0; k < n_q_points; ++k)
565 for (
unsigned int d = 0;
d < spacedim; ++
d)
566 for (
unsigned int n = 0; n < spacedim; ++n)
567 fe_data.transformed_shape_grads[k][
d] +=
568 output_data.shape_values(
first + n, k) *
569 mapping_data.jacobian_pushed_forward_grads[k][
d][n];
572 for (
unsigned int k = 0; k < n_q_points; ++k)
573 for (
unsigned int d = 0;
d < dim; ++
d)
574 output_data.shape_gradients[
first +
d][k] =
575 fe_data.transformed_shape_grads[k][
d];
582 for (
unsigned int k = 0; k < n_q_points; ++k)
583 fe_data.untransformed_shape_grads[k] =
584 fe_data.shape_grads[i][k];
591 for (
unsigned int k = 0; k < n_q_points; ++k)
592 for (
unsigned int d = 0;
d < spacedim; ++
d)
593 for (
unsigned int n = 0; n < spacedim; ++n)
594 fe_data.transformed_shape_grads[k][
d] +=
595 (output_data.shape_values(
first + n, k) *
597 .jacobian_pushed_forward_grads[k][
d][n]) -
598 (output_data.shape_values(
first +
d, k) *
599 mapping_data.jacobian_pushed_forward_grads[k][n][n]);
601 for (
unsigned int k = 0; k < n_q_points; ++k)
602 for (
unsigned int d = 0;
d < dim; ++
d)
603 output_data.shape_gradients[
first +
d][k] =
604 fe_data.sign_change[i] *
605 fe_data.transformed_shape_grads[k][
d];
622 for (
unsigned int k = 0; k < n_q_points; ++k)
623 fe_data.untransformed_shape_grads[k] =
624 fe_data.shape_grads[i][k];
632 for (
unsigned int k = 0; k < n_q_points; ++k)
633 for (
unsigned int d = 0;
d < spacedim; ++
d)
634 for (
unsigned int n = 0; n < spacedim; ++n)
635 fe_data.transformed_shape_grads[k][
d] -=
636 output_data.shape_values(
first + n, k) *
637 mapping_data.jacobian_pushed_forward_grads[k][n][
d];
639 for (
unsigned int k = 0; k < n_q_points; ++k)
640 for (
unsigned int d = 0;
d < dim; ++
d)
641 output_data.shape_gradients[
first +
d][k] =
642 fe_data.sign_change[i] *
643 fe_data.transformed_shape_grads[k][
d];
661 switch (mapping_kind)
671 for (
unsigned int k = 0; k < n_q_points; ++k)
672 for (
unsigned int d = 0;
d < spacedim; ++
d)
673 for (
unsigned int n = 0; n < spacedim; ++n)
674 fe_data.transformed_shape_hessians[k][
d] -=
675 output_data.shape_gradients[
first +
d][k][n] *
676 mapping_data.jacobian_pushed_forward_grads[k][n];
678 for (
unsigned int k = 0; k < n_q_points; ++k)
679 for (
unsigned int d = 0;
d < dim; ++
d)
680 output_data.shape_hessians[
first +
d][k] =
681 fe_data.transformed_shape_hessians[k][
d];
687 for (
unsigned int k = 0; k < n_q_points; ++k)
688 fe_data.untransformed_shape_hessian_tensors[k] =
689 fe_data.shape_grad_grads[i][k];
693 fe_data.untransformed_shape_hessian_tensors),
698 for (
unsigned int k = 0; k < n_q_points; ++k)
699 for (
unsigned int d = 0;
d < spacedim; ++
d)
700 for (
unsigned int n = 0; n < spacedim; ++n)
701 for (
unsigned int i = 0; i < spacedim; ++i)
702 for (
unsigned int j = 0; j < spacedim; ++j)
704 fe_data.transformed_shape_hessians[k][
d][i][j] -=
705 (output_data.shape_values(
first + n, k) *
707 .jacobian_pushed_forward_2nd_derivatives
709 (output_data.shape_gradients[
first +
d][k][n] *
711 .jacobian_pushed_forward_grads[k][n][i][j]) +
712 (output_data.shape_gradients[
first + n][k][i] *
714 .jacobian_pushed_forward_grads[k][n][
d][j]) +
715 (output_data.shape_gradients[
first + n][k][j] *
717 .jacobian_pushed_forward_grads[k][n][i][
d]);
720 for (
unsigned int k = 0; k < n_q_points; ++k)
721 for (
unsigned int d = 0;
d < dim; ++
d)
722 output_data.shape_hessians[
first +
d][k] =
723 fe_data.transformed_shape_hessians[k][
d];
729 for (
unsigned int k = 0; k < n_q_points; ++k)
730 fe_data.untransformed_shape_hessian_tensors[k] =
731 fe_data.shape_grad_grads[i][k];
735 fe_data.untransformed_shape_hessian_tensors),
740 for (
unsigned int k = 0; k < n_q_points; ++k)
741 for (
unsigned int d = 0;
d < spacedim; ++
d)
742 for (
unsigned int n = 0; n < spacedim; ++n)
743 for (
unsigned int i = 0; i < spacedim; ++i)
744 for (
unsigned int j = 0; j < spacedim; ++j)
746 fe_data.transformed_shape_hessians[k][
d][i][j] +=
747 (output_data.shape_values(
first + n, k) *
749 .jacobian_pushed_forward_2nd_derivatives
751 (output_data.shape_gradients[
first + n][k][i] *
753 .jacobian_pushed_forward_grads[k][
d][n][j]) +
754 (output_data.shape_gradients[
first + n][k][j] *
756 .jacobian_pushed_forward_grads[k][
d][i][n]) -
757 (output_data.shape_gradients[
first +
d][k][n] *
759 .jacobian_pushed_forward_grads[k][n][i][j]);
760 for (
unsigned int m = 0; m < spacedim; ++m)
762 .transformed_shape_hessians[k][
d][i][j] -=
764 .jacobian_pushed_forward_grads[k][
d][i]
767 .jacobian_pushed_forward_grads[k][m][n]
769 output_data.shape_values(
first + n, k)) +
771 .jacobian_pushed_forward_grads[k][
d][m]
774 .jacobian_pushed_forward_grads[k][m][i]
776 output_data.shape_values(
first + n, k));
779 for (
unsigned int k = 0; k < n_q_points; ++k)
780 for (
unsigned int d = 0;
d < dim; ++
d)
781 output_data.shape_hessians[
first +
d][k] =
782 fe_data.transformed_shape_hessians[k][
d];
789 for (
unsigned int k = 0; k < n_q_points; ++k)
790 fe_data.untransformed_shape_hessian_tensors[k] =
791 fe_data.shape_grad_grads[i][k];
795 fe_data.untransformed_shape_hessian_tensors),
800 for (
unsigned int k = 0; k < n_q_points; ++k)
801 for (
unsigned int d = 0;
d < spacedim; ++
d)
802 for (
unsigned int n = 0; n < spacedim; ++n)
803 for (
unsigned int i = 0; i < spacedim; ++i)
804 for (
unsigned int j = 0; j < spacedim; ++j)
806 fe_data.transformed_shape_hessians[k][
d][i][j] +=
807 (output_data.shape_values(
first + n, k) *
809 .jacobian_pushed_forward_2nd_derivatives
811 (output_data.shape_gradients[
first + n][k][i] *
813 .jacobian_pushed_forward_grads[k][
d][n][j]) +
814 (output_data.shape_gradients[
first + n][k][j] *
816 .jacobian_pushed_forward_grads[k][
d][i][n]) -
817 (output_data.shape_gradients[
first +
d][k][n] *
819 .jacobian_pushed_forward_grads[k][n][i][j]);
821 fe_data.transformed_shape_hessians[k][
d][i][j] -=
822 (output_data.shape_values(
first +
d, k) *
824 .jacobian_pushed_forward_2nd_derivatives
826 (output_data.shape_gradients[
first +
d][k][i] *
828 .jacobian_pushed_forward_grads[k][n][n][j]) +
829 (output_data.shape_gradients[
first +
d][k][j] *
831 .jacobian_pushed_forward_grads[k][n][n][i]);
833 for (
unsigned int m = 0; m < spacedim; ++m)
836 .transformed_shape_hessians[k][
d][i][j] -=
838 .jacobian_pushed_forward_grads[k][
d][i]
841 .jacobian_pushed_forward_grads[k][m][n]
843 output_data.shape_values(
first + n, k)) +
845 .jacobian_pushed_forward_grads[k][
d][m]
848 .jacobian_pushed_forward_grads[k][m][i]
850 output_data.shape_values(
first + n, k));
853 .transformed_shape_hessians[k][
d][i][j] +=
855 .jacobian_pushed_forward_grads[k][n][i]
858 .jacobian_pushed_forward_grads[k][m][n]
860 output_data.shape_values(
first +
d, k)) +
862 .jacobian_pushed_forward_grads[k][n][m]
865 .jacobian_pushed_forward_grads[k][m][i]
867 output_data.shape_values(
first +
d, k));
871 for (
unsigned int k = 0; k < n_q_points; ++k)
872 for (
unsigned int d = 0;
d < dim; ++
d)
873 output_data.shape_hessians[
first +
d][k] =
874 fe_data.sign_change[i] *
875 fe_data.transformed_shape_hessians[k][
d];
882 for (
unsigned int k = 0; k < n_q_points; ++k)
883 fe_data.untransformed_shape_hessian_tensors[k] =
884 fe_data.shape_grad_grads[i][k];
888 fe_data.untransformed_shape_hessian_tensors),
893 for (
unsigned int k = 0; k < n_q_points; ++k)
894 for (
unsigned int d = 0;
d < spacedim; ++
d)
895 for (
unsigned int n = 0; n < spacedim; ++n)
896 for (
unsigned int i = 0; i < spacedim; ++i)
897 for (
unsigned int j = 0; j < spacedim; ++j)
899 fe_data.transformed_shape_hessians[k][
d][i][j] -=
900 (output_data.shape_values(
first + n, k) *
902 .jacobian_pushed_forward_2nd_derivatives
904 (output_data.shape_gradients[
first +
d][k][n] *
906 .jacobian_pushed_forward_grads[k][n][i][j]) +
907 (output_data.shape_gradients[
first + n][k][i] *
909 .jacobian_pushed_forward_grads[k][n][
d][j]) +
910 (output_data.shape_gradients[
first + n][k][j] *
912 .jacobian_pushed_forward_grads[k][n][i][
d]);
915 for (
unsigned int k = 0; k < n_q_points; ++k)
916 for (
unsigned int d = 0;
d < dim; ++
d)
917 output_data.shape_hessians[
first +
d][k] =
918 fe_data.sign_change[i] *
919 fe_data.transformed_shape_hessians[k][
d];
943 template <
int dim,
int spacedim>
947 const unsigned int face_no,
951 const ::internal::FEValuesImplementation::MappingRelatedData<dim,
963 Assert(
dynamic_cast<const InternalData *
>(&fe_internal) !=
nullptr,
965 const InternalData &fe_data =
static_cast<const InternalData &
>(fe_internal);
967 const unsigned int n_q_points = quadrature.
size();
974 cell->face_orientation(face_no),
975 cell->face_flip(face_no),
976 cell->face_rotation(face_no),
987 std::fill(fe_data.sign_change.begin(), fe_data.sign_change.end(), 1.0);
989 internal::FE_PolyTensor::get_face_sign_change_rt(cell,
992 fe_data.sign_change);
994 internal::FE_PolyTensor::get_face_sign_change_nedelec(cell,
997 fe_data.sign_change);
999 for (
unsigned int i = 0; i < this->dofs_per_cell; ++i)
1001 const MappingKind mapping_kind = get_mapping_kind(i);
1003 const unsigned int first =
1004 output_data.shape_function_to_row_table[i * this->
n_components() +
1005 this->get_nonzero_components(i)
1006 .first_selected_component()];
1010 switch (mapping_kind)
1014 for (
unsigned int k = 0; k < n_q_points; ++k)
1015 for (
unsigned int d = 0;
d < dim; ++
d)
1016 output_data.shape_values(
first +
d, k) =
1017 fe_data.shape_values[i][k + offset][
d];
1025 transformed_shape_values =
1035 transformed_shape_values);
1037 for (
unsigned int k = 0; k < n_q_points; ++k)
1038 for (
unsigned int d = 0;
d < dim; ++
d)
1039 output_data.shape_values(
first +
d, k) =
1040 transformed_shape_values[k][
d];
1048 transformed_shape_values =
1058 transformed_shape_values);
1059 for (
unsigned int k = 0; k < n_q_points; ++k)
1060 for (
unsigned int d = 0;
d < dim; ++
d)
1061 output_data.shape_values(
first +
d, k) =
1062 fe_data.sign_change[i] * transformed_shape_values[k][
d];
1069 transformed_shape_values =
1079 transformed_shape_values);
1081 for (
unsigned int k = 0; k < n_q_points; ++k)
1082 for (
unsigned int d = 0;
d < dim; ++
d)
1083 output_data.shape_values(
first +
d, k) =
1084 fe_data.sign_change[i] * transformed_shape_values[k][
d];
1096 switch (mapping_kind)
1108 transformed_shape_grads);
1109 for (
unsigned int k = 0; k < n_q_points; ++k)
1110 for (
unsigned int d = 0;
d < dim; ++
d)
1111 output_data.shape_gradients[
first +
d][k] =
1112 transformed_shape_grads[k][
d];
1126 transformed_shape_grads);
1128 for (
unsigned int k = 0; k < n_q_points; ++k)
1129 for (
unsigned int d = 0;
d < spacedim; ++
d)
1130 for (
unsigned int n = 0; n < spacedim; ++n)
1131 transformed_shape_grads[k][
d] -=
1132 output_data.shape_values(
first + n, k) *
1133 mapping_data.jacobian_pushed_forward_grads[k][n][
d];
1135 for (
unsigned int k = 0; k < n_q_points; ++k)
1136 for (
unsigned int d = 0;
d < dim; ++
d)
1137 output_data.shape_gradients[
first +
d][k] =
1138 transformed_shape_grads[k][
d];
1148 for (
unsigned int k = 0; k < n_q_points; ++k)
1149 fe_data.untransformed_shape_grads[k + offset] =
1150 fe_data.shape_grads[i][k + offset];
1157 transformed_shape_grads);
1159 for (
unsigned int k = 0; k < n_q_points; ++k)
1160 for (
unsigned int d = 0;
d < spacedim; ++
d)
1161 for (
unsigned int n = 0; n < spacedim; ++n)
1162 transformed_shape_grads[k][
d] +=
1163 output_data.shape_values(
first + n, k) *
1164 mapping_data.jacobian_pushed_forward_grads[k][
d][n];
1166 for (
unsigned int k = 0; k < n_q_points; ++k)
1167 for (
unsigned int d = 0;
d < dim; ++
d)
1168 output_data.shape_gradients[
first +
d][k] =
1169 transformed_shape_grads[k][
d];
1181 for (
unsigned int k = 0; k < n_q_points; ++k)
1182 fe_data.untransformed_shape_grads[k + offset] =
1183 fe_data.shape_grads[i][k + offset];
1190 transformed_shape_grads);
1192 for (
unsigned int k = 0; k < n_q_points; ++k)
1193 for (
unsigned int d = 0;
d < spacedim; ++
d)
1194 for (
unsigned int n = 0; n < spacedim; ++n)
1195 transformed_shape_grads[k][
d] +=
1196 (output_data.shape_values(
first + n, k) *
1198 .jacobian_pushed_forward_grads[k][
d][n]) -
1199 (output_data.shape_values(
first +
d, k) *
1200 mapping_data.jacobian_pushed_forward_grads[k][n][n]);
1202 for (
unsigned int k = 0; k < n_q_points; ++k)
1203 for (
unsigned int d = 0;
d < dim; ++
d)
1204 output_data.shape_gradients[
first +
d][k] =
1205 fe_data.sign_change[i] * transformed_shape_grads[k][
d];
1222 for (
unsigned int k = 0; k < n_q_points; ++k)
1223 fe_data.untransformed_shape_grads[k + offset] =
1224 fe_data.shape_grads[i][k + offset];
1236 transformed_shape_grads);
1238 for (
unsigned int k = 0; k < n_q_points; ++k)
1239 for (
unsigned int d = 0;
d < spacedim; ++
d)
1240 for (
unsigned int n = 0; n < spacedim; ++n)
1241 transformed_shape_grads[k][
d] -=
1242 output_data.shape_values(
first + n, k) *
1243 mapping_data.jacobian_pushed_forward_grads[k][n][
d];
1245 for (
unsigned int k = 0; k < n_q_points; ++k)
1246 for (
unsigned int d = 0;
d < dim; ++
d)
1247 output_data.shape_gradients[
first +
d][k] =
1248 fe_data.sign_change[i] * transformed_shape_grads[k][
d];
1260 switch (mapping_kind)
1265 transformed_shape_hessians =
1275 transformed_shape_hessians);
1277 for (
unsigned int k = 0; k < n_q_points; ++k)
1278 for (
unsigned int d = 0;
d < spacedim; ++
d)
1279 for (
unsigned int n = 0; n < spacedim; ++n)
1280 transformed_shape_hessians[k][
d] -=
1281 output_data.shape_gradients[
first +
d][k][n] *
1282 mapping_data.jacobian_pushed_forward_grads[k][n];
1284 for (
unsigned int k = 0; k < n_q_points; ++k)
1285 for (
unsigned int d = 0;
d < dim; ++
d)
1286 output_data.shape_hessians[
first +
d][k] =
1287 transformed_shape_hessians[k][
d];
1293 for (
unsigned int k = 0; k < n_q_points; ++k)
1294 fe_data.untransformed_shape_hessian_tensors[k + offset] =
1295 fe_data.shape_grad_grads[i][k + offset];
1298 transformed_shape_hessians =
1308 transformed_shape_hessians);
1310 for (
unsigned int k = 0; k < n_q_points; ++k)
1311 for (
unsigned int d = 0;
d < spacedim; ++
d)
1312 for (
unsigned int n = 0; n < spacedim; ++n)
1313 for (
unsigned int i = 0; i < spacedim; ++i)
1314 for (
unsigned int j = 0; j < spacedim; ++j)
1316 transformed_shape_hessians[k][
d][i][j] -=
1317 (output_data.shape_values(
first + n, k) *
1319 .jacobian_pushed_forward_2nd_derivatives
1321 (output_data.shape_gradients[
first +
d][k][n] *
1323 .jacobian_pushed_forward_grads[k][n][i][j]) +
1324 (output_data.shape_gradients[
first + n][k][i] *
1326 .jacobian_pushed_forward_grads[k][n][
d][j]) +
1327 (output_data.shape_gradients[
first + n][k][j] *
1329 .jacobian_pushed_forward_grads[k][n][i][
d]);
1332 for (
unsigned int k = 0; k < n_q_points; ++k)
1333 for (
unsigned int d = 0;
d < dim; ++
d)
1334 output_data.shape_hessians[
first +
d][k] =
1335 transformed_shape_hessians[k][
d];
1342 for (
unsigned int k = 0; k < n_q_points; ++k)
1343 fe_data.untransformed_shape_hessian_tensors[k + offset] =
1344 fe_data.shape_grad_grads[i][k + offset];
1347 transformed_shape_hessians =
1357 transformed_shape_hessians);
1359 for (
unsigned int k = 0; k < n_q_points; ++k)
1360 for (
unsigned int d = 0;
d < spacedim; ++
d)
1361 for (
unsigned int n = 0; n < spacedim; ++n)
1362 for (
unsigned int i = 0; i < spacedim; ++i)
1363 for (
unsigned int j = 0; j < spacedim; ++j)
1365 transformed_shape_hessians[k][
d][i][j] +=
1366 (output_data.shape_values(
first + n, k) *
1368 .jacobian_pushed_forward_2nd_derivatives
1370 (output_data.shape_gradients[
first + n][k][i] *
1372 .jacobian_pushed_forward_grads[k][
d][n][j]) +
1373 (output_data.shape_gradients[
first + n][k][j] *
1375 .jacobian_pushed_forward_grads[k][
d][i][n]) -
1376 (output_data.shape_gradients[
first +
d][k][n] *
1378 .jacobian_pushed_forward_grads[k][n][i][j]);
1379 for (
unsigned int m = 0; m < spacedim; ++m)
1380 transformed_shape_hessians[k][
d][i][j] -=
1382 .jacobian_pushed_forward_grads[k][
d][i]
1385 .jacobian_pushed_forward_grads[k][m][n]
1387 output_data.shape_values(
first + n, k)) +
1389 .jacobian_pushed_forward_grads[k][
d][m]
1392 .jacobian_pushed_forward_grads[k][m][i]
1394 output_data.shape_values(
first + n, k));
1397 for (
unsigned int k = 0; k < n_q_points; ++k)
1398 for (
unsigned int d = 0;
d < dim; ++
d)
1399 output_data.shape_hessians[
first +
d][k] =
1400 transformed_shape_hessians[k][
d];
1408 for (
unsigned int k = 0; k < n_q_points; ++k)
1409 fe_data.untransformed_shape_hessian_tensors[k + offset] =
1410 fe_data.shape_grad_grads[i][k + offset];
1413 transformed_shape_hessians =
1423 transformed_shape_hessians);
1425 for (
unsigned int k = 0; k < n_q_points; ++k)
1426 for (
unsigned int d = 0;
d < spacedim; ++
d)
1427 for (
unsigned int n = 0; n < spacedim; ++n)
1428 for (
unsigned int i = 0; i < spacedim; ++i)
1429 for (
unsigned int j = 0; j < spacedim; ++j)
1431 transformed_shape_hessians[k][
d][i][j] +=
1432 (output_data.shape_values(
first + n, k) *
1434 .jacobian_pushed_forward_2nd_derivatives
1436 (output_data.shape_gradients[
first + n][k][i] *
1438 .jacobian_pushed_forward_grads[k][
d][n][j]) +
1439 (output_data.shape_gradients[
first + n][k][j] *
1441 .jacobian_pushed_forward_grads[k][
d][i][n]) -
1442 (output_data.shape_gradients[
first +
d][k][n] *
1444 .jacobian_pushed_forward_grads[k][n][i][j]);
1446 transformed_shape_hessians[k][
d][i][j] -=
1447 (output_data.shape_values(
first +
d, k) *
1449 .jacobian_pushed_forward_2nd_derivatives
1451 (output_data.shape_gradients[
first +
d][k][i] *
1453 .jacobian_pushed_forward_grads[k][n][n][j]) +
1454 (output_data.shape_gradients[
first +
d][k][j] *
1456 .jacobian_pushed_forward_grads[k][n][n][i]);
1458 for (
unsigned int m = 0; m < spacedim; ++m)
1460 transformed_shape_hessians[k][
d][i][j] -=
1462 .jacobian_pushed_forward_grads[k][
d][i]
1465 .jacobian_pushed_forward_grads[k][m][n]
1467 output_data.shape_values(
first + n, k)) +
1469 .jacobian_pushed_forward_grads[k][
d][m]
1472 .jacobian_pushed_forward_grads[k][m][i]
1474 output_data.shape_values(
first + n, k));
1476 transformed_shape_hessians[k][
d][i][j] +=
1478 .jacobian_pushed_forward_grads[k][n][i]
1481 .jacobian_pushed_forward_grads[k][m][n]
1483 output_data.shape_values(
first +
d, k)) +
1485 .jacobian_pushed_forward_grads[k][n][m]
1488 .jacobian_pushed_forward_grads[k][m][i]
1490 output_data.shape_values(
first +
d, k));
1494 for (
unsigned int k = 0; k < n_q_points; ++k)
1495 for (
unsigned int d = 0;
d < dim; ++
d)
1496 output_data.shape_hessians[
first +
d][k] =
1497 fe_data.sign_change[i] *
1498 transformed_shape_hessians[k][
d];
1505 for (
unsigned int k = 0; k < n_q_points; ++k)
1506 fe_data.untransformed_shape_hessian_tensors[k + offset] =
1507 fe_data.shape_grad_grads[i][k + offset];
1510 transformed_shape_hessians =
1520 transformed_shape_hessians);
1522 for (
unsigned int k = 0; k < n_q_points; ++k)
1523 for (
unsigned int d = 0;
d < spacedim; ++
d)
1524 for (
unsigned int n = 0; n < spacedim; ++n)
1525 for (
unsigned int i = 0; i < spacedim; ++i)
1526 for (
unsigned int j = 0; j < spacedim; ++j)
1528 transformed_shape_hessians[k][
d][i][j] -=
1529 (output_data.shape_values(
first + n, k) *
1531 .jacobian_pushed_forward_2nd_derivatives
1533 (output_data.shape_gradients[
first +
d][k][n] *
1535 .jacobian_pushed_forward_grads[k][n][i][j]) +
1536 (output_data.shape_gradients[
first + n][k][i] *
1538 .jacobian_pushed_forward_grads[k][n][
d][j]) +
1539 (output_data.shape_gradients[
first + n][k][j] *
1541 .jacobian_pushed_forward_grads[k][n][i][
d]);
1544 for (
unsigned int k = 0; k < n_q_points; ++k)
1545 for (
unsigned int d = 0;
d < dim; ++
d)
1546 output_data.shape_hessians[
first +
d][k] =
1547 fe_data.sign_change[i] *
1548 transformed_shape_hessians[k][
d];
1568 template <
int dim,
int spacedim>
1572 const unsigned int face_no,
1573 const unsigned int sub_no,
1577 const ::internal::FEValuesImplementation::MappingRelatedData<dim,
1589 Assert(
dynamic_cast<const InternalData *
>(&fe_internal) !=
nullptr,
1591 const InternalData &fe_data =
static_cast<const InternalData &
>(fe_internal);
1593 const unsigned int n_q_points = quadrature.
size();
1601 cell->face_orientation(face_no),
1602 cell->face_flip(face_no),
1603 cell->face_rotation(face_no),
1605 cell->subface_case(face_no));
1617 std::fill(fe_data.sign_change.begin(), fe_data.sign_change.end(), 1.0);
1619 internal::FE_PolyTensor::get_face_sign_change_rt(cell,
1622 fe_data.sign_change);
1624 internal::FE_PolyTensor::get_face_sign_change_nedelec(cell,
1627 fe_data.sign_change);
1629 for (
unsigned int i = 0; i < this->dofs_per_cell; ++i)
1631 const MappingKind mapping_kind = get_mapping_kind(i);
1633 const unsigned int first =
1634 output_data.shape_function_to_row_table[i * this->
n_components() +
1635 this->get_nonzero_components(i)
1636 .first_selected_component()];
1640 switch (mapping_kind)
1644 for (
unsigned int k = 0; k < n_q_points; ++k)
1645 for (
unsigned int d = 0;
d < dim; ++
d)
1646 output_data.shape_values(
first +
d, k) =
1647 fe_data.shape_values[i][k + offset][
d];
1655 transformed_shape_values =
1665 transformed_shape_values);
1667 for (
unsigned int k = 0; k < n_q_points; ++k)
1668 for (
unsigned int d = 0;
d < dim; ++
d)
1669 output_data.shape_values(
first +
d, k) =
1670 transformed_shape_values[k][
d];
1679 transformed_shape_values =
1690 transformed_shape_values);
1691 for (
unsigned int k = 0; k < n_q_points; ++k)
1692 for (
unsigned int d = 0;
d < dim; ++
d)
1693 output_data.shape_values(
first +
d, k) =
1694 fe_data.sign_change[i] * transformed_shape_values[k][
d];
1701 transformed_shape_values =
1712 transformed_shape_values);
1714 for (
unsigned int k = 0; k < n_q_points; ++k)
1715 for (
unsigned int d = 0;
d < dim; ++
d)
1716 output_data.shape_values(
first +
d, k) =
1717 fe_data.sign_change[i] * transformed_shape_values[k][
d];
1733 switch (mapping_kind)
1741 transformed_shape_grads);
1742 for (
unsigned int k = 0; k < n_q_points; ++k)
1743 for (
unsigned int d = 0;
d < dim; ++
d)
1744 output_data.shape_gradients[
first +
d][k] =
1745 transformed_shape_grads[k][
d];
1755 transformed_shape_grads);
1757 for (
unsigned int k = 0; k < n_q_points; ++k)
1758 for (
unsigned int d = 0;
d < spacedim; ++
d)
1759 for (
unsigned int n = 0; n < spacedim; ++n)
1760 transformed_shape_grads[k][
d] -=
1761 output_data.shape_values(
first + n, k) *
1762 mapping_data.jacobian_pushed_forward_grads[k][n][
d];
1764 for (
unsigned int k = 0; k < n_q_points; ++k)
1765 for (
unsigned int d = 0;
d < dim; ++
d)
1766 output_data.shape_gradients[
first +
d][k] =
1767 transformed_shape_grads[k][
d];
1774 for (
unsigned int k = 0; k < n_q_points; ++k)
1775 fe_data.untransformed_shape_grads[k + offset] =
1776 fe_data.shape_grads[i][k + offset];
1784 transformed_shape_grads);
1786 for (
unsigned int k = 0; k < n_q_points; ++k)
1787 for (
unsigned int d = 0;
d < spacedim; ++
d)
1788 for (
unsigned int n = 0; n < spacedim; ++n)
1789 transformed_shape_grads[k][
d] +=
1790 output_data.shape_values(
first + n, k) *
1791 mapping_data.jacobian_pushed_forward_grads[k][
d][n];
1793 for (
unsigned int k = 0; k < n_q_points; ++k)
1794 for (
unsigned int d = 0;
d < dim; ++
d)
1795 output_data.shape_gradients[
first +
d][k] =
1796 transformed_shape_grads[k][
d];
1804 for (
unsigned int k = 0; k < n_q_points; ++k)
1805 fe_data.untransformed_shape_grads[k + offset] =
1806 fe_data.shape_grads[i][k + offset];
1814 transformed_shape_grads);
1816 for (
unsigned int k = 0; k < n_q_points; ++k)
1817 for (
unsigned int d = 0;
d < spacedim; ++
d)
1818 for (
unsigned int n = 0; n < spacedim; ++n)
1819 transformed_shape_grads[k][
d] +=
1820 (output_data.shape_values(
first + n, k) *
1822 .jacobian_pushed_forward_grads[k][
d][n]) -
1823 (output_data.shape_values(
first +
d, k) *
1824 mapping_data.jacobian_pushed_forward_grads[k][n][n]);
1826 for (
unsigned int k = 0; k < n_q_points; ++k)
1827 for (
unsigned int d = 0;
d < dim; ++
d)
1828 output_data.shape_gradients[
first +
d][k] =
1829 fe_data.sign_change[i] * transformed_shape_grads[k][
d];
1845 for (
unsigned int k = 0; k < n_q_points; ++k)
1846 fe_data.untransformed_shape_grads[k + offset] =
1847 fe_data.shape_grads[i][k + offset];
1855 transformed_shape_grads);
1857 for (
unsigned int k = 0; k < n_q_points; ++k)
1858 for (
unsigned int d = 0;
d < spacedim; ++
d)
1859 for (
unsigned int n = 0; n < spacedim; ++n)
1860 transformed_shape_grads[k][
d] -=
1861 output_data.shape_values(
first + n, k) *
1862 mapping_data.jacobian_pushed_forward_grads[k][n][
d];
1864 for (
unsigned int k = 0; k < n_q_points; ++k)
1865 for (
unsigned int d = 0;
d < dim; ++
d)
1866 output_data.shape_gradients[
first +
d][k] =
1867 fe_data.sign_change[i] * transformed_shape_grads[k][
d];
1879 switch (mapping_kind)
1884 transformed_shape_hessians =
1894 transformed_shape_hessians);
1896 for (
unsigned int k = 0; k < n_q_points; ++k)
1897 for (
unsigned int d = 0;
d < spacedim; ++
d)
1898 for (
unsigned int n = 0; n < spacedim; ++n)
1899 transformed_shape_hessians[k][
d] -=
1900 output_data.shape_gradients[
first +
d][k][n] *
1901 mapping_data.jacobian_pushed_forward_grads[k][n];
1903 for (
unsigned int k = 0; k < n_q_points; ++k)
1904 for (
unsigned int d = 0;
d < dim; ++
d)
1905 output_data.shape_hessians[
first +
d][k] =
1906 transformed_shape_hessians[k][
d];
1912 for (
unsigned int k = 0; k < n_q_points; ++k)
1913 fe_data.untransformed_shape_hessian_tensors[k + offset] =
1914 fe_data.shape_grad_grads[i][k + offset];
1917 transformed_shape_hessians =
1927 transformed_shape_hessians);
1929 for (
unsigned int k = 0; k < n_q_points; ++k)
1930 for (
unsigned int d = 0;
d < spacedim; ++
d)
1931 for (
unsigned int n = 0; n < spacedim; ++n)
1932 for (
unsigned int i = 0; i < spacedim; ++i)
1933 for (
unsigned int j = 0; j < spacedim; ++j)
1935 transformed_shape_hessians[k][
d][i][j] -=
1936 (output_data.shape_values(
first + n, k) *
1938 .jacobian_pushed_forward_2nd_derivatives
1940 (output_data.shape_gradients[
first +
d][k][n] *
1942 .jacobian_pushed_forward_grads[k][n][i][j]) +
1943 (output_data.shape_gradients[
first + n][k][i] *
1945 .jacobian_pushed_forward_grads[k][n][
d][j]) +
1946 (output_data.shape_gradients[
first + n][k][j] *
1948 .jacobian_pushed_forward_grads[k][n][i][
d]);
1951 for (
unsigned int k = 0; k < n_q_points; ++k)
1952 for (
unsigned int d = 0;
d < dim; ++
d)
1953 output_data.shape_hessians[
first +
d][k] =
1954 transformed_shape_hessians[k][
d];
1961 for (
unsigned int k = 0; k < n_q_points; ++k)
1962 fe_data.untransformed_shape_hessian_tensors[k + offset] =
1963 fe_data.shape_grad_grads[i][k + offset];
1966 transformed_shape_hessians =
1976 transformed_shape_hessians);
1978 for (
unsigned int k = 0; k < n_q_points; ++k)
1979 for (
unsigned int d = 0;
d < spacedim; ++
d)
1980 for (
unsigned int n = 0; n < spacedim; ++n)
1981 for (
unsigned int i = 0; i < spacedim; ++i)
1982 for (
unsigned int j = 0; j < spacedim; ++j)
1984 transformed_shape_hessians[k][
d][i][j] +=
1985 (output_data.shape_values(
first + n, k) *
1987 .jacobian_pushed_forward_2nd_derivatives
1989 (output_data.shape_gradients[
first + n][k][i] *
1991 .jacobian_pushed_forward_grads[k][
d][n][j]) +
1992 (output_data.shape_gradients[
first + n][k][j] *
1994 .jacobian_pushed_forward_grads[k][
d][i][n]) -
1995 (output_data.shape_gradients[
first +
d][k][n] *
1997 .jacobian_pushed_forward_grads[k][n][i][j]);
1998 for (
unsigned int m = 0; m < spacedim; ++m)
1999 transformed_shape_hessians[k][
d][i][j] -=
2001 .jacobian_pushed_forward_grads[k][
d][i]
2004 .jacobian_pushed_forward_grads[k][m][n]
2006 output_data.shape_values(
first + n, k)) +
2008 .jacobian_pushed_forward_grads[k][
d][m]
2011 .jacobian_pushed_forward_grads[k][m][i]
2013 output_data.shape_values(
first + n, k));
2016 for (
unsigned int k = 0; k < n_q_points; ++k)
2017 for (
unsigned int d = 0;
d < dim; ++
d)
2018 output_data.shape_hessians[
first +
d][k] =
2019 transformed_shape_hessians[k][
d];
2027 for (
unsigned int k = 0; k < n_q_points; ++k)
2028 fe_data.untransformed_shape_hessian_tensors[k + offset] =
2029 fe_data.shape_grad_grads[i][k + offset];
2032 transformed_shape_hessians =
2042 transformed_shape_hessians);
2044 for (
unsigned int k = 0; k < n_q_points; ++k)
2045 for (
unsigned int d = 0;
d < spacedim; ++
d)
2046 for (
unsigned int n = 0; n < spacedim; ++n)
2047 for (
unsigned int i = 0; i < spacedim; ++i)
2048 for (
unsigned int j = 0; j < spacedim; ++j)
2050 transformed_shape_hessians[k][
d][i][j] +=
2051 (output_data.shape_values(
first + n, k) *
2053 .jacobian_pushed_forward_2nd_derivatives
2055 (output_data.shape_gradients[
first + n][k][i] *
2057 .jacobian_pushed_forward_grads[k][
d][n][j]) +
2058 (output_data.shape_gradients[
first + n][k][j] *
2060 .jacobian_pushed_forward_grads[k][
d][i][n]) -
2061 (output_data.shape_gradients[
first +
d][k][n] *
2063 .jacobian_pushed_forward_grads[k][n][i][j]);
2065 transformed_shape_hessians[k][
d][i][j] -=
2066 (output_data.shape_values(
first +
d, k) *
2068 .jacobian_pushed_forward_2nd_derivatives
2070 (output_data.shape_gradients[
first +
d][k][i] *
2072 .jacobian_pushed_forward_grads[k][n][n][j]) +
2073 (output_data.shape_gradients[
first +
d][k][j] *
2075 .jacobian_pushed_forward_grads[k][n][n][i]);
2076 for (
unsigned int m = 0; m < spacedim; ++m)
2078 transformed_shape_hessians[k][
d][i][j] -=
2080 .jacobian_pushed_forward_grads[k][
d][i]
2083 .jacobian_pushed_forward_grads[k][m][n]
2085 output_data.shape_values(
first + n, k)) +
2087 .jacobian_pushed_forward_grads[k][
d][m]
2090 .jacobian_pushed_forward_grads[k][m][i]
2092 output_data.shape_values(
first + n, k));
2094 transformed_shape_hessians[k][
d][i][j] +=
2096 .jacobian_pushed_forward_grads[k][n][i]
2099 .jacobian_pushed_forward_grads[k][m][n]
2101 output_data.shape_values(
first +
d, k)) +
2103 .jacobian_pushed_forward_grads[k][n][m]
2106 .jacobian_pushed_forward_grads[k][m][i]
2108 output_data.shape_values(
first +
d, k));
2112 for (
unsigned int k = 0; k < n_q_points; ++k)
2113 for (
unsigned int d = 0;
d < dim; ++
d)
2114 output_data.shape_hessians[
first +
d][k] =
2115 fe_data.sign_change[i] *
2116 transformed_shape_hessians[k][
d];
2123 for (
unsigned int k = 0; k < n_q_points; ++k)
2124 fe_data.untransformed_shape_hessian_tensors[k + offset] =
2125 fe_data.shape_grad_grads[i][k + offset];
2128 transformed_shape_hessians =
2138 transformed_shape_hessians);
2140 for (
unsigned int k = 0; k < n_q_points; ++k)
2141 for (
unsigned int d = 0;
d < spacedim; ++
d)
2142 for (
unsigned int n = 0; n < spacedim; ++n)
2143 for (
unsigned int i = 0; i < spacedim; ++i)
2144 for (
unsigned int j = 0; j < spacedim; ++j)
2146 transformed_shape_hessians[k][
d][i][j] -=
2147 (output_data.shape_values(
first + n, k) *
2149 .jacobian_pushed_forward_2nd_derivatives
2151 (output_data.shape_gradients[
first +
d][k][n] *
2153 .jacobian_pushed_forward_grads[k][n][i][j]) +
2154 (output_data.shape_gradients[
first + n][k][i] *
2156 .jacobian_pushed_forward_grads[k][n][
d][j]) +
2157 (output_data.shape_gradients[
first + n][k][j] *
2159 .jacobian_pushed_forward_grads[k][n][i][
d]);
2162 for (
unsigned int k = 0; k < n_q_points; ++k)
2163 for (
unsigned int d = 0;
d < dim; ++
d)
2164 output_data.shape_hessians[
first +
d][k] =
2165 fe_data.sign_change[i] *
2166 transformed_shape_hessians[k][
d];
2186 template <
int dim,
int spacedim>
2193 for (
unsigned int i = 0; i < this->dofs_per_cell; ++i)
2195 const MappingKind mapping_kind = get_mapping_kind(i);
2197 switch (mapping_kind)
2288 #include "fe_poly_tensor.inst"