16 #include <deal.II/base/array_view.h> 17 #include <deal.II/base/memory_consumption.h> 18 #include <deal.II/base/polynomial.h> 19 #include <deal.II/base/qprojector.h> 20 #include <deal.II/base/quadrature.h> 21 #include <deal.II/base/quadrature_lib.h> 22 #include <deal.II/base/std_cxx14/memory.h> 23 #include <deal.II/base/tensor_product_polynomials.h> 24 #include <deal.II/base/thread_management.h> 25 #include <deal.II/base/utilities.h> 27 #include <deal.II/dofs/dof_accessor.h> 29 #include <deal.II/fe/fe_q.h> 30 #include <deal.II/fe/fe_system.h> 31 #include <deal.II/fe/fe_tools.h> 32 #include <deal.II/fe/fe_values.h> 33 #include <deal.II/fe/mapping.h> 34 #include <deal.II/fe/mapping_fe_field.h> 35 #include <deal.II/fe/mapping_q1.h> 37 #include <deal.II/grid/tria_iterator.h> 39 #include <deal.II/lac/block_vector.h> 40 #include <deal.II/lac/full_matrix.h> 41 #include <deal.II/lac/la_parallel_block_vector.h> 42 #include <deal.II/lac/la_parallel_vector.h> 43 #include <deal.II/lac/la_vector.h> 44 #include <deal.II/lac/petsc_block_vector.h> 45 #include <deal.II/lac/petsc_vector.h> 46 #include <deal.II/lac/trilinos_parallel_block_vector.h> 47 #include <deal.II/lac/trilinos_vector.h> 48 #include <deal.II/lac/vector.h> 50 #include <deal.II/numerics/vector_tools.h> 58 DEAL_II_NAMESPACE_OPEN
61 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
66 , n_shape_functions(fe.dofs_per_cell)
68 , local_dof_indices(fe.dofs_per_cell)
69 , local_dof_values(fe.dofs_per_cell)
74 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
85 template <
int dim,
int spacedim,
typename DoFHandlerType,
typename VectorType>
88 const unsigned int qpoint,
89 const unsigned int shape_nr)
99 template <
int dim,
int spacedim,
typename DoFHandlerType,
typename VectorType>
102 derivative(
const unsigned int qpoint,
const unsigned int shape_nr)
const 113 template <
int dim,
int spacedim,
typename DoFHandlerType,
typename VectorType>
116 derivative(
const unsigned int qpoint,
const unsigned int shape_nr)
126 template <
int dim,
int spacedim,
typename DoFHandlerType,
typename VectorType>
130 const unsigned int shape_nr)
const 142 template <
int dim,
int spacedim,
typename DoFHandlerType,
typename VectorType>
156 template <
int dim,
int spacedim,
typename DoFHandlerType,
typename VectorType>
170 template <
int dim,
int spacedim,
typename DoFHandlerType,
typename VectorType>
183 template <
int dim,
int spacedim,
typename DoFHandlerType,
typename VectorType>
187 const unsigned int shape_nr)
const 199 template <
int dim,
int spacedim,
typename DoFHandlerType,
typename VectorType>
220 get_vertex_quadrature()
223 if (quad.
size() == 0)
226 for (
unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
236 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
241 : euler_vector(&euler_vector)
242 , euler_dof_handler(&euler_dof_handler)
243 , fe_mask(mask.size() ?
246 euler_dof_handler.get_fe().get_nonzero_components(0).size(),
249 ,
fe_values(this->euler_dof_handler->get_fe(),
250 get_vertex_quadrature<dim>(),
253 unsigned int size = 0;
254 for (
unsigned int i = 0; i < fe_mask.
size(); ++i)
263 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
268 , fe_mask(mapping.fe_mask)
271 get_vertex_quadrature<dim>(),
277 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
278 inline const double &
280 const unsigned int qpoint,
281 const unsigned int shape_nr)
const 283 Assert(qpoint * n_shape_functions + shape_nr < shape_values.size(),
286 shape_values.size()));
287 return shape_values[qpoint * n_shape_functions + shape_nr];
292 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
302 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
318 std::vector<Vector<typename VectorType::value_type>> values(
330 for (
unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
331 for (
unsigned int j = 0; j <
fe_to_real.size(); ++j)
340 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
349 const unsigned int n_points = unit_points.size();
351 for (
unsigned int point = 0; point < n_points; ++point)
353 if (data.shape_values.size() != 0)
354 for (
unsigned int i = 0; i < data.n_shape_functions; ++i)
355 data.shape(point, i) = fe->shape_value(i, unit_points[point]);
357 if (data.shape_derivatives.size() != 0)
358 for (
unsigned int i = 0; i < data.n_shape_functions; ++i)
359 data.derivative(point, i) = fe->shape_grad(i, unit_points[point]);
361 if (data.shape_second_derivatives.size() != 0)
362 for (
unsigned int i = 0; i < data.n_shape_functions; ++i)
363 data.second_derivative(point, i) =
364 fe->shape_grad_grad(i, unit_points[point]);
366 if (data.shape_third_derivatives.size() != 0)
367 for (
unsigned int i = 0; i < data.n_shape_functions; ++i)
368 data.third_derivative(point, i) =
369 fe->shape_3rd_derivative(i, unit_points[point]);
371 if (data.shape_fourth_derivatives.size() != 0)
372 for (
unsigned int i = 0; i < data.n_shape_functions; ++i)
373 data.fourth_derivative(point, i) =
374 fe->shape_4th_derivative(i, unit_points[point]);
379 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
391 for (
unsigned int i = 0; i < 5; ++i)
434 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
439 const unsigned int n_original_q_points,
447 const unsigned int n_q_points = q.
size();
461 data.
covariant.resize(n_original_q_points);
485 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
490 const unsigned int n_original_q_points,
493 compute_data(update_flags, q, n_original_q_points, data);
510 static const int tangential_orientation[4] = {-1, 1, 1, -1};
511 for (
unsigned int i = 0; i < GeometryInfo<dim>::faces_per_cell;
515 tang[1 - i / 2] = tangential_orientation[i];
523 for (
unsigned int i = 0; i < GeometryInfo<dim>::faces_per_cell;
528 const unsigned int nd =
536 tang1[(nd + 1) % dim] =
541 tang2[(nd + 2) % dim] = 1.;
562 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
563 typename std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
570 this->compute_data(update_flags, quadrature, quadrature.
size(), *data);
571 return std::move(data);
576 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
577 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
585 this->compute_face_data(update_flags, q, quadrature.
size(), *data);
587 return std::move(data);
591 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
592 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
600 this->compute_face_data(update_flags, q, quadrature.
size(), *data);
602 return std::move(data);
609 namespace MappingFEFieldImplementation
622 typename DoFHandlerType>
624 maybe_compute_q_points(
625 const typename ::QProjector<dim>::DataSetDescriptor data_set,
638 for (
unsigned int point = 0; point < quadrature_points.size();
642 const double * shape = &data.shape(point + data_set, 0);
644 for (
unsigned int k = 0; k < data.n_shape_functions; ++k)
648 result[fe_to_real[comp_k]] +=
649 data.local_dof_values[k] * shape[k];
652 quadrature_points[point] = result;
667 typename DoFHandlerType>
669 maybe_update_Jacobians(
671 const typename ::QProjector<dim>::DataSetDescriptor data_set,
677 const std::vector<unsigned int> & fe_to_real)
688 const unsigned int n_q_points = data.contravariant.size();
692 for (
unsigned int point = 0; point < n_q_points; ++point)
695 &data.derivative(point + data_set, 0);
699 for (
unsigned int k = 0; k < data.n_shape_functions; ++k)
701 unsigned int comp_k =
704 result[fe_to_real[comp_k]] +=
705 data.local_dof_values[k] * data_derv[k];
709 for (
unsigned int i = 0; i < spacedim; ++i)
711 data.contravariant[point][i] = result[i];
721 for (
unsigned int point = 0; point < data.contravariant.size();
723 data.covariant[point] =
724 (data.contravariant[point]).covariant_form();
731 for (
unsigned int point = 0; point < data.contravariant.size();
733 data.volume_elements[point] =
734 data.contravariant[point].determinant();
747 typename DoFHandlerType>
749 maybe_update_jacobian_grads(
751 const typename ::QProjector<dim>::DataSetDescriptor data_set,
757 const std::vector<unsigned int> & fe_to_real,
763 const unsigned int n_q_points = jacobian_grads.size();
767 for (
unsigned int point = 0; point < n_q_points; ++point)
770 &data.second_derivative(point + data_set, 0);
774 for (
unsigned int k = 0; k < data.n_shape_functions; ++k)
776 unsigned int comp_k =
779 for (
unsigned int j = 0; j < dim; ++j)
780 for (
unsigned int l = 0; l < dim; ++l)
781 result[fe_to_real[comp_k]][j][l] +=
782 (second[k][j][l] * data.local_dof_values[k]);
787 for (
unsigned int i = 0; i < spacedim; ++i)
788 for (
unsigned int j = 0; j < dim; ++j)
789 for (
unsigned int l = 0; l < dim; ++l)
790 jacobian_grads[point][i][j][l] = result[i][j][l];
805 typename DoFHandlerType>
807 maybe_update_jacobian_pushed_forward_grads(
809 const typename ::QProjector<dim>::DataSetDescriptor data_set,
815 const std::vector<unsigned int> & fe_to_real,
821 const unsigned int n_q_points =
822 jacobian_pushed_forward_grads.size();
826 double tmp[spacedim][spacedim][spacedim];
827 for (
unsigned int point = 0; point < n_q_points; ++point)
830 &data.second_derivative(point + data_set, 0);
834 for (
unsigned int k = 0; k < data.n_shape_functions; ++k)
836 unsigned int comp_k =
839 for (
unsigned int j = 0; j < dim; ++j)
840 for (
unsigned int l = 0; l < dim; ++l)
841 result[fe_to_real[comp_k]][j][l] +=
842 (second[k][j][l] * data.local_dof_values[k]);
846 for (
unsigned int i = 0; i < spacedim; ++i)
847 for (
unsigned int j = 0; j < spacedim; ++j)
848 for (
unsigned int l = 0; l < dim; ++l)
851 result[i][0][l] * data.covariant[point][j][0];
852 for (
unsigned int jr = 1; jr < dim; ++jr)
854 tmp[i][j][l] += result[i][jr][l] *
855 data.covariant[point][j][jr];
860 for (
unsigned int i = 0; i < spacedim; ++i)
861 for (
unsigned int j = 0; j < spacedim; ++j)
862 for (
unsigned int l = 0; l < spacedim; ++l)
864 jacobian_pushed_forward_grads[point][i][j][l] =
865 tmp[i][j][0] * data.covariant[point][l][0];
866 for (
unsigned int lr = 1; lr < dim; ++lr)
868 jacobian_pushed_forward_grads[point][i][j][l] +=
869 tmp[i][j][lr] * data.covariant[point][l][lr];
886 typename DoFHandlerType>
888 maybe_update_jacobian_2nd_derivatives(
890 const typename ::QProjector<dim>::DataSetDescriptor data_set,
896 const std::vector<unsigned int> & fe_to_real,
902 const unsigned int n_q_points = jacobian_2nd_derivatives.size();
906 for (
unsigned int point = 0; point < n_q_points; ++point)
909 &data.third_derivative(point + data_set, 0);
913 for (
unsigned int k = 0; k < data.n_shape_functions; ++k)
915 unsigned int comp_k =
918 for (
unsigned int j = 0; j < dim; ++j)
919 for (
unsigned int l = 0; l < dim; ++l)
920 for (
unsigned int m = 0; m < dim; ++m)
921 result[fe_to_real[comp_k]][j][l][m] +=
923 data.local_dof_values[k]);
928 for (
unsigned int i = 0; i < spacedim; ++i)
929 for (
unsigned int j = 0; j < dim; ++j)
930 for (
unsigned int l = 0; l < dim; ++l)
931 for (
unsigned int m = 0; m < dim; ++m)
932 jacobian_2nd_derivatives[point][i][j][l][m] =
949 typename DoFHandlerType>
951 maybe_update_jacobian_pushed_forward_2nd_derivatives(
953 const typename ::QProjector<dim>::DataSetDescriptor data_set,
959 const std::vector<unsigned int> & fe_to_real,
961 &jacobian_pushed_forward_2nd_derivatives)
966 const unsigned int n_q_points =
967 jacobian_pushed_forward_2nd_derivatives.size();
971 double tmp[spacedim][spacedim][spacedim][spacedim];
972 for (
unsigned int point = 0; point < n_q_points; ++point)
975 &data.third_derivative(point + data_set, 0);
979 for (
unsigned int k = 0; k < data.n_shape_functions; ++k)
981 unsigned int comp_k =
984 for (
unsigned int j = 0; j < dim; ++j)
985 for (
unsigned int l = 0; l < dim; ++l)
986 for (
unsigned int m = 0; m < dim; ++m)
987 result[fe_to_real[comp_k]][j][l][m] +=
989 data.local_dof_values[k]);
993 for (
unsigned int i = 0; i < spacedim; ++i)
994 for (
unsigned int j = 0; j < spacedim; ++j)
995 for (
unsigned int l = 0; l < dim; ++l)
996 for (
unsigned int m = 0; m < dim; ++m)
998 jacobian_pushed_forward_2nd_derivatives
999 [point][i][j][l][m] =
1000 result[i][0][l][m] *
1001 data.covariant[point][j][0];
1002 for (
unsigned int jr = 1; jr < dim; ++jr)
1003 jacobian_pushed_forward_2nd_derivatives[point]
1006 result[i][jr][l][m] *
1007 data.covariant[point][j][jr];
1011 for (
unsigned int i = 0; i < spacedim; ++i)
1012 for (
unsigned int j = 0; j < spacedim; ++j)
1013 for (
unsigned int l = 0; l < spacedim; ++l)
1014 for (
unsigned int m = 0; m < dim; ++m)
1017 jacobian_pushed_forward_2nd_derivatives[point]
1020 data.covariant[point][l][0];
1021 for (
unsigned int lr = 1; lr < dim; ++lr)
1023 jacobian_pushed_forward_2nd_derivatives
1024 [point][i][j][lr][m] *
1025 data.covariant[point][l][lr];
1029 for (
unsigned int i = 0; i < spacedim; ++i)
1030 for (
unsigned int j = 0; j < spacedim; ++j)
1031 for (
unsigned int l = 0; l < spacedim; ++l)
1032 for (
unsigned int m = 0; m < spacedim; ++m)
1034 jacobian_pushed_forward_2nd_derivatives
1035 [point][i][j][l][m] =
1036 tmp[i][j][l][0] * data.covariant[point][m][0];
1037 for (
unsigned int mr = 1; mr < dim; ++mr)
1038 jacobian_pushed_forward_2nd_derivatives[point]
1042 data.covariant[point][m][mr];
1057 typename VectorType,
1058 typename DoFHandlerType>
1060 maybe_update_jacobian_3rd_derivatives(
1062 const typename ::QProjector<dim>::DataSetDescriptor data_set,
1068 const std::vector<unsigned int> & fe_to_real,
1071 const UpdateFlags update_flags = data.update_each;
1074 const unsigned int n_q_points = jacobian_3rd_derivatives.size();
1078 for (
unsigned int point = 0; point < n_q_points; ++point)
1081 &data.fourth_derivative(point + data_set, 0);
1085 for (
unsigned int k = 0; k < data.n_shape_functions; ++k)
1087 unsigned int comp_k =
1089 if (fe_mask[comp_k])
1090 for (
unsigned int j = 0; j < dim; ++j)
1091 for (
unsigned int l = 0; l < dim; ++l)
1092 for (
unsigned int m = 0; m < dim; ++m)
1093 for (
unsigned int n = 0; n < dim; ++n)
1094 result[fe_to_real[comp_k]][j][l][m][n] +=
1095 (fourth[k][j][l][m][n] *
1096 data.local_dof_values[k]);
1102 for (
unsigned int i = 0; i < spacedim; ++i)
1103 for (
unsigned int j = 0; j < dim; ++j)
1104 for (
unsigned int l = 0; l < dim; ++l)
1105 for (
unsigned int m = 0; m < dim; ++m)
1106 for (
unsigned int n = 0; n < dim; ++n)
1107 jacobian_3rd_derivatives[point][i][j][l][m][n] =
1108 result[i][j][l][m][n];
1123 typename VectorType,
1124 typename DoFHandlerType>
1126 maybe_update_jacobian_pushed_forward_3rd_derivatives(
1128 const typename ::QProjector<dim>::DataSetDescriptor data_set,
1134 const std::vector<unsigned int> & fe_to_real,
1136 &jacobian_pushed_forward_3rd_derivatives)
1138 const UpdateFlags update_flags = data.update_each;
1141 const unsigned int n_q_points =
1142 jacobian_pushed_forward_3rd_derivatives.size();
1146 double tmp[spacedim][spacedim][spacedim][spacedim][spacedim];
1147 for (
unsigned int point = 0; point < n_q_points; ++point)
1150 &data.fourth_derivative(point + data_set, 0);
1154 for (
unsigned int k = 0; k < data.n_shape_functions; ++k)
1156 unsigned int comp_k =
1158 if (fe_mask[comp_k])
1159 for (
unsigned int j = 0; j < dim; ++j)
1160 for (
unsigned int l = 0; l < dim; ++l)
1161 for (
unsigned int m = 0; m < dim; ++m)
1162 for (
unsigned int n = 0; n < dim; ++n)
1163 result[fe_to_real[comp_k]][j][l][m][n] +=
1164 (fourth[k][j][l][m][n] *
1165 data.local_dof_values[k]);
1169 for (
unsigned int i = 0; i < spacedim; ++i)
1170 for (
unsigned int j = 0; j < spacedim; ++j)
1171 for (
unsigned int l = 0; l < dim; ++l)
1172 for (
unsigned int m = 0; m < dim; ++m)
1173 for (
unsigned int n = 0; n < dim; ++n)
1175 tmp[i][j][l][m][n] =
1176 result[i][0][l][m][n] *
1177 data.covariant[point][j][0];
1178 for (
unsigned int jr = 1; jr < dim; ++jr)
1179 tmp[i][j][l][m][n] +=
1180 result[i][jr][l][m][n] *
1181 data.covariant[point][j][jr];
1185 for (
unsigned int i = 0; i < spacedim; ++i)
1186 for (
unsigned int j = 0; j < spacedim; ++j)
1187 for (
unsigned int l = 0; l < spacedim; ++l)
1188 for (
unsigned int m = 0; m < dim; ++m)
1189 for (
unsigned int n = 0; n < dim; ++n)
1191 jacobian_pushed_forward_3rd_derivatives
1192 [point][i][j][l][m][n] =
1193 tmp[i][j][0][m][n] *
1194 data.covariant[point][l][0];
1195 for (
unsigned int lr = 1; lr < dim; ++lr)
1196 jacobian_pushed_forward_3rd_derivatives
1197 [point][i][j][l][m][n] +=
1198 tmp[i][j][lr][m][n] *
1199 data.covariant[point][l][lr];
1203 for (
unsigned int i = 0; i < spacedim; ++i)
1204 for (
unsigned int j = 0; j < spacedim; ++j)
1205 for (
unsigned int l = 0; l < spacedim; ++l)
1206 for (
unsigned int m = 0; m < spacedim; ++m)
1207 for (
unsigned int n = 0; n < dim; ++n)
1209 tmp[i][j][l][m][n] =
1210 jacobian_pushed_forward_3rd_derivatives
1211 [point][i][j][l][0][n] *
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
1216 [point][i][j][l][mr][n] *
1217 data.covariant[point][m][mr];
1221 for (
unsigned int i = 0; i < spacedim; ++i)
1222 for (
unsigned int j = 0; j < spacedim; ++j)
1223 for (
unsigned int l = 0; l < spacedim; ++l)
1224 for (
unsigned int m = 0; m < spacedim; ++m)
1225 for (
unsigned int n = 0; n < spacedim; ++n)
1227 jacobian_pushed_forward_3rd_derivatives
1228 [point][i][j][l][m][n] =
1229 tmp[i][j][l][m][0] *
1230 data.covariant[point][n][0];
1231 for (
unsigned int nr = 1; nr < dim; ++nr)
1232 jacobian_pushed_forward_3rd_derivatives
1233 [point][i][j][l][m][n] +=
1234 tmp[i][j][l][m][nr] *
1235 data.covariant[point][n][nr];
1254 typename VectorType,
1255 typename DoFHandlerType>
1257 maybe_compute_face_data(
1258 const ::Mapping<dim, spacedim> &mapping,
1259 const typename ::Triangulation<dim, spacedim>::cell_iterator
1261 const unsigned int face_no,
1262 const unsigned int subface_no,
1263 const std::vector<double> &weights,
1270 const UpdateFlags update_flags = data.update_each;
1274 const unsigned int n_q_points = output_data.
boundary_forms.size();
1283 for (
unsigned int d = 0; d != dim - 1; ++d)
1286 data.unit_tangentials.size(),
1289 data.aux[d].size() <=
1291 .unit_tangentials[face_no +
1299 .unit_tangentials[face_no +
1303 make_array_view(data.aux[d]));
1308 if (dim == spacedim)
1310 for (
unsigned int i = 0; i < n_q_points; ++i)
1319 (face_no == 0 ? -1 : +1);
1323 cross_product_2d(data.aux[0][i]);
1327 cross_product_3d(data.aux[0][i], data.aux[1][i]);
1343 for (
unsigned int point = 0; point < n_q_points; ++point)
1349 data.contravariant[point].transpose()[0];
1351 (face_no == 0 ? -1. : +1.) *
1358 data.contravariant[point].transpose();
1361 cross_product_3d(DX_t[0], DX_t[1]);
1362 cell_normal /= cell_normal.
norm();
1367 cross_product_3d(data.aux[0][point], cell_normal);
1372 if (update_flags & (update_normal_vectors | update_JxW_values))
1376 if (update_flags & update_JxW_values)
1383 const double area_ratio =
1385 cell->subface_case(face_no), subface_no);
1390 if (update_flags & update_normal_vectors)
1397 for (
unsigned int point = 0; point < n_q_points; ++point)
1398 output_data.
jacobians[point] = data.contravariant[point];
1401 for (
unsigned int point = 0; point < n_q_points; ++point)
1403 data.covariant[point].transpose();
1415 typename VectorType,
1416 typename DoFHandlerType>
1418 do_fill_fe_face_values(
1419 const ::Mapping<dim, spacedim> &mapping,
1420 const typename ::Triangulation<dim, spacedim>::cell_iterator
1422 const unsigned int face_no,
1423 const unsigned int subface_no,
1424 const typename ::QProjector<dim>::DataSetDescriptor data_set,
1431 const std::vector<unsigned int> & fe_to_real,
1435 maybe_compute_q_points<dim, spacedim, VectorType, DoFHandlerType>(
1443 maybe_update_Jacobians<dim, spacedim, VectorType, DoFHandlerType>(
1446 maybe_update_jacobian_grads<dim, spacedim, VectorType, DoFHandlerType>(
1455 maybe_update_jacobian_pushed_forward_grads<dim,
1467 maybe_update_jacobian_2nd_derivatives<dim,
1479 maybe_update_jacobian_pushed_forward_2nd_derivatives<dim,
1491 maybe_update_jacobian_3rd_derivatives<dim,
1503 maybe_update_jacobian_pushed_forward_3rd_derivatives<dim,
1515 maybe_compute_face_data<dim, spacedim, VectorType, DoFHandlerType>(
1531 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1543 Assert(dynamic_cast<const InternalData *>(&internal_data) !=
nullptr,
1547 const unsigned int n_q_points = quadrature.
size();
1553 internal::MappingFEFieldImplementation::
1554 maybe_compute_q_points<dim, spacedim, VectorType, DoFHandlerType>(
1562 internal::MappingFEFieldImplementation::
1563 maybe_update_Jacobians<dim, spacedim, VectorType, DoFHandlerType>(
1571 const UpdateFlags update_flags = data.update_each;
1572 const std::vector<double> &weights = quadrature.
get_weights();
1588 for (
unsigned int point = 0; point < n_q_points; ++point)
1590 if (dim == spacedim)
1592 const double det = data.contravariant[point].determinant();
1600 1e-12 * Utilities::fixed_power<dim>(
1601 cell->diameter() / std::sqrt(
double(dim))),
1603 cell->center(), det, point)));
1604 output_data.
JxW_values[point] = weights[point] * det;
1612 for (
unsigned int i = 0; i < spacedim; ++i)
1613 for (
unsigned int j = 0; j < dim; ++j)
1614 DX_t[j][i] = data.contravariant[point][i][j];
1617 for (
unsigned int i = 0; i < dim; ++i)
1618 for (
unsigned int j = 0; j < dim; ++j)
1619 G[i][j] = DX_t[i] * DX_t[j];
1627 if (update_flags & update_normal_vectors)
1632 if (update_flags & update_normal_vectors)
1634 Assert(spacedim - dim == 1,
1636 "There is no cell normal in codim 2."));
1640 cross_product_2d(-DX_t[0]);
1643 cross_product_3d(DX_t[0], DX_t[1]);
1648 if (cell->direction_flag() ==
false)
1661 for (
unsigned int point = 0; point < n_q_points; ++point)
1662 output_data.
jacobians[point] = data.contravariant[point];
1670 for (
unsigned int point = 0; point < n_q_points; ++point)
1672 data.covariant[point].transpose();
1676 internal::MappingFEFieldImplementation::
1677 maybe_update_jacobian_grads<dim, spacedim, VectorType, DoFHandlerType>(
1688 internal::MappingFEFieldImplementation::
1689 maybe_update_jacobian_pushed_forward_grads<dim,
1702 internal::MappingFEFieldImplementation::maybe_update_jacobian_2nd_derivatives<
1706 DoFHandlerType>(cell_similarity,
1715 internal::MappingFEFieldImplementation::
1716 maybe_update_jacobian_pushed_forward_2nd_derivatives<dim,
1729 internal::MappingFEFieldImplementation::maybe_update_jacobian_3rd_derivatives<
1733 DoFHandlerType>(cell_similarity,
1743 internal::MappingFEFieldImplementation::
1744 maybe_update_jacobian_pushed_forward_3rd_derivatives<dim,
1756 return updated_cell_similarity;
1761 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1765 const unsigned int face_no,
1773 Assert(dynamic_cast<const InternalData *>(&internal_data) !=
nullptr,
1779 internal::MappingFEFieldImplementation::
1780 do_fill_fe_face_values<dim, spacedim, VectorType, DoFHandlerType>(
1786 cell->face_orientation(face_no),
1787 cell->face_flip(face_no),
1788 cell->face_rotation(face_no),
1799 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1804 const unsigned int face_no,
1805 const unsigned int subface_no,
1813 Assert(dynamic_cast<const InternalData *>(&internal_data) !=
nullptr,
1819 internal::MappingFEFieldImplementation::
1820 do_fill_fe_face_values<dim, spacedim, VectorType, DoFHandlerType>(
1827 cell->face_orientation(
1829 cell->face_flip(face_no),
1830 cell->face_rotation(face_no),
1832 cell->subface_case(face_no)),
1844 namespace MappingFEFieldImplementation
1851 typename VectorType,
1852 typename DoFHandlerType>
1863 MappingFEField<dim, spacedim, VectorType, DoFHandlerType>::
1866 const typename ::MappingFEField<dim,
1870 &data =
static_cast< 1872 MappingFEField<dim, spacedim, VectorType, DoFHandlerType>::
1875 switch (mapping_type)
1882 "update_contravariant_transformation"));
1884 for (
unsigned int i = 0; i < output.size(); ++i)
1886 apply_transformation(data.contravariant[i], input[i]);
1896 "update_contravariant_transformation"));
1900 "update_volume_elements"));
1902 for (
unsigned int i = 0; i < output.size(); ++i)
1905 apply_transformation(data.contravariant[i], input[i]);
1906 output[i] /= data.volume_elements[i];
1920 "update_contravariant_transformation"));
1922 for (
unsigned int i = 0; i < output.size(); ++i)
1923 output[i] = apply_transformation(data.covariant[i], input[i]);
1937 typename VectorType,
1938 typename DoFHandlerType>
1940 transform_differential_forms(
1949 MappingFEField<dim, spacedim, VectorType, DoFHandlerType>::
1952 const typename ::MappingFEField<dim,
1956 &data =
static_cast< 1958 MappingFEField<dim, spacedim, VectorType, DoFHandlerType>::
1961 switch (mapping_type)
1968 "update_contravariant_transformation"));
1970 for (
unsigned int i = 0; i < output.size(); ++i)
1971 output[i] = apply_transformation(data.covariant[i], input[i]);
1985 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1995 internal::MappingFEFieldImplementation::
1996 transform_fields<dim, spacedim, 1, VectorType, DoFHandlerType>(input,
2004 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
2014 internal::MappingFEFieldImplementation::
2015 transform_differential_forms<dim, spacedim, 1, VectorType, DoFHandlerType>(
2016 input, mapping_type, mapping_data, output);
2021 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
2039 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
2048 Assert(dynamic_cast<const InternalData *>(&mapping_data) !=
nullptr,
2052 switch (mapping_type)
2058 "update_covariant_transformation"));
2060 for (
unsigned int q = 0; q < output.
size(); ++q)
2061 for (
unsigned int i = 0; i < spacedim; ++i)
2062 for (
unsigned int j = 0; j < spacedim; ++j)
2063 for (
unsigned int k = 0; k < spacedim; ++k)
2065 output[q][i][j][k] = data.
covariant[q][j][0] *
2068 for (
unsigned int J = 0; J < dim; ++J)
2070 const unsigned int K0 = (0 == J) ? 1 : 0;
2071 for (
unsigned int K = K0; K < dim; ++K)
2072 output[q][i][j][k] += data.
covariant[q][j][J] *
2087 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
2105 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
2116 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase> mdata(
2118 Assert(dynamic_cast<InternalData *>(mdata.get()) !=
nullptr,
2127 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
2136 unsigned int comp_i =
2138 if (fe_mask[comp_i])
2148 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
2169 for (
unsigned int d = 0; d < dim; ++d)
2170 initial_p_unit[d] = 0.5;
2183 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase> mdata(
2184 get_data(update_flags, point_quadrature));
2185 Assert(dynamic_cast<InternalData *>(mdata.get()) !=
nullptr,
2193 dynamic_cast<InternalData &>(*mdata));
2197 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
2206 const unsigned int n_shapes = mdata.
shape_values.size();
2226 const double eps = 1.e-12 * cell->diameter();
2227 const unsigned int newton_iteration_limit = 20;
2228 unsigned int newton_iteration = 0;
2237 unsigned int comp_k =
2239 if (fe_mask[comp_k])
2240 for (
unsigned int j = 0; j < dim; ++j)
2244 for (
unsigned int j = 0; j < dim; ++j)
2246 f[j] = DF[j] * p_minus_F;
2247 for (
unsigned int l = 0; l < dim; ++l)
2248 df[j][l] = -DF[j] * DF[l];
2254 double step_length = 1;
2267 for (
unsigned int i = 0; i < dim; ++i)
2268 p_unit_trial[i] -= step_length * delta[i];
2278 if (f_trial.
norm() < p_minus_F.
norm())
2280 p_real = p_real_trial;
2281 p_unit = p_unit_trial;
2282 p_minus_F = f_trial;
2285 else if (step_length > 0.05)
2292 if (newton_iteration > newton_iteration_limit)
2309 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
2317 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
2322 return this->fe_mask;
2326 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
2327 std::unique_ptr<Mapping<dim, spacedim>>
2330 return std_cxx14::make_unique<
2335 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
2348 dof_cell->get_dof_indices(data.local_dof_indices);
2350 for (
unsigned int i = 0; i < data.local_dof_values.size(); ++i)
2351 data.local_dof_values[i] =
2352 internal::ElementAccess<VectorType>::get(*
euler_vector,
2353 data.local_dof_indices[i]);
2357 #define SPLIT_INSTANTIATIONS_COUNT 2 2358 #ifndef SPLIT_INSTANTIATIONS_INDEX 2359 # define SPLIT_INSTANTIATIONS_INDEX 0 2361 #include "mapping_fe_field.inst" 2364 DEAL_II_NAMESPACE_CLOSE
Transformed quadrature weights.
virtual std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBase > get_data(const UpdateFlags, const Quadrature< dim > &quadrature) const override
static const unsigned int invalid_unsigned_int
#define AssertDimension(dim1, dim2)
Number determinant(const SymmetricTensor< 2, dim, Number > &)
Contravariant transformation.
unsigned int n_shape_functions
virtual std::unique_ptr< Mapping< dim, spacedim > > clone() const override
SmartPointer< const VectorType, MappingFEField< dim, spacedim, VectorType, DoFHandlerType > > euler_vector
Outer normal vector, not normalized.
std::vector< unsigned int > fe_to_real
Determinant of the Jacobian.
Transformed quadrature points.
numbers::NumberTraits< Number >::real_type norm() const
#define AssertThrow(cond, exc)
ComponentMask get_component_mask() const
static::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
static DataSetDescriptor cell()
virtual std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBase > get_face_data(const UpdateFlags flags, const Quadrature< dim-1 > &quadrature) const override
Point< dim > do_transform_real_to_unit_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< spacedim > &p, const Point< dim > &initial_p_unit, InternalData &mdata) const
FEValues< dim, spacedim > fe_values
SymmetricTensor< 2, dim, Number > invert(const SymmetricTensor< 2, dim, Number > &)
std::vector< Tensor< 3, dim > > shape_third_derivatives
std::vector< Tensor< 1, dim > > shape_derivatives
const std::vector< Point< dim > > & get_points() const
unsigned int size() const
static::ExceptionBase & ExcMessage(std::string arg1)
std::vector< Tensor< 2, dim > > shape_second_derivatives
#define Assert(cond, exc)
Threads::Mutex fe_values_mutex
std::vector< Tensor< 4, dim > > shape_fourth_derivatives
static::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
Abstract base class for mapping classes.
virtual void transform(const ArrayView< const Tensor< 1, dim >> &input, const MappingType type, const typename Mapping< dim, spacedim >::InternalDataBase &internal, const ArrayView< Tensor< 1, spacedim >> &output) const override
const Tensor< 3, dim > & third_derivative(const unsigned int qpoint, const unsigned int shape_nr) const
unsigned int size() const
std::vector< double > volume_elements
void update_internal_dofs(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const typename MappingFEField< dim, spacedim, VectorType, DoFHandlerType >::InternalData &data) const
const Tensor< 2, dim > & second_derivative(const unsigned int qpoint, const unsigned int shape_nr) const
virtual Point< dim > transform_real_to_unit_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< spacedim > &p) const override
std::vector< DerivativeForm< 1, dim, spacedim > > covariant
const double & shape(const unsigned int qpoint, const unsigned int shape_nr) const
Gradient of volume element.
std::vector< double > local_dof_values
virtual std::array< Point< spacedim >, GeometryInfo< dim >::vertices_per_cell > get_vertices(const typename Triangulation< dim, spacedim >::cell_iterator &cell) const override
std::vector< DerivativeForm< 1, dim, spacedim > > contravariant
std::vector< double > shape_values
std::vector< std::vector< Tensor< 1, spacedim > > > aux
friend class MappingFEField
const std::vector< double > & get_weights() const
static Point< dim > project_to_unit_cell(const Point< dim > &p)
unsigned int get_degree() const
std::pair< unsigned int, unsigned int > system_to_component_index(const unsigned int index) const
const Tensor< 1, dim > & derivative(const unsigned int qpoint, const unsigned int shape_nr) const
SmartPointer< const DoFHandlerType, MappingFEField< dim, spacedim, VectorType, DoFHandlerType > > euler_dof_handler
const Tensor< 4, dim > & fourth_derivative(const unsigned int qpoint, const unsigned int shape_nr) const
virtual Point< spacedim > transform_unit_to_real_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< dim > &p) const override
static DataSetDescriptor subface(const unsigned int face_no, const unsigned int subface_no, const bool face_orientation, const bool face_flip, const bool face_rotation, const unsigned int n_quadrature_points, const internal::SubfaceCase< dim > ref_case=internal::SubfaceCase< dim >::case_isotropic)
virtual std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBase > get_subface_data(const UpdateFlags flags, const Quadrature< dim-1 > &quadrature) const override
static::ExceptionBase & ExcNotImplemented()
Point< spacedim > do_transform_unit_to_real_cell(const InternalData &mdata) const
typename ActiveSelector::cell_iterator cell_iterator
virtual bool preserves_vertex_locations() const override
virtual void compute_shapes_virtual(const std::vector< Point< dim >> &unit_points, typename MappingFEField< dim, spacedim, VectorType, DoFHandlerType >::InternalData &data) const
numbers::NumberTraits< Number >::real_type norm_square() const
static::ExceptionBase & ExcInactiveCell()
std::array< std::vector< Tensor< 1, dim > >, GeometryInfo< dim >::faces_per_cell *(dim-1)> unit_tangentials
static double subface_ratio(const internal::SubfaceCase< dim > &subface_case, const unsigned int subface_no)
Covariant transformation.
virtual std::size_t memory_consumption() const override
InternalData(const FiniteElement< dim, spacedim > &fe, const ComponentMask &mask)
virtual UpdateFlags requires_update_flags(const UpdateFlags update_flags) const override
static::ExceptionBase & ExcInternalError()
static DataSetDescriptor face(const unsigned int face_no, const bool face_orientation, const bool face_flip, const bool face_rotation, const unsigned int n_quadrature_points)