61template <
int dim,
int spacedim,
typename VectorType>
66 , n_shape_functions(fe.n_dofs_per_cell())
68 , local_dof_indices(fe.n_dofs_per_cell())
69 , local_dof_values(fe.n_dofs_per_cell())
74template <
int dim,
int spacedim,
typename VectorType>
85template <
int dim,
int spacedim,
typename VectorType>
88 const unsigned int qpoint,
89 const unsigned int shape_nr)
91 AssertIndexRange(qpoint * n_shape_functions + shape_nr, shape_values.size());
92 return shape_values[qpoint * n_shape_functions + shape_nr];
96template <
int dim,
int spacedim,
typename VectorType>
99 const unsigned int qpoint,
100 const unsigned int shape_nr)
const
103 shape_derivatives.size());
104 return shape_derivatives[qpoint * n_shape_functions + shape_nr];
109template <
int dim,
int spacedim,
typename VectorType>
112 const unsigned int qpoint,
113 const unsigned int shape_nr)
116 shape_derivatives.size());
117 return shape_derivatives[qpoint * n_shape_functions + shape_nr];
121template <
int dim,
int spacedim,
typename VectorType>
125 const unsigned int shape_nr)
const
128 shape_second_derivatives.size());
129 return shape_second_derivatives[qpoint * n_shape_functions + shape_nr];
134template <
int dim,
int spacedim,
typename VectorType>
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>
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>
189 shape_fourth_derivatives.size());
190 return shape_fourth_derivatives[qpoint * n_shape_functions + shape_nr];
195template <
int dim,
int spacedim,
typename VectorType>
198 const VectorType & euler_vector,
200 : uses_level_dofs(false)
201 , euler_vector({&euler_vector})
202 , euler_dof_handler(&euler_dof_handler)
203 , fe_mask(mask.size() ?
206 euler_dof_handler.get_fe().get_nonzero_components(0).size(),
209 , fe_values(this->euler_dof_handler->get_fe(),
210 this->euler_dof_handler->get_fe()
212 .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 : uses_level_dofs(true)
232 , euler_dof_handler(&euler_dof_handler)
233 , fe_mask(mask.size() ?
236 euler_dof_handler.get_fe().get_nonzero_components(0).size(),
239 , fe_values(this->euler_dof_handler->get_fe(),
240 this->euler_dof_handler->get_fe()
242 .template get_nodal_type_quadrature<dim>(),
245 unsigned int size = 0;
246 for (
unsigned int i = 0; i < fe_mask.size(); ++i)
249 fe_to_real[i] = size++;
254 ExcMessage(
"The underlying DoFHandler object did not call "
255 "distribute_mg_dofs(). In this case, the construction via "
256 "level vectors does not make sense."));
259 this->euler_vector.clear();
260 this->euler_vector.resize(euler_vector.size());
261 for (
unsigned int i = 0; i < euler_vector.size(); ++i)
262 this->euler_vector[i] = &euler_vector[i];
267template <
int dim,
int spacedim,
typename VectorType>
272 : uses_level_dofs(true)
273 , euler_dof_handler(&euler_dof_handler)
274 , fe_mask(mask.size() ?
277 euler_dof_handler.get_fe().get_nonzero_components(0).size(),
280 , fe_values(this->euler_dof_handler->get_fe(),
281 this->euler_dof_handler->get_fe()
283 .template get_nodal_type_quadrature<dim>(),
286 unsigned int size = 0;
287 for (
unsigned int i = 0; i < fe_mask.size(); ++i)
290 fe_to_real[i] = size++;
295 ExcMessage(
"The underlying DoFHandler object did not call "
296 "distribute_mg_dofs(). In this case, the construction via "
297 "level vectors does not make sense."));
300 this->euler_vector.clear();
301 this->euler_vector.
resize(
305 this->euler_vector[i] = &euler_vector[i];
310template <
int dim,
int spacedim,
typename VectorType>
313 : uses_level_dofs(mapping.uses_level_dofs)
314 , euler_vector(mapping.euler_vector)
315 , euler_dof_handler(mapping.euler_dof_handler)
316 , fe_mask(mapping.fe_mask)
317 , fe_to_real(mapping.fe_to_real)
318 , fe_values(mapping.euler_dof_handler->get_fe(),
319 this->euler_dof_handler->get_fe()
321 .template get_nodal_type_quadrature<dim>(),
327template <
int dim,
int spacedim,
typename VectorType>
330 const unsigned int qpoint,
331 const unsigned int shape_nr)
const
333 AssertIndexRange(qpoint * n_shape_functions + shape_nr, shape_values.size());
334 return shape_values[qpoint * n_shape_functions + shape_nr];
339template <
int dim,
int spacedim,
typename VectorType>
349template <
int dim,
int spacedim,
typename VectorType>
355 ExcMessage(
"The dimension of your mapping (" +
357 ") and the reference cell cell_type (" +
359 " ) do not agree."));
361 return euler_dof_handler->get_fe().reference_cell() ==
reference_cell;
366template <
int dim,
int spacedim,
typename VectorType>
367boost::container::small_vector<Point<spacedim>,
375 *cell, euler_dof_handler);
377 Assert(uses_level_dofs || dof_cell->is_active() ==
true, ExcInactiveCell());
380 euler_dof_handler->get_fe().n_components());
385 euler_dof_handler->n_dofs(cell->level()));
391 std::lock_guard<std::mutex> lock(fe_values_mutex);
392 fe_values.reinit(dof_cell);
394 const unsigned int dofs_per_cell =
395 euler_dof_handler->get_fe().n_dofs_per_cell();
396 std::vector<types::global_dof_index> dof_indices(dofs_per_cell);
398 dof_cell->get_mg_dof_indices(dof_indices);
400 dof_cell->get_dof_indices(dof_indices);
402 const VectorType &vector =
403 uses_level_dofs ? *euler_vector[cell->level()] : *euler_vector[0];
405 boost::container::small_vector<Point<spacedim>,
408 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
410 const unsigned int comp = fe_to_real
411 [euler_dof_handler->get_fe().system_to_component_index(i).first];
414 typename VectorType::value_type value =
416 if (euler_dof_handler->get_fe().is_primitive(i))
417 for (
const unsigned int v : cell->vertex_indices())
418 vertices[v][comp] += fe_values.shape_value(i, v) * value;
429template <
int dim,
int spacedim,
typename VectorType>
436 const auto fe = &euler_dof_handler->get_fe();
437 const unsigned int n_points = unit_points.size();
452 fe->shape_grad_grad(i, unit_points[
point]);
457 fe->shape_3rd_derivative(i, unit_points[
point]);
462 fe->shape_4th_derivative(i, unit_points[
point]);
467template <
int dim,
int spacedim,
typename VectorType>
479 for (
unsigned int i = 0; i < 5; ++i)
522template <
int dim,
int spacedim,
typename VectorType>
527 const unsigned int n_original_q_points,
528 InternalData & data)
const
533 data.update_each = requires_update_flags(update_flags);
535 const unsigned int n_q_points = q.
size();
540 data.shape_values.resize(data.n_shape_functions * n_q_points);
542 if (data.update_each &
546 data.shape_derivatives.resize(data.n_shape_functions * n_q_points);
549 data.covariant.resize(n_original_q_points);
552 data.contravariant.resize(n_original_q_points);
555 data.volume_elements.resize(n_original_q_points);
557 if (data.update_each &
559 data.shape_second_derivatives.resize(data.n_shape_functions * n_q_points);
563 data.shape_third_derivatives.resize(data.n_shape_functions * n_q_points);
567 data.shape_fourth_derivatives.resize(data.n_shape_functions * n_q_points);
573template <
int dim,
int spacedim,
typename VectorType>
578 const unsigned int n_original_q_points,
579 InternalData & data)
const
581 compute_data(update_flags, q, n_original_q_points, data);
593 this->euler_dof_handler->get_fe().reference_cell();
597 for (
unsigned int i = 0; i < n_faces; ++i)
599 data.unit_tangentials[i].resize(n_original_q_points);
601 data.unit_tangentials[i].begin(),
602 data.unit_tangentials[i].end(),
606 data.unit_tangentials[n_faces + i].resize(
607 n_original_q_points);
609 data.unit_tangentials[n_faces + i].begin(),
610 data.unit_tangentials[n_faces + i].end(),
619template <
int dim,
int spacedim,
typename VectorType>
620typename std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
625 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase> data_ptr =
626 std::make_unique<InternalData>(euler_dof_handler->get_fe(), fe_mask);
627 auto &data =
dynamic_cast<InternalData &
>(*data_ptr);
628 this->compute_data(update_flags, quadrature, quadrature.
size(), data);
635template <
int dim,
int spacedim,
typename VectorType>
636std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
643 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase> data_ptr =
644 std::make_unique<InternalData>(euler_dof_handler->get_fe(), fe_mask);
645 auto & data =
dynamic_cast<InternalData &
>(*data_ptr);
649 this->compute_face_data(update_flags, q, quadrature[0].size(), data);
655template <
int dim,
int spacedim,
typename VectorType>
656std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
661 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase> data_ptr =
662 std::make_unique<InternalData>(euler_dof_handler->get_fe(), fe_mask);
663 auto & data =
dynamic_cast<InternalData &
>(*data_ptr);
665 ReferenceCells::get_hypercube<dim>(), quadrature));
666 this->compute_face_data(update_flags, q, quadrature.
size(), data);
675 namespace MappingFEFieldImplementation
685 template <
int dim,
int spacedim,
typename VectorType>
688 const typename ::QProjector<dim>::DataSetDescriptor data_set,
689 const typename ::MappingFEField<dim, spacedim, VectorType, void>::
693 const std::vector<unsigned int> & fe_to_real,
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 =
711 result[fe_to_real[comp_k]] +=
712 data.local_dof_values[k] * shape[k];
727 template <
int dim,
int spacedim,
typename VectorType>
730 const typename ::QProjector<dim>::DataSetDescriptor data_set,
731 const typename ::MappingFEField<dim, spacedim, VectorType, void>::
735 const std::vector<unsigned int> & fe_to_real)
742 const unsigned int n_q_points = data.contravariant.size();
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 =
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>
799 const typename ::QProjector<dim>::DataSetDescriptor data_set,
800 const typename ::MappingFEField<dim, spacedim, VectorType, void>::
804 const std::vector<unsigned int> & fe_to_real,
810 const unsigned int n_q_points = jacobian_grads.size();
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 =
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>
849 const typename ::QProjector<dim>::DataSetDescriptor data_set,
850 const typename ::MappingFEField<dim, spacedim, VectorType, void>::
854 const std::vector<unsigned int> & fe_to_real,
860 const unsigned int n_q_points =
861 jacobian_pushed_forward_grads.size();
863 double tmp[spacedim][spacedim][spacedim];
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 =
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>
922 const typename ::QProjector<dim>::DataSetDescriptor data_set,
923 const typename ::MappingFEField<dim, spacedim, VectorType, void>::
927 const std::vector<unsigned int> & fe_to_real,
933 const unsigned int n_q_points = jacobian_2nd_derivatives.size();
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 =
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>
976 const typename ::QProjector<dim>::DataSetDescriptor data_set,
977 const typename ::MappingFEField<dim, spacedim, VectorType, void>::
981 const std::vector<unsigned int> & fe_to_real,
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];
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 =
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
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
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>
1072 const typename ::QProjector<dim>::DataSetDescriptor data_set,
1073 const typename ::MappingFEField<dim, spacedim, VectorType, void>::
1074 InternalData & data,
1077 const std::vector<unsigned int> & fe_to_real,
1080 const UpdateFlags update_flags = data.update_each;
1083 const unsigned int n_q_points = jacobian_3rd_derivatives.size();
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 =
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>
1130 const typename ::QProjector<dim>::DataSetDescriptor data_set,
1131 const typename ::MappingFEField<dim, spacedim, VectorType, void>::
1132 InternalData & data,
1135 const std::vector<unsigned int> & fe_to_real,
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];
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 =
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
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
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>
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,
1261 const std::vector<double> &weights,
1262 const typename ::MappingFEField<dim, spacedim, VectorType, void>::
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)
1311 (face_no == 0 ? -1 : +1);
1341 data.contravariant[
point].transpose()[0];
1343 (face_no == 0 ? -1. : +1.) *
1354 cell_normal /= cell_normal.
norm();
1376 const double area_ratio =
1378 cell->subface_case(face_no), subface_no);
1396 data.covariant[
point].transpose();
1406 template <
int dim,
int spacedim,
typename VectorType>
1409 const ::Mapping<dim, spacedim> &mapping,
1410 const typename ::Triangulation<dim, spacedim>::cell_iterator
1412 const unsigned int face_no,
1413 const unsigned int subface_no,
1414 const typename ::QProjector<dim>::DataSetDescriptor data_set,
1416 const typename ::MappingFEField<dim, spacedim, VectorType, void>::
1417 InternalData & data,
1420 const std::vector<unsigned int> & fe_to_real,
1424 maybe_compute_q_points<dim, spacedim, VectorType>(
1432 maybe_update_Jacobians<dim, spacedim, VectorType>(
1433 data_set, data, fe, fe_mask, fe_to_real);
1435 maybe_update_jacobian_grads<dim, spacedim, VectorType>(
1436 data_set, data, fe, fe_mask, fe_to_real, output_data.
jacobian_grads);
1438 maybe_update_jacobian_pushed_forward_grads<dim, spacedim, VectorType>(
1446 maybe_update_jacobian_2nd_derivatives<dim, spacedim, VectorType>(
1464 maybe_update_jacobian_3rd_derivatives<dim, spacedim, VectorType>(
1482 maybe_compute_face_data<dim, spacedim, VectorType>(
1498template <
int dim,
int spacedim,
typename VectorType>
1510 Assert(
dynamic_cast<const InternalData *
>(&internal_data) !=
nullptr,
1512 const InternalData &data =
static_cast<const InternalData &
>(internal_data);
1514 const unsigned int n_q_points = quadrature.
size();
1516 update_internal_dofs(cell, data);
1518 internal::MappingFEFieldImplementation::
1519 maybe_compute_q_points<dim, spacedim, VectorType>(
1522 euler_dof_handler->get_fe(),
1527 internal::MappingFEFieldImplementation::
1528 maybe_update_Jacobians<dim, spacedim, VectorType>(
1531 euler_dof_handler->get_fe(),
1535 const UpdateFlags update_flags = data.update_each;
1536 const std::vector<double> &weights = quadrature.
get_weights();
1553 if (dim == spacedim)
1555 const double det = data.contravariant[
point].determinant();
1562 Assert(det > 1
e-12 * Utilities::fixed_power<dim>(
1563 cell->diameter() /
std::sqrt(
double(dim))),
1565 cell->center(), det,
point)));
1574 for (
unsigned int i = 0; i < spacedim; ++i)
1575 for (
unsigned int j = 0; j < dim; ++j)
1576 DX_t[j][i] = data.contravariant[
point][i][j];
1579 for (
unsigned int i = 0; i < dim; ++i)
1580 for (
unsigned int j = 0; j < dim; ++j)
1581 G[i][j] = DX_t[i] * DX_t[j];
1588 Assert(spacedim - dim == 1,
1589 ExcMessage(
"There is no cell normal in codim 2."));
1607 if (cell->direction_flag() ==
false)
1628 data.covariant[
point].transpose();
1632 internal::MappingFEFieldImplementation::
1633 maybe_update_jacobian_grads<dim, spacedim, VectorType>(
1636 euler_dof_handler->get_fe(),
1643 internal::MappingFEFieldImplementation::
1644 maybe_update_jacobian_pushed_forward_grads<dim, spacedim, VectorType>(
1647 euler_dof_handler->get_fe(),
1653 internal::MappingFEFieldImplementation::
1654 maybe_update_jacobian_2nd_derivatives<dim, spacedim, VectorType>(
1657 euler_dof_handler->get_fe(),
1663 internal::MappingFEFieldImplementation::
1664 maybe_update_jacobian_pushed_forward_2nd_derivatives<dim,
1669 euler_dof_handler->get_fe(),
1675 internal::MappingFEFieldImplementation::
1676 maybe_update_jacobian_3rd_derivatives<dim, spacedim, VectorType>(
1679 euler_dof_handler->get_fe(),
1686 internal::MappingFEFieldImplementation::
1687 maybe_update_jacobian_pushed_forward_3rd_derivatives<dim,
1692 euler_dof_handler->get_fe(),
1702template <
int dim,
int spacedim,
typename VectorType>
1706 const unsigned int face_no,
1716 Assert(
dynamic_cast<const InternalData *
>(&internal_data) !=
nullptr,
1718 const InternalData &data =
static_cast<const InternalData &
>(internal_data);
1720 update_internal_dofs(cell, data);
1722 internal::MappingFEFieldImplementation::
1723 do_fill_fe_face_values<dim, spacedim, VectorType>(
1729 ReferenceCells::get_hypercube<dim>(),
1731 cell->face_orientation(face_no),
1732 cell->face_flip(face_no),
1733 cell->face_rotation(face_no),
1734 quadrature[0].
size()),
1737 euler_dof_handler->get_fe(),
1744template <
int dim,
int spacedim,
typename VectorType>
1748 const unsigned int face_no,
1749 const unsigned int subface_no,
1757 Assert(
dynamic_cast<const InternalData *
>(&internal_data) !=
nullptr,
1759 const InternalData &data =
static_cast<const InternalData &
>(internal_data);
1761 update_internal_dofs(cell, data);
1763 internal::MappingFEFieldImplementation::
1764 do_fill_fe_face_values<dim, spacedim, VectorType>(
1770 ReferenceCells::get_hypercube<dim>(),
1773 cell->face_orientation(face_no),
1774 cell->face_flip(face_no),
1775 cell->face_rotation(face_no),
1777 cell->subface_case(face_no)),
1780 euler_dof_handler->get_fe(),
1789 namespace MappingFEFieldImplementation
1793 template <
int dim,
int spacedim,
int rank,
typename VectorType>
1805 MappingFEField<dim, spacedim, VectorType, void>::InternalData *
>(
1806 &mapping_data) !=
nullptr),
1808 const typename ::MappingFEField<dim, spacedim, VectorType, void>::
1809 InternalData &data =
static_cast<
1811 MappingFEField<dim, spacedim, VectorType, void>::InternalData &
>(
1814 switch (mapping_kind)
1821 "update_contravariant_transformation"));
1823 for (
unsigned int i = 0; i < output.size(); ++i)
1835 "update_contravariant_transformation"));
1839 "update_volume_elements"));
1841 for (
unsigned int i = 0; i < output.size(); ++i)
1845 output[i] /= data.volume_elements[i];
1859 "update_contravariant_transformation"));
1861 for (
unsigned int i = 0; i < output.size(); ++i)
1873 template <
int dim,
int spacedim,
int rank,
typename VectorType>
1885 MappingFEField<dim, spacedim, VectorType, void>::InternalData *
>(
1886 &mapping_data) !=
nullptr),
1888 const typename ::MappingFEField<dim, spacedim, VectorType, void>::
1889 InternalData &data =
static_cast<
1891 MappingFEField<dim, spacedim, VectorType, void>::InternalData &
>(
1894 switch (mapping_kind)
1901 "update_contravariant_transformation"));
1903 for (
unsigned int i = 0; i < output.size(); ++i)
1918template <
int dim,
int spacedim,
typename VectorType>
1928 internal::MappingFEFieldImplementation::
1929 transform_fields<dim, spacedim, 1, VectorType>(input,
1937template <
int dim,
int spacedim,
typename VectorType>
1947 internal::MappingFEFieldImplementation::
1948 transform_differential_forms<dim, spacedim, 1, VectorType>(input,
1956template <
int dim,
int spacedim,
typename VectorType>
1974template <
int dim,
int spacedim,
typename VectorType>
1983 Assert(
dynamic_cast<const InternalData *
>(&mapping_data) !=
nullptr,
1985 const InternalData &data =
static_cast<const InternalData &
>(mapping_data);
1987 switch (mapping_kind)
1993 "update_covariant_transformation"));
1995 for (
unsigned int q = 0; q < output.size(); ++q)
1996 for (
unsigned int i = 0; i < spacedim; ++i)
1997 for (
unsigned int j = 0; j < spacedim; ++j)
1998 for (
unsigned int k = 0; k < spacedim; ++k)
2000 output[q][i][j][k] = data.covariant[q][j][0] *
2001 data.covariant[q][k][0] *
2003 for (
unsigned int J = 0; J < dim; ++J)
2005 const unsigned int K0 = (0 == J) ? 1 : 0;
2006 for (
unsigned int K = K0; K < dim; ++K)
2007 output[q][i][j][k] += data.covariant[q][j][J] *
2008 data.covariant[q][k][K] *
2022template <
int dim,
int spacedim,
typename VectorType>
2040template <
int dim,
int spacedim,
typename VectorType>
2050 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase> mdata(
2052 Assert(
dynamic_cast<InternalData *
>(mdata.get()) !=
nullptr,
2055 update_internal_dofs(cell,
dynamic_cast<InternalData &
>(*mdata));
2057 return do_transform_unit_to_real_cell(
dynamic_cast<InternalData &
>(*mdata));
2061template <
int dim,
int spacedim,
typename VectorType>
2064 const InternalData &data)
const
2068 for (
unsigned int i = 0; i < data.n_shape_functions; ++i)
2070 unsigned int comp_i =
2071 euler_dof_handler->get_fe().system_to_component_index(i).first;
2072 if (fe_mask[comp_i])
2073 p_real[fe_to_real[comp_i]] +=
2074 data.local_dof_values[i] * data.shape(0, i);
2082template <
int dim,
int spacedim,
typename VectorType>
2101 for (
unsigned int d = 0;
d < dim; ++
d)
2102 initial_p_unit[
d] = 0.5;
2116 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase> mdata(
2117 get_data(update_flags, point_quadrature));
2118 Assert(
dynamic_cast<InternalData *
>(mdata.get()) !=
nullptr,
2121 update_internal_dofs(cell,
dynamic_cast<InternalData &
>(*mdata));
2123 return do_transform_real_to_unit_cell(cell,
2126 dynamic_cast<InternalData &
>(*mdata));
2130template <
int dim,
int spacedim,
typename VectorType>
2136 InternalData & mdata)
const
2138 const unsigned int n_shapes = mdata.shape_values.size();
2155 compute_shapes_virtual(std::vector<
Point<dim>>(1, p_unit), mdata);
2158 const double eps = 1.e-12 * cell->diameter();
2159 const unsigned int newton_iteration_limit = 20;
2160 unsigned int newton_iteration = 0;
2166 for (
unsigned int k = 0; k < mdata.n_shape_functions; ++k)
2169 const unsigned int comp_k =
2170 euler_dof_handler->get_fe().system_to_component_index(k).first;
2171 if (fe_mask[comp_k])
2172 for (
unsigned int j = 0; j < dim; ++j)
2173 DF[j][fe_to_real[comp_k]] +=
2174 mdata.local_dof_values[k] * grad_k[j];
2176 for (
unsigned int j = 0; j < dim; ++j)
2178 f[j] = DF[j] * p_minus_F;
2179 for (
unsigned int l = 0;
l < dim; ++
l)
2180 df[j][
l] = -DF[j] * DF[
l];
2186 double step_length = 1;
2199 for (
unsigned int i = 0; i < dim; ++i)
2200 p_unit_trial[i] -= step_length * delta[i];
2203 compute_shapes_virtual(std::vector<
Point<dim>>(1, p_unit_trial),
2210 if (f_trial.
norm() < p_minus_F.
norm())
2212 p_real = p_real_trial;
2213 p_unit = p_unit_trial;
2214 p_minus_F = f_trial;
2217 else if (step_length > 0.05)
2224 if (newton_iteration > newton_iteration_limit)
2241template <
int dim,
int spacedim,
typename VectorType>
2245 return euler_dof_handler->get_fe().degree;
2250template <
int dim,
int spacedim,
typename VectorType>
2254 return this->fe_mask;
2258template <
int dim,
int spacedim,
typename VectorType>
2259std::unique_ptr<Mapping<dim, spacedim>>
2262 return std::make_unique<MappingFEField<dim, spacedim, VectorType, void>>(
2267template <
int dim,
int spacedim,
typename VectorType>
2274 Assert(euler_dof_handler !=
nullptr,
2279 Assert(uses_level_dofs || dof_cell->is_active() ==
true, ExcInactiveCell());
2280 if (uses_level_dofs)
2284 euler_dof_handler->n_dofs(cell->level()));
2287 AssertDimension(euler_vector[0]->size(), euler_dof_handler->n_dofs());
2289 if (uses_level_dofs)
2294 const VectorType &vector =
2295 uses_level_dofs ? *euler_vector[cell->level()] : *euler_vector[0];
2304#define SPLIT_INSTANTIATIONS_COUNT 2
2305#ifndef SPLIT_INSTANTIATIONS_INDEX
2306# define SPLIT_INSTANTIATIONS_INDEX 0
2308#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)
const Triangulation< dim, spacedim > & get_triangulation() const
bool has_level_dofs() const
std::pair< unsigned int, unsigned int > system_to_component_index(const unsigned int index) const
void resize(const unsigned int new_minlevel, const unsigned int new_maxlevel, Args &&... args)
unsigned int max_level() const
unsigned int min_level() const
std::vector< Tensor< 1, dim > > shape_derivatives
unsigned int n_shape_functions
std::vector< Tensor< 4, dim > > shape_fourth_derivatives
std::vector< double > shape_values
std::vector< Tensor< 3, dim > > shape_third_derivatives
std::vector< Tensor< 2, dim > > shape_second_derivatives
std::vector< double > local_dof_values
const double & shape(const unsigned int qpoint, const unsigned int shape_nr) const
const Tensor< 4, dim > & fourth_derivative(const unsigned int qpoint, const unsigned int shape_nr) const
std::vector< types::global_dof_index > local_dof_indices
const Tensor< 1, dim > & derivative(const unsigned int qpoint, const unsigned int shape_nr) const
const Tensor< 3, dim > & third_derivative(const unsigned int qpoint, const unsigned int shape_nr) const
const Tensor< 2, dim > & second_derivative(const unsigned int qpoint, const unsigned int shape_nr) const
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
static DataSetDescriptor cell()
const std::vector< double > & get_weights() const
const std::vector< Point< dim > > & get_points() const
unsigned int size() const
numbers::NumberTraits< Number >::real_type norm() const
constexpr numbers::NumberTraits< Number >::real_type norm_square() const
virtual unsigned int n_global_levels() const
Triangulation< dim, spacedim > & get_triangulation()
unsigned int n_vertices() const
unsigned int size() const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
@ 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
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 & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
@ mapping_covariant_gradient
const Mapping< dim, spacedim > & get_default_linear_mapping(const Triangulation< dim, spacedim > &triangulation)
void reference_cell(Triangulation< dim, spacedim > &tria, const ReferenceCell &reference_cell)
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
Point< spacedim > point(const gp_Pnt &p, const double tolerance=1e-10)
void quadrature_points(const Triangulation< dim, spacedim > &triangulation, const Quadrature< dim > &quadrature, const std::vector< std::vector< BoundingBox< spacedim > > > &global_bounding_boxes, ParticleHandler< dim, spacedim > &particle_handler, const Mapping< dim, spacedim > &mapping=(ReferenceCells::get_hypercube< dim >() .template get_default_linear_mapping< dim, spacedim >()), const std::vector< std::vector< double > > &properties={})
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
Tensor< 2, dim, Number > l(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
std::string to_string(const number value, const unsigned int digits=numbers::invalid_unsigned_int)
Point< 1 > transform_real_to_unit_cell(const std::array< Point< spacedim >, GeometryInfo< 1 >::vertices_per_cell > &vertices, const Point< spacedim > &p)
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)
void maybe_update_jacobian_grads(const CellSimilarity::Similarity cell_similarity, const typename QProjector< dim >::DataSetDescriptor data_set, const typename ::MappingQGeneric< dim, spacedim >::InternalData &data, std::vector< DerivativeForm< 2, dim, spacedim > > &jacobian_grads)
void maybe_update_jacobian_pushed_forward_2nd_derivatives(const CellSimilarity::Similarity cell_similarity, const typename QProjector< dim >::DataSetDescriptor data_set, const typename ::MappingQGeneric< dim, spacedim >::InternalData &data, std::vector< Tensor< 4, spacedim > > &jacobian_pushed_forward_2nd_derivatives)
void maybe_update_jacobian_3rd_derivatives(const CellSimilarity::Similarity cell_similarity, const typename QProjector< dim >::DataSetDescriptor data_set, const typename ::MappingQGeneric< dim, spacedim >::InternalData &data, std::vector< DerivativeForm< 4, dim, spacedim > > &jacobian_3rd_derivatives)
void maybe_update_jacobian_pushed_forward_3rd_derivatives(const CellSimilarity::Similarity cell_similarity, const typename QProjector< dim >::DataSetDescriptor data_set, const typename ::MappingQGeneric< dim, spacedim >::InternalData &data, std::vector< Tensor< 5, spacedim > > &jacobian_pushed_forward_3rd_derivatives)
void maybe_update_Jacobians(const CellSimilarity::Similarity cell_similarity, const typename ::QProjector< dim >::DataSetDescriptor data_set, const typename ::MappingQGeneric< dim, spacedim >::InternalData &data)
void do_fill_fe_face_values(const ::MappingQGeneric< dim, spacedim > &mapping, const typename ::Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const unsigned int subface_no, const typename QProjector< dim >::DataSetDescriptor data_set, const Quadrature< dim - 1 > &quadrature, const typename ::MappingQGeneric< dim, spacedim >::InternalData &data, internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &output_data)
void transform_fields(const ArrayView< const Tensor< rank, dim > > &input, const MappingKind mapping_kind, const typename Mapping< dim, spacedim >::InternalDataBase &mapping_data, const ArrayView< Tensor< rank, spacedim > > &output)
void maybe_compute_face_data(const ::MappingQGeneric< dim, spacedim > &mapping, const typename ::Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const unsigned int subface_no, const unsigned int n_q_points, const std::vector< double > &weights, const typename ::MappingQGeneric< dim, spacedim >::InternalData &data, internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &output_data)
void maybe_compute_q_points(const typename QProjector< dim >::DataSetDescriptor data_set, const typename ::MappingQGeneric< dim, spacedim >::InternalData &data, std::vector< Point< spacedim > > &quadrature_points)
void maybe_update_jacobian_2nd_derivatives(const CellSimilarity::Similarity cell_similarity, const typename QProjector< dim >::DataSetDescriptor data_set, const typename ::MappingQGeneric< dim, spacedim >::InternalData &data, std::vector< DerivativeForm< 3, dim, spacedim > > &jacobian_2nd_derivatives)
void maybe_update_jacobian_pushed_forward_grads(const CellSimilarity::Similarity cell_similarity, const typename QProjector< dim >::DataSetDescriptor data_set, const typename ::MappingQGeneric< dim, spacedim >::InternalData &data, std::vector< Tensor< 3, spacedim > > &jacobian_pushed_forward_grads)
unsigned int get_degree(const std::vector< BarycentricPolynomial< dim > > &polys)
static const unsigned int invalid_unsigned_int
void transform(const InputIterator &begin_in, const InputIterator &end_in, OutputIterator out, const Predicate &predicate, const unsigned int grainsize)
::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)
constexpr Number determinant(const SymmetricTensor< 2, dim, Number > &)
constexpr SymmetricTensor< 2, dim, Number > invert(const SymmetricTensor< 2, dim, Number > &)
constexpr Tensor< 1, dim, Number > cross_product_2d(const Tensor< 1, dim, Number > &src)
constexpr Tensor< 1, dim, typename ProductType< Number1, Number2 >::type > cross_product_3d(const Tensor< 1, dim, Number1 > &src1, const Tensor< 1, dim, Number2 > &src2)