60template <
int dim,
int spacedim,
typename VectorType>
65 , n_shape_functions(fe.n_dofs_per_cell())
67 , local_dof_indices(fe.n_dofs_per_cell())
68 , local_dof_values(fe.n_dofs_per_cell())
73template <
int dim,
int spacedim,
typename VectorType>
84template <
int dim,
int spacedim,
typename VectorType>
87 const unsigned int qpoint,
88 const unsigned int shape_nr)
90 AssertIndexRange(qpoint * n_shape_functions + shape_nr, shape_values.size());
91 return shape_values[qpoint * n_shape_functions + shape_nr];
95template <
int dim,
int spacedim,
typename VectorType>
98 const unsigned int qpoint,
99 const unsigned int shape_nr)
const
102 shape_derivatives.size());
103 return shape_derivatives[qpoint * n_shape_functions + shape_nr];
108template <
int dim,
int spacedim,
typename VectorType>
111 const unsigned int qpoint,
112 const unsigned int shape_nr)
115 shape_derivatives.size());
116 return shape_derivatives[qpoint * n_shape_functions + shape_nr];
120template <
int dim,
int spacedim,
typename VectorType>
123 const unsigned int qpoint,
124 const unsigned int shape_nr)
const
127 shape_second_derivatives.size());
128 return shape_second_derivatives[qpoint * n_shape_functions + shape_nr];
133template <
int dim,
int spacedim,
typename VectorType>
136 const unsigned int qpoint,
137 const unsigned int shape_nr)
140 shape_second_derivatives.size());
141 return shape_second_derivatives[qpoint * n_shape_functions + shape_nr];
145template <
int dim,
int spacedim,
typename VectorType>
148 const unsigned int qpoint,
149 const unsigned int shape_nr)
const
152 shape_third_derivatives.size());
153 return shape_third_derivatives[qpoint * n_shape_functions + shape_nr];
158template <
int dim,
int spacedim,
typename VectorType>
161 const unsigned int qpoint,
162 const unsigned int shape_nr)
165 shape_third_derivatives.size());
166 return shape_third_derivatives[qpoint * n_shape_functions + shape_nr];
170template <
int dim,
int spacedim,
typename VectorType>
173 const unsigned int qpoint,
174 const unsigned int shape_nr)
const
177 shape_fourth_derivatives.size());
178 return shape_fourth_derivatives[qpoint * n_shape_functions + shape_nr];
183template <
int dim,
int spacedim,
typename VectorType>
186 const unsigned int qpoint,
187 const unsigned int shape_nr)
190 shape_fourth_derivatives.size());
191 return shape_fourth_derivatives[qpoint * n_shape_functions + shape_nr];
196template <
int dim,
int spacedim,
typename VectorType>
204 , euler_dof_handler(&euler_dof_handler)
205 , fe_mask(mask.size() != 0u ?
208 euler_dof_handler.get_fe().get_nonzero_components(0).size(),
210 , fe_to_real(fe_mask.size(),
numbers::invalid_unsigned_int)
211 , fe_values(this->euler_dof_handler->get_fe(),
212 reference_cell.template get_nodal_type_quadrature<dim>(),
215 unsigned int size = 0;
216 for (
unsigned int i = 0; i < fe_mask.size(); ++i)
219 fe_to_real[i] = size++;
226template <
int dim,
int spacedim,
typename VectorType>
229 const std::vector<VectorType> & euler_vector,
231 : reference_cell(euler_dof_handler.get_fe().reference_cell())
232 , uses_level_dofs(true)
233 , euler_dof_handler(&euler_dof_handler)
234 , fe_mask(mask.size() != 0u ?
237 euler_dof_handler.get_fe().get_nonzero_components(0).size(),
239 , fe_to_real(fe_mask.size(),
numbers::invalid_unsigned_int)
240 , fe_values(this->euler_dof_handler->get_fe(),
241 reference_cell.template get_nodal_type_quadrature<dim>(),
244 unsigned int size = 0;
253 ExcMessage(
"The underlying DoFHandler object did not call "
254 "distribute_mg_dofs(). In this case, the construction via "
255 "level vectors does not make sense."));
258 this->euler_vector.clear();
266template <
int dim,
int spacedim,
typename VectorType>
271 : reference_cell(euler_dof_handler.get_fe().reference_cell())
272 , uses_level_dofs(true)
273 , euler_dof_handler(&euler_dof_handler)
274 , fe_mask(mask.size() != 0u ?
277 euler_dof_handler.get_fe().get_nonzero_components(0).size(),
279 , fe_to_real(fe_mask.size(),
numbers::invalid_unsigned_int)
280 , fe_values(this->euler_dof_handler->get_fe(),
281 reference_cell.template get_nodal_type_quadrature<dim>(),
284 unsigned int size = 0;
293 ExcMessage(
"The underlying DoFHandler object did not call "
294 "distribute_mg_dofs(). In this case, the construction via "
295 "level vectors does not make sense."));
298 this->euler_vector.clear();
299 this->euler_vector.
resize(
308template <
int dim,
int spacedim,
typename VectorType>
311 : reference_cell(mapping.reference_cell)
312 , uses_level_dofs(mapping.uses_level_dofs)
313 , euler_vector(mapping.euler_vector)
314 , euler_dof_handler(mapping.euler_dof_handler)
315 , fe_mask(mapping.fe_mask)
316 , fe_to_real(mapping.fe_to_real)
317 , fe_values(mapping.euler_dof_handler->get_fe(),
318 reference_cell.template get_nodal_type_quadrature<dim>(),
324template <
int dim,
int spacedim,
typename VectorType>
327 const unsigned int qpoint,
328 const unsigned int shape_nr)
const
336template <
int dim,
int spacedim,
typename VectorType>
345template <
int dim,
int spacedim,
typename VectorType>
351 ExcMessage(
"The dimension of your mapping (" +
353 ") and the reference cell cell_type (" +
355 " ) do not agree."));
362template <
int dim,
int spacedim,
typename VectorType>
363boost::container::small_vector<Point<spacedim>,
390 const unsigned int dofs_per_cell =
392 std::vector<types::global_dof_index> dof_indices(dofs_per_cell);
394 dof_cell->get_mg_dof_indices(dof_indices);
396 dof_cell->get_dof_indices(dof_indices);
398 const VectorType &vector =
401 boost::container::small_vector<Point<spacedim>,
404 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
410 typename VectorType::value_type value =
413 for (
const unsigned int v : cell->vertex_indices())
425template <
int dim,
int spacedim,
typename VectorType>
432 const unsigned int n_points = unit_points.size();
434 for (
unsigned int point = 0; point < n_points; ++point)
438 data.
shape(point, i) = fe->shape_value(i, unit_points[point]);
442 data.
derivative(point, i) = fe->shape_grad(i, unit_points[point]);
447 fe->shape_grad_grad(i, unit_points[point]);
452 fe->shape_3rd_derivative(i, unit_points[point]);
457 fe->shape_4th_derivative(i, unit_points[point]);
462template <
int dim,
int spacedim,
typename VectorType>
474 for (
unsigned int i = 0; i < 5; ++i)
517template <
int dim,
int spacedim,
typename VectorType>
522 const unsigned int n_original_q_points,
530 const unsigned int n_q_points = q.
size();
537 if (data.update_each &
544 data.
covariant.resize(n_original_q_points);
552 if (data.update_each &
572template <
int dim,
int spacedim,
typename VectorType>
577 const unsigned int n_original_q_points,
580 compute_data(update_flags, q, n_original_q_points, data);
594 for (
unsigned int i = 0; i < n_faces; ++i)
604 n_original_q_points);
616template <
int dim,
int spacedim,
typename VectorType>
617typename std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
622 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase> data_ptr =
632template <
int dim,
int spacedim,
typename VectorType>
633std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
640 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase> data_ptr =
651template <
int dim,
int spacedim,
typename VectorType>
652std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
657 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase> data_ptr =
671 namespace MappingFEFieldImplementation
681 template <
int dim,
int spacedim,
typename VectorType>
683 maybe_compute_q_points(
684 const typename ::QProjector<dim>::DataSetDescriptor data_set,
685 const typename ::MappingFEField<dim, spacedim, VectorType>::
689 const std::vector<unsigned int> & fe_to_real,
690 std::vector<Point<spacedim>> & quadrature_points)
696 for (
unsigned int point = 0; point < quadrature_points.size();
700 const double * shape = &data.shape(point + data_set, 0);
702 for (
unsigned int k = 0; k < data.n_shape_functions; ++k)
704 const unsigned int comp_k =
705 fe.system_to_component_index(k).first;
707 result[fe_to_real[comp_k]] +=
708 data.local_dof_values[k] * shape[k];
711 quadrature_points[point] = result;
723 template <
int dim,
int spacedim,
typename VectorType>
725 maybe_update_Jacobians(
726 const typename ::QProjector<dim>::DataSetDescriptor data_set,
727 const typename ::MappingFEField<dim, spacedim, VectorType>::
731 const std::vector<unsigned int> & fe_to_real)
738 const unsigned int n_q_points = data.contravariant.size();
742 for (
unsigned int point = 0; point < n_q_points; ++point)
745 &data.derivative(point + data_set, 0);
749 for (
unsigned int k = 0; k < data.n_shape_functions; ++k)
751 const unsigned int comp_k =
752 fe.system_to_component_index(k).first;
754 result[fe_to_real[comp_k]] +=
755 data.local_dof_values[k] * data_derv[k];
759 for (
unsigned int i = 0; i < spacedim; ++i)
761 data.contravariant[point][i] = result[i];
769 for (
unsigned int point = 0; point < data.contravariant.size();
771 data.covariant[point] =
772 (data.contravariant[point]).covariant_form();
778 data.volume_elements.size());
779 for (
unsigned int point = 0; point < data.contravariant.size();
781 data.volume_elements[point] =
782 data.contravariant[point].determinant();
792 template <
int dim,
int spacedim,
typename VectorType>
794 maybe_update_jacobian_grads(
795 const typename ::QProjector<dim>::DataSetDescriptor data_set,
796 const typename ::MappingFEField<dim, spacedim, VectorType>::
800 const std::vector<unsigned int> & fe_to_real,
801 std::vector<DerivativeForm<2, dim, spacedim>> &jacobian_grads)
806 const unsigned int n_q_points = jacobian_grads.size();
808 for (
unsigned int point = 0; point < n_q_points; ++point)
811 &data.second_derivative(point + data_set, 0);
815 for (
unsigned int k = 0; k < data.n_shape_functions; ++k)
817 const unsigned int comp_k =
818 fe.system_to_component_index(k).first;
820 for (
unsigned int j = 0; j < dim; ++j)
821 for (
unsigned int l = 0; l < dim; ++l)
822 result[fe_to_real[comp_k]][j][l] +=
823 (
second[k][j][l] * data.local_dof_values[k]);
828 for (
unsigned int i = 0; i < spacedim; ++i)
829 for (
unsigned int j = 0; j < dim; ++j)
830 for (
unsigned int l = 0; l < dim; ++l)
831 jacobian_grads[point][i][j][l] = result[i][j][l];
842 template <
int dim,
int spacedim,
typename VectorType>
844 maybe_update_jacobian_pushed_forward_grads(
845 const typename ::QProjector<dim>::DataSetDescriptor data_set,
846 const typename ::MappingFEField<dim, spacedim, VectorType>::
850 const std::vector<unsigned int> & fe_to_real,
851 std::vector<Tensor<3, spacedim>> & jacobian_pushed_forward_grads)
856 const unsigned int n_q_points =
857 jacobian_pushed_forward_grads.size();
859 double tmp[spacedim][spacedim][spacedim];
860 for (
unsigned int point = 0; point < n_q_points; ++point)
863 &data.second_derivative(point + data_set, 0);
867 for (
unsigned int k = 0; k < data.n_shape_functions; ++k)
869 const unsigned int comp_k =
870 fe.system_to_component_index(k).first;
872 for (
unsigned int j = 0; j < dim; ++j)
873 for (
unsigned int l = 0; l < dim; ++l)
874 result[fe_to_real[comp_k]][j][l] +=
875 (
second[k][j][l] * data.local_dof_values[k]);
879 for (
unsigned int i = 0; i < spacedim; ++i)
880 for (
unsigned int j = 0; j < spacedim; ++j)
881 for (
unsigned int l = 0; l < dim; ++l)
884 result[i][0][l] * data.covariant[point][j][0];
885 for (
unsigned int jr = 1; jr < dim; ++jr)
888 result[i][jr][l] * data.covariant[point][j][jr];
893 for (
unsigned int i = 0; i < spacedim; ++i)
894 for (
unsigned int j = 0; j < spacedim; ++j)
895 for (
unsigned int l = 0; l < spacedim; ++l)
897 jacobian_pushed_forward_grads[point][i][j][l] =
898 tmp[i][j][0] * data.covariant[point][l][0];
899 for (
unsigned int lr = 1; lr < dim; ++lr)
901 jacobian_pushed_forward_grads[point][i][j][l] +=
902 tmp[i][j][lr] * data.covariant[point][l][lr];
915 template <
int dim,
int spacedim,
typename VectorType>
917 maybe_update_jacobian_2nd_derivatives(
918 const typename ::QProjector<dim>::DataSetDescriptor data_set,
919 const typename ::MappingFEField<dim, spacedim, VectorType>::
923 const std::vector<unsigned int> & fe_to_real,
924 std::vector<DerivativeForm<3, dim, spacedim>> &jacobian_2nd_derivatives)
929 const unsigned int n_q_points = jacobian_2nd_derivatives.size();
931 for (
unsigned int point = 0; point < n_q_points; ++point)
934 &data.third_derivative(point + data_set, 0);
938 for (
unsigned int k = 0; k < data.n_shape_functions; ++k)
940 const unsigned int comp_k =
941 fe.system_to_component_index(k).first;
943 for (
unsigned int j = 0; j < dim; ++j)
944 for (
unsigned int l = 0; l < dim; ++l)
945 for (
unsigned int m = 0; m < dim; ++m)
946 result[fe_to_real[comp_k]][j][l][m] +=
947 (third[k][j][l][m] * data.local_dof_values[k]);
952 for (
unsigned int i = 0; i < spacedim; ++i)
953 for (
unsigned int j = 0; j < dim; ++j)
954 for (
unsigned int l = 0; l < dim; ++l)
955 for (
unsigned int m = 0; m < dim; ++m)
956 jacobian_2nd_derivatives[point][i][j][l][m] =
969 template <
int dim,
int spacedim,
typename VectorType>
971 maybe_update_jacobian_pushed_forward_2nd_derivatives(
972 const typename ::QProjector<dim>::DataSetDescriptor data_set,
973 const typename ::MappingFEField<dim, spacedim, VectorType>::
977 const std::vector<unsigned int> & fe_to_real,
978 std::vector<Tensor<4, spacedim>>
979 &jacobian_pushed_forward_2nd_derivatives)
984 const unsigned int n_q_points =
985 jacobian_pushed_forward_2nd_derivatives.size();
987 double tmp[spacedim][spacedim][spacedim][spacedim];
988 for (
unsigned int point = 0; point < n_q_points; ++point)
991 &data.third_derivative(point + data_set, 0);
995 for (
unsigned int k = 0; k < data.n_shape_functions; ++k)
997 const unsigned int comp_k =
998 fe.system_to_component_index(k).first;
1000 for (
unsigned int j = 0; j < dim; ++j)
1001 for (
unsigned int l = 0; l < dim; ++l)
1002 for (
unsigned int m = 0; m < dim; ++m)
1003 result[fe_to_real[comp_k]][j][l][m] +=
1004 (third[k][j][l][m] * data.local_dof_values[k]);
1008 for (
unsigned int i = 0; i < spacedim; ++i)
1009 for (
unsigned int j = 0; j < spacedim; ++j)
1010 for (
unsigned int l = 0; l < dim; ++l)
1011 for (
unsigned int m = 0; m < dim; ++m)
1013 jacobian_pushed_forward_2nd_derivatives
1014 [point][i][j][l][m] =
1015 result[i][0][l][m] * data.covariant[point][j][0];
1016 for (
unsigned int jr = 1; jr < dim; ++jr)
1017 jacobian_pushed_forward_2nd_derivatives[point][i][j]
1019 result[i][jr][l][m] *
1020 data.covariant[point][j][jr];
1024 for (
unsigned int i = 0; i < spacedim; ++i)
1025 for (
unsigned int j = 0; j < spacedim; ++j)
1026 for (
unsigned int l = 0; l < spacedim; ++l)
1027 for (
unsigned int m = 0; m < dim; ++m)
1030 jacobian_pushed_forward_2nd_derivatives[point][i][j]
1032 data.covariant[point][l][0];
1033 for (
unsigned int lr = 1; lr < dim; ++lr)
1035 jacobian_pushed_forward_2nd_derivatives[point][i]
1038 data.covariant[point][l][lr];
1042 for (
unsigned int i = 0; i < spacedim; ++i)
1043 for (
unsigned int j = 0; j < spacedim; ++j)
1044 for (
unsigned int l = 0; l < spacedim; ++l)
1045 for (
unsigned int m = 0; m < spacedim; ++m)
1047 jacobian_pushed_forward_2nd_derivatives
1048 [point][i][j][l][m] =
1049 tmp[i][j][l][0] * data.covariant[point][m][0];
1050 for (
unsigned int mr = 1; mr < dim; ++mr)
1051 jacobian_pushed_forward_2nd_derivatives[point][i][j]
1053 tmp[i][j][l][mr] * data.covariant[point][m][mr];
1065 template <
int dim,
int spacedim,
typename VectorType>
1067 maybe_update_jacobian_3rd_derivatives(
1068 const typename ::QProjector<dim>::DataSetDescriptor data_set,
1069 const typename ::MappingFEField<dim, spacedim, VectorType>::
1070 InternalData & data,
1073 const std::vector<unsigned int> & fe_to_real,
1074 std::vector<DerivativeForm<4, dim, spacedim>> &jacobian_3rd_derivatives)
1076 const UpdateFlags update_flags = data.update_each;
1079 const unsigned int n_q_points = jacobian_3rd_derivatives.size();
1081 for (
unsigned int point = 0; point < n_q_points; ++point)
1084 &data.fourth_derivative(point + data_set, 0);
1088 for (
unsigned int k = 0; k < data.n_shape_functions; ++k)
1090 const unsigned int comp_k =
1091 fe.system_to_component_index(k).first;
1092 if (fe_mask[comp_k])
1093 for (
unsigned int j = 0; j < dim; ++j)
1094 for (
unsigned int l = 0; l < dim; ++l)
1095 for (
unsigned int m = 0; m < dim; ++m)
1096 for (
unsigned int n = 0; n < dim; ++n)
1097 result[fe_to_real[comp_k]][j][l][m][n] +=
1098 (fourth[k][j][l][m][n] *
1099 data.local_dof_values[k]);
1105 for (
unsigned int i = 0; i < spacedim; ++i)
1106 for (
unsigned int j = 0; j < dim; ++j)
1107 for (
unsigned int l = 0; l < dim; ++l)
1108 for (
unsigned int m = 0; m < dim; ++m)
1109 for (
unsigned int n = 0; n < dim; ++n)
1110 jacobian_3rd_derivatives[point][i][j][l][m][n] =
1111 result[i][j][l][m][n];
1123 template <
int dim,
int spacedim,
typename VectorType>
1125 maybe_update_jacobian_pushed_forward_3rd_derivatives(
1126 const typename ::QProjector<dim>::DataSetDescriptor data_set,
1127 const typename ::MappingFEField<dim, spacedim, VectorType>::
1128 InternalData & data,
1131 const std::vector<unsigned int> & fe_to_real,
1132 std::vector<Tensor<5, spacedim>>
1133 &jacobian_pushed_forward_3rd_derivatives)
1135 const UpdateFlags update_flags = data.update_each;
1138 const unsigned int n_q_points =
1139 jacobian_pushed_forward_3rd_derivatives.size();
1141 double tmp[spacedim][spacedim][spacedim][spacedim][spacedim];
1142 for (
unsigned int point = 0; point < n_q_points; ++point)
1145 &data.fourth_derivative(point + data_set, 0);
1149 for (
unsigned int k = 0; k < data.n_shape_functions; ++k)
1151 const unsigned int comp_k =
1152 fe.system_to_component_index(k).first;
1153 if (fe_mask[comp_k])
1154 for (
unsigned int j = 0; j < dim; ++j)
1155 for (
unsigned int l = 0; l < dim; ++l)
1156 for (
unsigned int m = 0; m < dim; ++m)
1157 for (
unsigned int n = 0; n < dim; ++n)
1158 result[fe_to_real[comp_k]][j][l][m][n] +=
1159 (fourth[k][j][l][m][n] *
1160 data.local_dof_values[k]);
1164 for (
unsigned int i = 0; i < spacedim; ++i)
1165 for (
unsigned int j = 0; j < spacedim; ++j)
1166 for (
unsigned int l = 0; l < dim; ++l)
1167 for (
unsigned int m = 0; m < dim; ++m)
1168 for (
unsigned int n = 0; n < dim; ++n)
1170 tmp[i][j][l][m][n] = result[i][0][l][m][n] *
1171 data.covariant[point][j][0];
1172 for (
unsigned int jr = 1; jr < dim; ++jr)
1173 tmp[i][j][l][m][n] +=
1174 result[i][jr][l][m][n] *
1175 data.covariant[point][j][jr];
1179 for (
unsigned int i = 0; i < spacedim; ++i)
1180 for (
unsigned int j = 0; j < spacedim; ++j)
1181 for (
unsigned int l = 0; l < spacedim; ++l)
1182 for (
unsigned int m = 0; m < dim; ++m)
1183 for (
unsigned int n = 0; n < dim; ++n)
1185 jacobian_pushed_forward_3rd_derivatives
1186 [point][i][j][l][m][n] =
1187 tmp[i][j][0][m][n] *
1188 data.covariant[point][l][0];
1189 for (
unsigned int lr = 1; lr < dim; ++lr)
1190 jacobian_pushed_forward_3rd_derivatives[point][i]
1193 tmp[i][j][lr][m][n] *
1194 data.covariant[point][l][lr];
1198 for (
unsigned int i = 0; i < spacedim; ++i)
1199 for (
unsigned int j = 0; j < spacedim; ++j)
1200 for (
unsigned int l = 0; l < spacedim; ++l)
1201 for (
unsigned int m = 0; m < spacedim; ++m)
1202 for (
unsigned int n = 0; n < dim; ++n)
1204 tmp[i][j][l][m][n] =
1205 jacobian_pushed_forward_3rd_derivatives[point][i]
1208 data.covariant[point][m][0];
1209 for (
unsigned int mr = 1; mr < dim; ++mr)
1210 tmp[i][j][l][m][n] +=
1211 jacobian_pushed_forward_3rd_derivatives[point]
1214 data.covariant[point][m][mr];
1218 for (
unsigned int i = 0; i < spacedim; ++i)
1219 for (
unsigned int j = 0; j < spacedim; ++j)
1220 for (
unsigned int l = 0; l < spacedim; ++l)
1221 for (
unsigned int m = 0; m < spacedim; ++m)
1222 for (
unsigned int n = 0; n < spacedim; ++n)
1224 jacobian_pushed_forward_3rd_derivatives
1225 [point][i][j][l][m][n] =
1226 tmp[i][j][l][m][0] *
1227 data.covariant[point][n][0];
1228 for (
unsigned int nr = 1; nr < dim; ++nr)
1229 jacobian_pushed_forward_3rd_derivatives[point][i]
1232 tmp[i][j][l][m][nr] *
1233 data.covariant[point][n][nr];
1249 template <
int dim,
int spacedim,
typename VectorType>
1251 maybe_compute_face_data(
1252 const ::Mapping<dim, spacedim> &mapping,
1253 const typename ::Triangulation<dim, spacedim>::cell_iterator
1255 const unsigned int face_no,
1256 const unsigned int subface_no,
1258 const typename ::MappingFEField<dim, spacedim, VectorType>::
1263 const UpdateFlags update_flags = data.update_each;
1267 const unsigned int n_q_points = output_data.boundary_forms.size();
1276 for (
unsigned int d = 0; d != dim - 1; ++d)
1278 Assert(face_no + cell->n_faces() * d <
1279 data.unit_tangentials.size(),
1282 data.aux[d].size() <=
1283 data.unit_tangentials[face_no + cell->n_faces() * d].size(),
1288 data.unit_tangentials[face_no + cell->n_faces() * d]),
1296 if (dim == spacedim)
1298 for (
unsigned int i = 0; i < n_q_points; ++i)
1306 output_data.boundary_forms[i][0] =
1307 (face_no == 0 ? -1 : +1);
1310 output_data.boundary_forms[i] =
1311 cross_product_2d(data.aux[0][i]);
1314 output_data.boundary_forms[i] =
1315 cross_product_3d(data.aux[0][i], data.aux[1][i]);
1331 for (
unsigned int point = 0; point < n_q_points; ++point)
1336 output_data.boundary_forms[point] =
1337 data.contravariant[point].transpose()[0];
1338 output_data.boundary_forms[point] /=
1339 (face_no == 0 ? -1. : +1.) *
1340 output_data.boundary_forms[point].norm();
1349 cross_product_3d(DX_t[0], DX_t[1]);
1350 cell_normal /= cell_normal.
norm();
1354 output_data.boundary_forms[point] =
1355 cross_product_3d(data.aux[0][point], cell_normal);
1361 for (
unsigned int i = 0; i < output_data.boundary_forms.size();
1366 output_data.JxW_values[i] =
1367 output_data.boundary_forms[i].norm() *
1368 data.quadrature_weights[i + data_set];
1373 const double area_ratio =
1375 cell->subface_case(face_no), subface_no);
1376 output_data.JxW_values[i] *= area_ratio;
1381 output_data.normal_vectors[i] =
1383 output_data.boundary_forms[i].norm());
1394 template <
int dim,
int spacedim,
typename VectorType>
1396 do_fill_fe_face_values(
1397 const ::Mapping<dim, spacedim> &mapping,
1398 const typename ::Triangulation<dim, spacedim>::cell_iterator
1400 const unsigned int face_no,
1401 const unsigned int subface_no,
1402 const typename ::QProjector<dim>::DataSetDescriptor data_set,
1403 const typename ::MappingFEField<dim, spacedim, VectorType>::
1404 InternalData & data,
1407 const std::vector<unsigned int> & fe_to_real,
1411 maybe_compute_q_points<dim, spacedim, VectorType>(
1417 output_data.quadrature_points);
1419 maybe_update_Jacobians<dim, spacedim, VectorType>(
1420 data_set, data, fe, fe_mask, fe_to_real);
1422 const UpdateFlags update_flags = data.update_each;
1423 const unsigned int n_q_points = data.contravariant.size();
1426 for (
unsigned int point = 0; point < n_q_points; ++point)
1427 output_data.jacobians[point] = data.contravariant[point];
1430 for (
unsigned int point = 0; point < n_q_points; ++point)
1431 output_data.inverse_jacobians[point] =
1432 data.covariant[point].transpose();
1434 maybe_update_jacobian_grads<dim, spacedim, VectorType>(
1435 data_set, data, fe, fe_mask, fe_to_real, output_data.jacobian_grads);
1437 maybe_update_jacobian_pushed_forward_grads<dim, spacedim, VectorType>(
1443 output_data.jacobian_pushed_forward_grads);
1445 maybe_update_jacobian_2nd_derivatives<dim, spacedim, VectorType>(
1451 output_data.jacobian_2nd_derivatives);
1453 maybe_update_jacobian_pushed_forward_2nd_derivatives<dim,
1461 output_data.jacobian_pushed_forward_2nd_derivatives);
1463 maybe_update_jacobian_3rd_derivatives<dim, spacedim, VectorType>(
1469 output_data.jacobian_3rd_derivatives);
1471 maybe_update_jacobian_pushed_forward_3rd_derivatives<dim,
1479 output_data.jacobian_pushed_forward_3rd_derivatives);
1481 maybe_compute_face_data<dim, spacedim, VectorType>(
1482 mapping, cell, face_no, subface_no, data_set, data, output_data);
1491template <
int dim,
int spacedim,
typename VectorType>
1507 const unsigned int n_q_points = quadrature.
size();
1511 internal::MappingFEFieldImplementation::
1512 maybe_compute_q_points<dim, spacedim, VectorType>(
1520 internal::MappingFEFieldImplementation::
1521 maybe_update_Jacobians<dim, spacedim, VectorType>(
1528 const UpdateFlags update_flags = data.update_each;
1529 const std::vector<double> &weights = quadrature.
get_weights();
1544 for (
unsigned int point = 0; point < n_q_points; ++point)
1546 if (dim == spacedim)
1555 Assert(det > 1e-12 * Utilities::fixed_power<dim>(
1556 cell->diameter() /
std::sqrt(
double(dim))),
1558 cell->center(), det, point)));
1559 output_data.
JxW_values[point] = weights[point] * det;
1567 for (
unsigned int i = 0; i < spacedim; ++i)
1568 for (
unsigned int j = 0; j < dim; ++j)
1572 for (
unsigned int i = 0; i < dim; ++i)
1573 for (
unsigned int j = 0; j < dim; ++j)
1574 G[i][j] = DX_t[i] * DX_t[j];
1581 Assert(spacedim - dim == 1,
1582 ExcMessage(
"There is no cell normal in codim 2."));
1586 cross_product_2d(-DX_t[0]);
1594 cross_product_3d(DX_t[0], DX_t[dim - 1]);
1600 if (cell->direction_flag() ==
false)
1611 for (
unsigned int point = 0; point < n_q_points; ++point)
1619 for (
unsigned int point = 0; point < n_q_points; ++point)
1625 internal::MappingFEFieldImplementation::
1626 maybe_update_jacobian_grads<dim, spacedim, VectorType>(
1636 internal::MappingFEFieldImplementation::
1637 maybe_update_jacobian_pushed_forward_grads<dim, spacedim, VectorType>(
1646 internal::MappingFEFieldImplementation::
1647 maybe_update_jacobian_2nd_derivatives<dim, spacedim, VectorType>(
1656 internal::MappingFEFieldImplementation::
1657 maybe_update_jacobian_pushed_forward_2nd_derivatives<dim,
1668 internal::MappingFEFieldImplementation::
1669 maybe_update_jacobian_3rd_derivatives<dim, spacedim, VectorType>(
1679 internal::MappingFEFieldImplementation::
1680 maybe_update_jacobian_pushed_forward_3rd_derivatives<dim,
1695template <
int dim,
int spacedim,
typename VectorType>
1699 const unsigned int face_no,
1715 internal::MappingFEFieldImplementation::
1716 do_fill_fe_face_values<dim, spacedim, VectorType>(
1723 cell->face_orientation(face_no),
1724 cell->face_flip(face_no),
1725 cell->face_rotation(face_no),
1726 quadrature[0].
size()),
1735template <
int dim,
int spacedim,
typename VectorType>
1739 const unsigned int face_no,
1740 const unsigned int subface_no,
1754 internal::MappingFEFieldImplementation::do_fill_fe_face_values<dim,
1764 cell->face_orientation(face_no),
1765 cell->face_flip(face_no),
1766 cell->face_rotation(face_no),
1768 cell->subface_case(face_no)),
1778template <
int dim,
int spacedim,
typename VectorType>
1792 const unsigned int n_q_points = quadrature.
size();
1796 internal::MappingFEFieldImplementation::
1797 maybe_compute_q_points<dim, spacedim, VectorType>(
1805 internal::MappingFEFieldImplementation::
1806 maybe_update_Jacobians<dim, spacedim, VectorType>(
1813 const UpdateFlags update_flags = data.update_each;
1814 const std::vector<double> &weights = quadrature.
get_weights();
1826 for (
unsigned int point = 0; point < n_q_points; ++point)
1835 Assert(det > 1e-12 * Utilities::fixed_power<dim>(
1836 cell->diameter() /
std::sqrt(
double(dim))),
1838 cell->center(), det, point)));
1842 for (
unsigned int d = 0; d < spacedim; d++)
1846 output_data.
JxW_values[point] = weights[point] * det * normal.
norm();
1850 normal /= normal.
norm();
1859 for (
unsigned int point = 0; point < n_q_points; ++point)
1867 for (
unsigned int point = 0; point < n_q_points; ++point)
1873 internal::MappingFEFieldImplementation::
1874 maybe_update_jacobian_grads<dim, spacedim, VectorType>(
1884 internal::MappingFEFieldImplementation::
1885 maybe_update_jacobian_pushed_forward_grads<dim, spacedim, VectorType>(
1894 internal::MappingFEFieldImplementation::
1895 maybe_update_jacobian_2nd_derivatives<dim, spacedim, VectorType>(
1905 internal::MappingFEFieldImplementation::
1906 maybe_update_jacobian_pushed_forward_2nd_derivatives<dim,
1917 internal::MappingFEFieldImplementation::
1918 maybe_update_jacobian_3rd_derivatives<dim, spacedim, VectorType>(
1928 internal::MappingFEFieldImplementation::
1929 maybe_update_jacobian_pushed_forward_3rd_derivatives<dim,
1943 namespace MappingFEFieldImplementation
1947 template <
int dim,
int spacedim,
int rank,
typename VectorType>
1958 MappingFEField<dim, spacedim, VectorType>::InternalData *
>(
1959 &mapping_data) !=
nullptr),
1961 const typename ::MappingFEField<dim, spacedim, VectorType>::
1962 InternalData &data =
static_cast<
1963 const typename ::MappingFEField<dim, spacedim, VectorType>::
1964 InternalData &
>(mapping_data);
1966 switch (mapping_kind)
1973 "update_contravariant_transformation"));
1975 for (
unsigned int i = 0; i < output.size(); ++i)
1987 "update_contravariant_transformation"));
1991 "update_volume_elements"));
1993 for (
unsigned int i = 0; i < output.size(); ++i)
1997 output[i] /= data.volume_elements[i];
2011 "update_contravariant_transformation"));
2013 for (
unsigned int i = 0; i < output.size(); ++i)
2025 template <
int dim,
int spacedim,
int rank,
typename VectorType>
2036 MappingFEField<dim, spacedim, VectorType>::InternalData *
>(
2037 &mapping_data) !=
nullptr),
2039 const typename ::MappingFEField<dim, spacedim, VectorType>::
2040 InternalData &data =
static_cast<
2041 const typename ::MappingFEField<dim, spacedim, VectorType>::
2042 InternalData &
>(mapping_data);
2044 switch (mapping_kind)
2051 "update_contravariant_transformation"));
2053 for (
unsigned int i = 0; i < output.size(); ++i)
2068template <
int dim,
int spacedim,
typename VectorType>
2078 internal::MappingFEFieldImplementation::
2079 transform_fields<dim, spacedim, 1, VectorType>(input,
2087template <
int dim,
int spacedim,
typename VectorType>
2097 internal::MappingFEFieldImplementation::
2098 transform_differential_forms<dim, spacedim, 1, VectorType>(input,
2106template <
int dim,
int spacedim,
typename VectorType>
2124template <
int dim,
int spacedim,
typename VectorType>
2137 switch (mapping_kind)
2143 "update_covariant_transformation"));
2145 for (
unsigned int q = 0; q < output.size(); ++q)
2146 for (
unsigned int i = 0; i < spacedim; ++i)
2147 for (
unsigned int j = 0; j < spacedim; ++j)
2148 for (
unsigned int k = 0; k < spacedim; ++k)
2150 output[q][i][j][k] = data.
covariant[q][j][0] *
2153 for (
unsigned int J = 0; J < dim; ++J)
2155 const unsigned int K0 = (0 == J) ? 1 : 0;
2156 for (
unsigned int K = K0; K < dim; ++K)
2157 output[q][i][j][k] += data.
covariant[q][j][J] *
2172template <
int dim,
int spacedim,
typename VectorType>
2190template <
int dim,
int spacedim,
typename VectorType>
2200 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase> mdata(
2211template <
int dim,
int spacedim,
typename VectorType>
2220 unsigned int comp_i =
2232template <
int dim,
int spacedim,
typename VectorType>
2251 for (
unsigned int d = 0; d < dim; ++d)
2252 initial_p_unit[d] = 0.5;
2266 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase> mdata(
2267 get_data(update_flags, point_quadrature));
2280template <
int dim,
int spacedim,
typename VectorType>
2288 const unsigned int n_shapes = mdata.
shape_values.size();
2308 const double eps = 1.e-12 * cell->diameter();
2309 const unsigned int newton_iteration_limit = 20;
2310 unsigned int newton_iteration = 0;
2319 const unsigned int comp_k =
2322 for (
unsigned int j = 0; j < dim; ++j)
2326 for (
unsigned int j = 0; j < dim; ++j)
2328 f[j] = DF[j] * p_minus_F;
2329 for (
unsigned int l = 0; l < dim; ++l)
2330 df[j][l] = -DF[j] * DF[l];
2336 double step_length = 1;
2349 for (
unsigned int i = 0; i < dim; ++i)
2350 p_unit_trial[i] -= step_length * delta[i];
2360 if (f_trial.
norm() < p_minus_F.
norm())
2362 p_real = p_real_trial;
2363 p_unit = p_unit_trial;
2364 p_minus_F = f_trial;
2367 else if (step_length > 0.05)
2374 if (newton_iteration > newton_iteration_limit)
2391template <
int dim,
int spacedim,
typename VectorType>
2400template <
int dim,
int spacedim,
typename VectorType>
2408template <
int dim,
int spacedim,
typename VectorType>
2409std::unique_ptr<Mapping<dim, spacedim>>
2412 return std::make_unique<MappingFEField<dim, spacedim, VectorType>>(*this);
2416template <
int dim,
int spacedim,
typename VectorType>
2443 const VectorType &vector =
2453#define SPLIT_INSTANTIATIONS_COUNT 2
2454#ifndef SPLIT_INSTANTIATIONS_INDEX
2455# define SPLIT_INSTANTIATIONS_INDEX 0
2457#include "mapping_fe_field.inst"
ArrayView< typename std::remove_reference< typename std::iterator_traits< Iterator >::reference >::type, MemorySpaceType > make_array_view(const Iterator begin, const Iterator end)
unsigned int size() const
void resize(const unsigned int new_minlevel, const unsigned int new_maxlevel, Args &&...args)
const Tensor< 3, dim > & third_derivative(const unsigned int qpoint, const unsigned int shape_nr) const
std::array< std::vector< Tensor< 1, dim > >, GeometryInfo< dim >::faces_per_cell *(dim - 1)> unit_tangentials
InternalData(const FiniteElement< dim, spacedim > &fe, const ComponentMask &mask)
std::vector< double > quadrature_weights
std::vector< DerivativeForm< 1, dim, spacedim > > contravariant
std::vector< std::vector< Tensor< 1, spacedim > > > aux
std::vector< Tensor< 4, dim > > shape_fourth_derivatives
std::vector< Tensor< 3, dim > > shape_third_derivatives
const Tensor< 2, dim > & second_derivative(const unsigned int qpoint, const unsigned int shape_nr) const
std::vector< types::global_dof_index > local_dof_indices
virtual std::size_t memory_consumption() const override
const Tensor< 4, dim > & fourth_derivative(const unsigned int qpoint, const unsigned int shape_nr) const
std::vector< Tensor< 1, dim > > shape_derivatives
unsigned int n_shape_functions
std::vector< DerivativeForm< 1, dim, spacedim > > covariant
const Tensor< 1, dim > & derivative(const unsigned int qpoint, const unsigned int shape_nr) const
std::vector< double > local_dof_values
const double & shape(const unsigned int qpoint, const unsigned int shape_nr) const
std::vector< double > shape_values
std::vector< Tensor< 2, dim > > shape_second_derivatives
std::vector< double > volume_elements
virtual boost::container::small_vector< Point< spacedim >, GeometryInfo< dim >::vertices_per_cell > get_vertices(const typename Triangulation< dim, spacedim >::cell_iterator &cell) const override
std::vector< unsigned int > fe_to_real
virtual std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBase > get_subface_data(const UpdateFlags flags, const Quadrature< dim - 1 > &quadrature) const override
const ComponentMask fe_mask
void update_internal_dofs(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const typename MappingFEField< dim, spacedim, VectorType >::InternalData &data) const
virtual void transform(const ArrayView< const Tensor< 1, dim > > &input, const MappingKind kind, const typename Mapping< dim, spacedim >::InternalDataBase &internal, const ArrayView< Tensor< 1, spacedim > > &output) const override
void compute_face_data(const UpdateFlags update_flags, const Quadrature< dim > &q, const unsigned int n_original_q_points, InternalData &data) const
virtual Point< spacedim > transform_unit_to_real_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< dim > &p) const override
std::vector< SmartPointer< const VectorType, MappingFEField< dim, spacedim, VectorType > > > euler_vector
virtual bool preserves_vertex_locations() const override
virtual Point< dim > transform_real_to_unit_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< spacedim > &p) const override
virtual std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBase > get_face_data(const UpdateFlags flags, const hp::QCollection< dim - 1 > &quadrature) const override
virtual void fill_fe_immersed_surface_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const NonMatching::ImmersedSurfaceQuadrature< dim > &quadrature, const typename Mapping< dim, spacedim >::InternalDataBase &internal_data, internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &output_data) const override
friend class MappingFEField
virtual void compute_shapes_virtual(const std::vector< Point< dim > > &unit_points, typename MappingFEField< dim, spacedim, VectorType >::InternalData &data) const
virtual std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBase > get_data(const UpdateFlags, const Quadrature< dim > &quadrature) const override
virtual bool is_compatible_with(const ReferenceCell &reference_cell) const override
virtual CellSimilarity::Similarity fill_fe_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const CellSimilarity::Similarity cell_similarity, const Quadrature< dim > &quadrature, const typename Mapping< dim, spacedim >::InternalDataBase &internal_data, internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &output_data) const override
void compute_data(const UpdateFlags update_flags, const Quadrature< dim > &q, const unsigned int n_original_q_points, InternalData &data) const
ReferenceCell reference_cell
SmartPointer< const DoFHandler< dim, spacedim >, MappingFEField< dim, spacedim, VectorType > > euler_dof_handler
unsigned int get_degree() const
virtual UpdateFlags requires_update_flags(const UpdateFlags update_flags) const override
Point< spacedim > do_transform_unit_to_real_cell(const InternalData &mdata) const
Threads::Mutex fe_values_mutex
const bool uses_level_dofs
ComponentMask get_component_mask() const
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
virtual void fill_fe_face_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const hp::QCollection< dim - 1 > &quadrature, const typename Mapping< dim, spacedim >::InternalDataBase &internal_data, internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &output_data) const override
FEValues< dim, spacedim > fe_values
virtual std::unique_ptr< Mapping< dim, spacedim > > clone() const override
virtual void fill_fe_subface_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const unsigned int subface_no, const Quadrature< dim - 1 > &quadrature, const typename Mapping< dim, spacedim >::InternalDataBase &internal_data, internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &output_data) const override
Abstract base class for mapping classes.
virtual Point< dim > transform_real_to_unit_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< spacedim > &p) const =0
const Tensor< 1, spacedim > & normal_vector(const unsigned int i) const
static DataSetDescriptor cell()
static DataSetDescriptor subface(const ReferenceCell &reference_cell, 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)
const std::vector< double > & get_weights() const
const std::vector< Point< dim > > & get_points() const
unsigned int size() const
unsigned int n_faces() const
unsigned int get_dimension() const
numbers::NumberTraits< Number >::real_type norm() const
constexpr numbers::NumberTraits< Number >::real_type norm_square() const
unsigned int size() const
void reinit(const TriaIterator< DoFCellAccessor< dim, spacedim, lda > > &cell, const unsigned int q_index=numbers::invalid_unsigned_int, const unsigned int mapping_index=numbers::invalid_unsigned_int, const unsigned int fe_index=numbers::invalid_unsigned_int)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
static ::ExceptionBase & ExcInactiveCell()
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
typename ActiveSelector::cell_iterator cell_iterator
@ update_jacobian_pushed_forward_2nd_derivatives
@ update_volume_elements
Determinant of the Jacobian.
@ update_contravariant_transformation
Contravariant transformation.
@ update_jacobian_pushed_forward_grads
@ update_jacobian_3rd_derivatives
@ update_values
Shape function values.
@ update_jacobian_grads
Gradient of volume element.
@ update_normal_vectors
Normal vectors.
@ update_JxW_values
Transformed quadrature weights.
@ update_covariant_transformation
Covariant transformation.
@ update_jacobians
Volume element.
@ update_inverse_jacobians
Volume element.
@ update_quadrature_points
Transformed quadrature points.
@ update_jacobian_pushed_forward_3rd_derivatives
@ update_boundary_forms
Outer normal vector, not normalized.
@ update_jacobian_2nd_derivatives
@ mapping_covariant_gradient
const Mapping< dim, spacedim > & get_default_linear_mapping(const Triangulation< dim, spacedim > &triangulation)
std::string to_string(const number value, const unsigned int digits=numbers::invalid_unsigned_int)
void transform_differential_forms(const ArrayView< const DerivativeForm< rank, dim, spacedim > > &input, const MappingKind mapping_kind, const typename Mapping< dim, spacedim >::InternalDataBase &mapping_data, const ArrayView< Tensor< rank+1, spacedim > > &output)
static const unsigned int invalid_unsigned_int
::VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &)
static double subface_ratio(const internal::SubfaceCase< dim > &subface_case, const unsigned int subface_no)
static Point< dim, Number > project_to_unit_cell(const Point< dim, Number > &p)
static VectorType::value_type get(const VectorType &V, const types::global_dof_index i)
DEAL_II_HOST constexpr Number determinant(const SymmetricTensor< 2, dim, Number > &)
DEAL_II_HOST constexpr SymmetricTensor< 2, dim, Number > invert(const SymmetricTensor< 2, dim, Number > &)