675 namespace MappingFEFieldImplementation
685 template <
int dim,
int spacedim,
typename VectorType>
687 maybe_compute_q_points(
688 const typename ::QProjector<dim>::DataSetDescriptor data_set,
689 const typename ::MappingFEField<dim, spacedim, VectorType>::
693 const std::vector<unsigned int> &fe_to_real,
694 std::vector<Point<spacedim>> &quadrature_points)
700 for (
unsigned int point = 0; point < quadrature_points.size();
704 const double *shape = &data.shape(point + data_set, 0);
706 for (
unsigned int k = 0; k < data.n_shape_functions; ++k)
708 const unsigned int comp_k =
709 fe.system_to_component_index(k).first;
711 result[fe_to_real[comp_k]] +=
712 data.local_dof_values[k] * shape[k];
715 quadrature_points[point] = result;
727 template <
int dim,
int spacedim,
typename VectorType>
729 maybe_update_Jacobians(
730 const typename ::QProjector<dim>::DataSetDescriptor data_set,
731 const typename ::MappingFEField<dim, spacedim, VectorType>::
735 const std::vector<unsigned int> &fe_to_real)
742 const unsigned int n_q_points = data.contravariant.size();
746 for (
unsigned int point = 0; point < n_q_points; ++point)
749 &data.derivative(point + data_set, 0);
753 for (
unsigned int k = 0; k < data.n_shape_functions; ++k)
755 const unsigned int comp_k =
756 fe.system_to_component_index(k).first;
758 result[fe_to_real[comp_k]] +=
759 data.local_dof_values[k] * data_derv[k];
763 for (
unsigned int i = 0; i < spacedim; ++i)
765 data.contravariant[point][i] = result[i];
773 for (
unsigned int point = 0; point < data.contravariant.size();
775 data.covariant[point] =
776 (data.contravariant[point]).covariant_form();
782 data.volume_elements.size());
783 for (
unsigned int point = 0; point < data.contravariant.size();
785 data.volume_elements[point] =
786 data.contravariant[point].determinant();
796 template <
int dim,
int spacedim,
typename VectorType>
798 maybe_update_jacobian_grads(
799 const typename ::QProjector<dim>::DataSetDescriptor data_set,
800 const typename ::MappingFEField<dim, spacedim, VectorType>::
804 const std::vector<unsigned int> &fe_to_real,
805 std::vector<DerivativeForm<2, dim, spacedim>> &jacobian_grads)
810 const unsigned int n_q_points = jacobian_grads.size();
812 for (
unsigned int point = 0; point < n_q_points; ++point)
815 &data.second_derivative(point + data_set, 0);
819 for (
unsigned int k = 0; k < data.n_shape_functions; ++k)
821 const unsigned int comp_k =
822 fe.system_to_component_index(k).first;
824 for (
unsigned int j = 0; j < dim; ++j)
825 for (
unsigned int l = 0; l < dim; ++l)
826 result[fe_to_real[comp_k]][j][l] +=
827 (
second[k][j][l] * data.local_dof_values[k]);
832 for (
unsigned int i = 0; i < spacedim; ++i)
833 for (
unsigned int j = 0; j < dim; ++j)
834 for (
unsigned int l = 0; l < dim; ++l)
835 jacobian_grads[point][i][j][l] = result[i][j][l];
846 template <
int dim,
int spacedim,
typename VectorType>
848 maybe_update_jacobian_pushed_forward_grads(
849 const typename ::QProjector<dim>::DataSetDescriptor data_set,
850 const typename ::MappingFEField<dim, spacedim, VectorType>::
854 const std::vector<unsigned int> &fe_to_real,
855 std::vector<Tensor<3, spacedim>> &jacobian_pushed_forward_grads)
860 const unsigned int n_q_points =
861 jacobian_pushed_forward_grads.size();
863 double tmp[spacedim][spacedim][spacedim];
864 for (
unsigned int point = 0; point < n_q_points; ++point)
867 &data.second_derivative(point + data_set, 0);
871 for (
unsigned int k = 0; k < data.n_shape_functions; ++k)
873 const unsigned int comp_k =
874 fe.system_to_component_index(k).first;
876 for (
unsigned int j = 0; j < dim; ++j)
877 for (
unsigned int l = 0; l < dim; ++l)
878 result[fe_to_real[comp_k]][j][l] +=
879 (
second[k][j][l] * data.local_dof_values[k]);
883 for (
unsigned int i = 0; i < spacedim; ++i)
884 for (
unsigned int j = 0; j < spacedim; ++j)
885 for (
unsigned int l = 0; l < dim; ++l)
888 result[i][0][l] * data.covariant[point][j][0];
889 for (
unsigned int jr = 1; jr < dim; ++jr)
892 result[i][jr][l] * data.covariant[point][j][jr];
897 for (
unsigned int i = 0; i < spacedim; ++i)
898 for (
unsigned int j = 0; j < spacedim; ++j)
899 for (
unsigned int l = 0; l < spacedim; ++l)
901 jacobian_pushed_forward_grads[point][i][j][l] =
902 tmp[i][j][0] * data.covariant[point][l][0];
903 for (
unsigned int lr = 1; lr < dim; ++lr)
905 jacobian_pushed_forward_grads[point][i][j][l] +=
906 tmp[i][j][lr] * data.covariant[point][l][lr];
919 template <
int dim,
int spacedim,
typename VectorType>
921 maybe_update_jacobian_2nd_derivatives(
922 const typename ::QProjector<dim>::DataSetDescriptor data_set,
923 const typename ::MappingFEField<dim, spacedim, VectorType>::
927 const std::vector<unsigned int> &fe_to_real,
928 std::vector<DerivativeForm<3, dim, spacedim>> &jacobian_2nd_derivatives)
933 const unsigned int n_q_points = jacobian_2nd_derivatives.size();
935 for (
unsigned int point = 0; point < n_q_points; ++point)
938 &data.third_derivative(point + data_set, 0);
942 for (
unsigned int k = 0; k < data.n_shape_functions; ++k)
944 const unsigned int comp_k =
945 fe.system_to_component_index(k).first;
947 for (
unsigned int j = 0; j < dim; ++j)
948 for (
unsigned int l = 0; l < dim; ++l)
949 for (
unsigned int m = 0; m < dim; ++m)
950 result[fe_to_real[comp_k]][j][l][m] +=
951 (third[k][j][l][m] * data.local_dof_values[k]);
956 for (
unsigned int i = 0; i < spacedim; ++i)
957 for (
unsigned int j = 0; j < dim; ++j)
958 for (
unsigned int l = 0; l < dim; ++l)
959 for (
unsigned int m = 0; m < dim; ++m)
960 jacobian_2nd_derivatives[point][i][j][l][m] =
973 template <
int dim,
int spacedim,
typename VectorType>
975 maybe_update_jacobian_pushed_forward_2nd_derivatives(
976 const typename ::QProjector<dim>::DataSetDescriptor data_set,
977 const typename ::MappingFEField<dim, spacedim, VectorType>::
981 const std::vector<unsigned int> &fe_to_real,
982 std::vector<Tensor<4, spacedim>>
983 &jacobian_pushed_forward_2nd_derivatives)
988 const unsigned int n_q_points =
989 jacobian_pushed_forward_2nd_derivatives.size();
991 double tmp[spacedim][spacedim][spacedim][spacedim];
992 for (
unsigned int point = 0; point < n_q_points; ++point)
995 &data.third_derivative(point + data_set, 0);
999 for (
unsigned int k = 0; k < data.n_shape_functions; ++k)
1001 const unsigned int comp_k =
1002 fe.system_to_component_index(k).first;
1003 if (fe_mask[comp_k])
1004 for (
unsigned int j = 0; j < dim; ++j)
1005 for (
unsigned int l = 0; l < dim; ++l)
1006 for (
unsigned int m = 0; m < dim; ++m)
1007 result[fe_to_real[comp_k]][j][l][m] +=
1008 (third[k][j][l][m] * data.local_dof_values[k]);
1012 for (
unsigned int i = 0; i < spacedim; ++i)
1013 for (
unsigned int j = 0; j < spacedim; ++j)
1014 for (
unsigned int l = 0; l < dim; ++l)
1015 for (
unsigned int m = 0; m < dim; ++m)
1017 jacobian_pushed_forward_2nd_derivatives
1018 [point][i][j][l][m] =
1019 result[i][0][l][m] * data.covariant[point][j][0];
1020 for (
unsigned int jr = 1; jr < dim; ++jr)
1021 jacobian_pushed_forward_2nd_derivatives[point][i][j]
1023 result[i][jr][l][m] *
1024 data.covariant[point][j][jr];
1028 for (
unsigned int i = 0; i < spacedim; ++i)
1029 for (
unsigned int j = 0; j < spacedim; ++j)
1030 for (
unsigned int l = 0; l < spacedim; ++l)
1031 for (
unsigned int m = 0; m < dim; ++m)
1034 jacobian_pushed_forward_2nd_derivatives[point][i][j]
1036 data.covariant[point][l][0];
1037 for (
unsigned int lr = 1; lr < dim; ++lr)
1039 jacobian_pushed_forward_2nd_derivatives[point][i]
1042 data.covariant[point][l][lr];
1046 for (
unsigned int i = 0; i < spacedim; ++i)
1047 for (
unsigned int j = 0; j < spacedim; ++j)
1048 for (
unsigned int l = 0; l < spacedim; ++l)
1049 for (
unsigned int m = 0; m < spacedim; ++m)
1051 jacobian_pushed_forward_2nd_derivatives
1052 [point][i][j][l][m] =
1053 tmp[i][j][l][0] * data.covariant[point][m][0];
1054 for (
unsigned int mr = 1; mr < dim; ++mr)
1055 jacobian_pushed_forward_2nd_derivatives[point][i][j]
1057 tmp[i][j][l][mr] * data.covariant[point][m][mr];
1069 template <
int dim,
int spacedim,
typename VectorType>
1071 maybe_update_jacobian_3rd_derivatives(
1072 const typename ::QProjector<dim>::DataSetDescriptor data_set,
1073 const typename ::MappingFEField<dim, spacedim, VectorType>::
1077 const std::vector<unsigned int> &fe_to_real,
1078 std::vector<DerivativeForm<4, dim, spacedim>> &jacobian_3rd_derivatives)
1080 const UpdateFlags update_flags = data.update_each;
1083 const unsigned int n_q_points = jacobian_3rd_derivatives.size();
1085 for (
unsigned int point = 0; point < n_q_points; ++point)
1088 &data.fourth_derivative(point + data_set, 0);
1092 for (
unsigned int k = 0; k < data.n_shape_functions; ++k)
1094 const unsigned int comp_k =
1095 fe.system_to_component_index(k).first;
1096 if (fe_mask[comp_k])
1097 for (
unsigned int j = 0; j < dim; ++j)
1098 for (
unsigned int l = 0; l < dim; ++l)
1099 for (
unsigned int m = 0; m < dim; ++m)
1100 for (
unsigned int n = 0; n < dim; ++n)
1101 result[fe_to_real[comp_k]][j][l][m][n] +=
1102 (fourth[k][j][l][m][n] *
1103 data.local_dof_values[k]);
1109 for (
unsigned int i = 0; i < spacedim; ++i)
1110 for (
unsigned int j = 0; j < dim; ++j)
1111 for (
unsigned int l = 0; l < dim; ++l)
1112 for (
unsigned int m = 0; m < dim; ++m)
1113 for (
unsigned int n = 0; n < dim; ++n)
1114 jacobian_3rd_derivatives[point][i][j][l][m][n] =
1115 result[i][j][l][m][n];
1127 template <
int dim,
int spacedim,
typename VectorType>
1129 maybe_update_jacobian_pushed_forward_3rd_derivatives(
1130 const typename ::QProjector<dim>::DataSetDescriptor data_set,
1131 const typename ::MappingFEField<dim, spacedim, VectorType>::
1135 const std::vector<unsigned int> &fe_to_real,
1136 std::vector<Tensor<5, spacedim>>
1137 &jacobian_pushed_forward_3rd_derivatives)
1139 const UpdateFlags update_flags = data.update_each;
1142 const unsigned int n_q_points =
1143 jacobian_pushed_forward_3rd_derivatives.size();
1145 double tmp[spacedim][spacedim][spacedim][spacedim][spacedim];
1146 for (
unsigned int point = 0; point < n_q_points; ++point)
1149 &data.fourth_derivative(point + data_set, 0);
1153 for (
unsigned int k = 0; k < data.n_shape_functions; ++k)
1155 const unsigned int comp_k =
1156 fe.system_to_component_index(k).first;
1157 if (fe_mask[comp_k])
1158 for (
unsigned int j = 0; j < dim; ++j)
1159 for (
unsigned int l = 0; l < dim; ++l)
1160 for (
unsigned int m = 0; m < dim; ++m)
1161 for (
unsigned int n = 0; n < dim; ++n)
1162 result[fe_to_real[comp_k]][j][l][m][n] +=
1163 (fourth[k][j][l][m][n] *
1164 data.local_dof_values[k]);
1168 for (
unsigned int i = 0; i < spacedim; ++i)
1169 for (
unsigned int j = 0; j < spacedim; ++j)
1170 for (
unsigned int l = 0; l < dim; ++l)
1171 for (
unsigned int m = 0; m < dim; ++m)
1172 for (
unsigned int n = 0; n < dim; ++n)
1174 tmp[i][j][l][m][n] = result[i][0][l][m][n] *
1175 data.covariant[point][j][0];
1176 for (
unsigned int jr = 1; jr < dim; ++jr)
1177 tmp[i][j][l][m][n] +=
1178 result[i][jr][l][m][n] *
1179 data.covariant[point][j][jr];
1183 for (
unsigned int i = 0; i < spacedim; ++i)
1184 for (
unsigned int j = 0; j < spacedim; ++j)
1185 for (
unsigned int l = 0; l < spacedim; ++l)
1186 for (
unsigned int m = 0; m < dim; ++m)
1187 for (
unsigned int n = 0; n < dim; ++n)
1189 jacobian_pushed_forward_3rd_derivatives
1190 [point][i][j][l][m][n] =
1191 tmp[i][j][0][m][n] *
1192 data.covariant[point][l][0];
1193 for (
unsigned int lr = 1; lr < dim; ++lr)
1194 jacobian_pushed_forward_3rd_derivatives[point][i]
1197 tmp[i][j][lr][m][n] *
1198 data.covariant[point][l][lr];
1202 for (
unsigned int i = 0; i < spacedim; ++i)
1203 for (
unsigned int j = 0; j < spacedim; ++j)
1204 for (
unsigned int l = 0; l < spacedim; ++l)
1205 for (
unsigned int m = 0; m < spacedim; ++m)
1206 for (
unsigned int n = 0; n < dim; ++n)
1208 tmp[i][j][l][m][n] =
1209 jacobian_pushed_forward_3rd_derivatives[point][i]
1212 data.covariant[point][m][0];
1213 for (
unsigned int mr = 1; mr < dim; ++mr)
1214 tmp[i][j][l][m][n] +=
1215 jacobian_pushed_forward_3rd_derivatives[point]
1218 data.covariant[point][m][mr];
1222 for (
unsigned int i = 0; i < spacedim; ++i)
1223 for (
unsigned int j = 0; j < spacedim; ++j)
1224 for (
unsigned int l = 0; l < spacedim; ++l)
1225 for (
unsigned int m = 0; m < spacedim; ++m)
1226 for (
unsigned int n = 0; n < spacedim; ++n)
1228 jacobian_pushed_forward_3rd_derivatives
1229 [point][i][j][l][m][n] =
1230 tmp[i][j][l][m][0] *
1231 data.covariant[point][n][0];
1232 for (
unsigned int nr = 1; nr < dim; ++nr)
1233 jacobian_pushed_forward_3rd_derivatives[point][i]
1236 tmp[i][j][l][m][nr] *
1237 data.covariant[point][n][nr];
1253 template <
int dim,
int spacedim,
typename VectorType>
1255 maybe_compute_face_data(
1256 const ::Mapping<dim, spacedim> &mapping,
1257 const typename ::Triangulation<dim, spacedim>::cell_iterator
1259 const unsigned int face_no,
1260 const unsigned int subface_no,
1262 const typename ::MappingFEField<dim, spacedim, VectorType>::
1267 const UpdateFlags update_flags = data.update_each;
1271 const unsigned int n_q_points = output_data.boundary_forms.size();
1280 for (
unsigned int d = 0; d != dim - 1; ++d)
1282 Assert(face_no + cell->n_faces() * d <
1283 data.unit_tangentials.size(),
1286 data.aux[d].size() <=
1287 data.unit_tangentials[face_no + cell->n_faces() * d].size(),
1292 data.unit_tangentials[face_no + cell->n_faces() * d]),
1300 if (dim == spacedim)
1302 for (
unsigned int i = 0; i < n_q_points; ++i)
1310 output_data.boundary_forms[i][0] =
1311 (face_no == 0 ? -1 : +1);
1314 output_data.boundary_forms[i] =
1315 cross_product_2d(data.aux[0][i]);
1318 output_data.boundary_forms[i] =
1319 cross_product_3d(data.aux[0][i], data.aux[1][i]);
1335 for (
unsigned int point = 0; point < n_q_points; ++point)
1340 output_data.boundary_forms[point] =
1341 data.contravariant[point].transpose()[0];
1342 output_data.boundary_forms[point] /=
1343 (face_no == 0 ? -1. : +1.) *
1344 output_data.boundary_forms[point].norm();
1353 cross_product_3d(DX_t[0], DX_t[1]);
1354 cell_normal /= cell_normal.
norm();
1358 output_data.boundary_forms[point] =
1359 cross_product_3d(data.aux[0][point], cell_normal);
1365 for (
unsigned int i = 0; i < output_data.boundary_forms.size();
1370 output_data.JxW_values[i] =
1371 output_data.boundary_forms[i].norm() *
1372 data.quadrature_weights[i + data_set];
1377 const double area_ratio =
1379 cell->subface_case(face_no), subface_no);
1380 output_data.JxW_values[i] *= area_ratio;
1385 output_data.normal_vectors[i] =
1387 output_data.boundary_forms[i].norm());
1398 template <
int dim,
int spacedim,
typename VectorType>
1400 do_fill_fe_face_values(
1401 const ::Mapping<dim, spacedim> &mapping,
1402 const typename ::Triangulation<dim, spacedim>::cell_iterator
1404 const unsigned int face_no,
1405 const unsigned int subface_no,
1406 const typename ::QProjector<dim>::DataSetDescriptor data_set,
1407 const typename ::MappingFEField<dim, spacedim, VectorType>::
1411 const std::vector<unsigned int> &fe_to_real,
1415 maybe_compute_q_points<dim, spacedim, VectorType>(
1421 output_data.quadrature_points);
1423 maybe_update_Jacobians<dim, spacedim, VectorType>(
1424 data_set, data, fe, fe_mask, fe_to_real);
1426 const UpdateFlags update_flags = data.update_each;
1427 const unsigned int n_q_points = data.contravariant.size();
1430 for (
unsigned int point = 0; point < n_q_points; ++point)
1431 output_data.jacobians[point] = data.contravariant[point];
1434 for (
unsigned int point = 0; point < n_q_points; ++point)
1435 output_data.inverse_jacobians[point] =
1436 data.covariant[point].transpose();
1438 maybe_update_jacobian_grads<dim, spacedim, VectorType>(
1439 data_set, data, fe, fe_mask, fe_to_real, output_data.jacobian_grads);
1441 maybe_update_jacobian_pushed_forward_grads<dim, spacedim, VectorType>(
1447 output_data.jacobian_pushed_forward_grads);
1449 maybe_update_jacobian_2nd_derivatives<dim, spacedim, VectorType>(
1455 output_data.jacobian_2nd_derivatives);
1457 maybe_update_jacobian_pushed_forward_2nd_derivatives<dim,
1465 output_data.jacobian_pushed_forward_2nd_derivatives);
1467 maybe_update_jacobian_3rd_derivatives<dim, spacedim, VectorType>(
1473 output_data.jacobian_3rd_derivatives);
1475 maybe_update_jacobian_pushed_forward_3rd_derivatives<dim,
1483 output_data.jacobian_pushed_forward_3rd_derivatives);
1485 maybe_compute_face_data<dim, spacedim, VectorType>(
1486 mapping, cell, face_no, subface_no, data_set, data, output_data);