16 #include <deal.II/base/utilities.h> 17 #include <deal.II/base/polynomial.h> 18 #include <deal.II/base/quadrature.h> 19 #include <deal.II/base/quadrature_lib.h> 20 #include <deal.II/base/qprojector.h> 21 #include <deal.II/base/memory_consumption.h> 22 #include <deal.II/base/tensor_product_polynomials.h> 23 #include <deal.II/base/std_cxx11/unique_ptr.h> 24 #include <deal.II/lac/full_matrix.h> 25 #include <deal.II/lac/vector.h> 26 #include <deal.II/lac/block_vector.h> 27 #include <deal.II/lac/la_vector.h> 28 #include <deal.II/lac/parallel_vector.h> 29 #include <deal.II/lac/parallel_block_vector.h> 30 #include <deal.II/lac/petsc_vector.h> 31 #include <deal.II/lac/petsc_block_vector.h> 32 #include <deal.II/lac/trilinos_vector.h> 33 #include <deal.II/lac/trilinos_block_vector.h> 34 #include <deal.II/lac/trilinos_parallel_block_vector.h> 35 #include <deal.II/grid/tria_iterator.h> 36 #include <deal.II/grid/tria_boundary.h> 37 #include <deal.II/dofs/dof_accessor.h> 38 #include <deal.II/fe/fe_tools.h> 39 #include <deal.II/fe/fe_values.h> 40 #include <deal.II/fe/fe_system.h> 41 #include <deal.II/fe/mapping_fe_field.h> 42 #include <deal.II/fe/fe_q.h> 43 #include <deal.II/fe/mapping.h> 44 #include <deal.II/fe/mapping_q1.h> 45 #include <deal.II/base/qprojector.h> 46 #include <deal.II/base/thread_management.h> 47 #include <deal.II/numerics/vector_tools.h> 54 DEAL_II_NAMESPACE_OPEN
57 template<
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
70 template<
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
80 template<
int dim,
int spacedim,
typename DoFHandlerType,
typename VectorType>
83 (
const unsigned int qpoint,
84 const unsigned int shape_nr)
86 Assert(qpoint*n_shape_functions + shape_nr < shape_values.size(),
88 shape_values.size()));
89 return shape_values [qpoint*n_shape_functions + shape_nr];
93 template<
int dim,
int spacedim,
typename DoFHandlerType,
typename VectorType>
96 (
const unsigned int qpoint,
97 const unsigned int shape_nr)
const 99 Assert(qpoint*n_shape_functions + shape_nr < shape_derivatives.size(),
101 shape_derivatives.size()));
102 return shape_derivatives [qpoint*n_shape_functions + shape_nr];
107 template<
int dim,
int spacedim,
typename DoFHandlerType,
typename VectorType>
110 (
const unsigned int qpoint,
111 const unsigned int shape_nr)
113 Assert(qpoint*n_shape_functions + shape_nr < shape_derivatives.size(),
115 shape_derivatives.size()));
116 return shape_derivatives [qpoint*n_shape_functions + shape_nr];
120 template <
int dim,
int spacedim,
typename DoFHandlerType,
typename VectorType>
123 (
const unsigned int qpoint,
124 const unsigned int shape_nr)
const 126 Assert(qpoint*n_shape_functions + shape_nr < shape_second_derivatives.size(),
128 shape_second_derivatives.size()));
129 return shape_second_derivatives [qpoint*n_shape_functions + shape_nr];
134 template <
int dim,
int spacedim,
typename DoFHandlerType,
typename VectorType>
137 (
const unsigned int qpoint,
138 const unsigned int shape_nr)
140 Assert(qpoint*n_shape_functions + shape_nr < shape_second_derivatives.size(),
142 shape_second_derivatives.size()));
143 return shape_second_derivatives [qpoint*n_shape_functions + shape_nr];
147 template <
int dim,
int spacedim,
typename DoFHandlerType,
typename VectorType>
150 (
const unsigned int qpoint,
151 const unsigned int shape_nr)
const 153 Assert(qpoint*n_shape_functions + shape_nr < shape_third_derivatives.size(),
155 shape_third_derivatives.size()));
156 return shape_third_derivatives [qpoint*n_shape_functions + shape_nr];
161 template <
int dim,
int spacedim,
typename DoFHandlerType,
typename VectorType>
164 (
const unsigned int qpoint,
165 const unsigned int shape_nr)
167 Assert(qpoint*n_shape_functions + shape_nr < shape_third_derivatives.size(),
169 shape_third_derivatives.size()));
170 return shape_third_derivatives [qpoint*n_shape_functions + shape_nr];
174 template <
int dim,
int spacedim,
typename DoFHandlerType,
typename VectorType>
177 (
const unsigned int qpoint,
178 const unsigned int shape_nr)
const 180 Assert(qpoint*n_shape_functions + shape_nr < shape_fourth_derivatives.size(),
182 shape_fourth_derivatives.size()));
183 return shape_fourth_derivatives [qpoint*n_shape_functions + shape_nr];
188 template <
int dim,
int spacedim,
typename DoFHandlerType,
typename VectorType>
191 (
const unsigned int qpoint,
192 const unsigned int shape_nr)
194 Assert(qpoint*n_shape_functions + shape_nr < shape_fourth_derivatives.size(),
196 shape_fourth_derivatives.size()));
197 return shape_fourth_derivatives [qpoint*n_shape_functions + shape_nr];
202 template<
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
211 fe_mask(mask.
size() ? mask :
215 unsigned int size = 0;
216 for (
unsigned int i=0; i<fe_mask.
size(); ++i)
225 template<
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
232 fe_mask(mapping.fe_mask),
238 template<
int dim,
int spacedim,
typename DoFHandlerType,
typename VectorType>
242 (
const unsigned int qpoint,
243 const unsigned int shape_nr)
const 245 Assert(qpoint*n_shape_functions + shape_nr < shape_values.size(),
247 shape_values.size()));
248 return shape_values [qpoint*n_shape_functions + shape_nr];
253 template <
int dim,
int spacedim,
typename DoFHandlerType,
typename VectorType>
262 template<
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
268 const unsigned int n_points=unit_points.size();
270 for (
unsigned int point=0; point<n_points; ++point)
274 data.
shape(point, i) =
fe->shape_value(i, unit_points[point]);
278 data.
derivative(point, i) =
fe->shape_grad(i, unit_points[point]);
295 template<
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
306 for (
unsigned int i=0; i<5; ++i)
354 template<
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
359 const unsigned int n_original_q_points,
360 InternalData &data)
const 367 const unsigned int n_q_points = q.
size();
372 data.shape_values.resize(data.n_shape_functions * n_q_points);
382 data.shape_derivatives.resize(data.n_shape_functions * n_q_points);
385 data.covariant.resize(n_original_q_points);
388 data.contravariant.resize(n_original_q_points);
391 data.volume_elements.resize(n_original_q_points);
394 data.shape_second_derivatives.resize(data.n_shape_functions * n_q_points);
397 data.shape_third_derivatives.resize(data.n_shape_functions * n_q_points);
400 data.shape_fourth_derivatives.resize(data.n_shape_functions * n_q_points);
406 template<
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
411 const unsigned int n_original_q_points,
412 InternalData &data)
const 414 compute_data (update_flags, q, n_original_q_points, data);
423 for (
unsigned int i=0; i<data.unit_tangentials.size(); ++i)
424 data.unit_tangentials[i].resize (n_original_q_points);
430 static const int tangential_orientation[4]= {-1,1,1,-1};
431 for (
unsigned int i=0; i<GeometryInfo<dim>::faces_per_cell; ++i)
434 tang[1-i/2]=tangential_orientation[i];
435 std::fill (data.unit_tangentials[i].begin(),
436 data.unit_tangentials[i].end(),
442 for (
unsigned int i=0; i<GeometryInfo<dim>::faces_per_cell; ++i)
446 const unsigned int nd=
458 tang2[(nd+2)%dim]=1.;
463 std::fill (data.unit_tangentials[i].begin(),
464 data.unit_tangentials[i].end(),
476 template<
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
483 this->compute_data (update_flags, quadrature,
484 quadrature.
size(), *data);
490 template<
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
498 this->compute_face_data (update_flags, q,
499 quadrature.
size(), *data);
505 template<
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
513 this->compute_face_data (update_flags, q,
514 quadrature.
size(), *data);
531 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
533 maybe_compute_q_points (
const typename ::QProjector<dim>::DataSetDescriptor data_set,
534 const typename ::MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::InternalData &data,
544 for (
unsigned int point=0; point<quadrature_points.size(); ++point)
547 const double *shape = &data.shape(point+data_set,0);
549 for (
unsigned int k=0; k<data.n_shape_functions; ++k)
551 unsigned int comp_k =
fe.system_to_component_index(k).first;
553 result[
fe_to_real[comp_k]] += data.local_dof_values[k] * shape[k];
556 quadrature_points[
point] = result;
568 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
571 const typename ::QProjector<dim>::DataSetDescriptor data_set,
572 const typename ::MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::InternalData &data,
587 const unsigned int n_q_points = data.contravariant.size();
591 for (
unsigned int point=0;
point<n_q_points; ++
point)
594 &data.derivative(point+data_set, 0);
598 for (
unsigned int k=0; k<data.n_shape_functions; ++k)
600 unsigned int comp_k =
fe.system_to_component_index(k).first;
602 result[
fe_to_real[comp_k]] += data.local_dof_values[k] * data_derv[k];
606 for (
unsigned int i=0; i<spacedim; ++i)
608 data.contravariant[
point][i] = result[i];
618 for (
unsigned int point=0;
point<data.contravariant.size(); ++
point)
619 data.covariant[point] = (data.contravariant[point]).covariant_form();
626 for (
unsigned int point=0;
point<data.contravariant.size(); ++
point)
627 data.volume_elements[point] = data.contravariant[point].determinant();
637 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
640 const typename ::QProjector<dim>::DataSetDescriptor data_set,
641 const typename ::MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::InternalData &data,
650 const unsigned int n_q_points = jacobian_grads.size();
654 for (
unsigned int point=0;
point<n_q_points; ++
point)
657 &data.second_derivative(point+data_set, 0);
661 for (
unsigned int k=0; k<data.n_shape_functions; ++k)
663 unsigned int comp_k =
fe.system_to_component_index(k).first;
665 for (
unsigned int j=0; j<dim; ++j)
666 for (
unsigned int l=0;
l<dim; ++
l)
667 result[
fe_to_real[comp_k]][j][l] += (second[k][j][l]
668 * data.local_dof_values[k]);
673 for (
unsigned int i=0; i<spacedim; ++i)
674 for (
unsigned int j=0; j<dim; ++j)
675 for (
unsigned int l=0;
l<dim; ++
l)
676 jacobian_grads[point][i][j][l] = result[i][j][l];
688 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
690 maybe_update_jacobian_pushed_forward_grads (
692 const typename ::QProjector<dim>::DataSetDescriptor data_set,
693 const typename ::MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::InternalData &data,
702 const unsigned int n_q_points = jacobian_pushed_forward_grads.size();
706 double tmp[spacedim][spacedim][spacedim];
707 for (
unsigned int point=0;
point<n_q_points; ++
point)
710 &data.second_derivative(point+data_set, 0);
714 for (
unsigned int k=0; k<data.n_shape_functions; ++k)
716 unsigned int comp_k =
fe.system_to_component_index(k).first;
718 for (
unsigned int j=0; j<dim; ++j)
719 for (
unsigned int l=0;
l<dim; ++
l)
720 result[
fe_to_real[comp_k]][j][l] += (second[k][j][l]
721 * data.local_dof_values[k]);
725 for (
unsigned int i=0; i<spacedim; ++i)
726 for (
unsigned int j=0; j<spacedim; ++j)
727 for (
unsigned int l=0;
l<dim; ++
l)
729 tmp[i][j][
l] = result[i][0][
l] *
730 data.covariant[
point][j][0];
731 for (
unsigned int jr=1; jr<dim; ++jr)
733 tmp[i][j][
l] += result[i][jr][
l] *
734 data.covariant[
point][j][jr];
739 for (
unsigned int i=0; i<spacedim; ++i)
740 for (
unsigned int j=0; j<spacedim; ++j)
741 for (
unsigned int l=0;
l<spacedim; ++
l)
743 jacobian_pushed_forward_grads[
point][i][j][
l] = tmp[i][j][0] *
744 data.covariant[
point][
l][0];
745 for (
unsigned int lr=1; lr<dim; ++lr)
747 jacobian_pushed_forward_grads[
point][i][j][
l] += tmp[i][j][lr] *
748 data.covariant[
point][
l][lr];
763 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
766 const typename ::QProjector<dim>::DataSetDescriptor data_set,
767 const typename ::MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::InternalData &data,
776 const unsigned int n_q_points = jacobian_2nd_derivatives.size();
780 for (
unsigned int point=0;
point<n_q_points; ++
point)
783 &data.third_derivative(point+data_set, 0);
787 for (
unsigned int k=0; k<data.n_shape_functions; ++k)
789 unsigned int comp_k =
fe.system_to_component_index(k).first;
791 for (
unsigned int j=0; j<dim; ++j)
792 for (
unsigned int l=0;
l<dim; ++
l)
793 for (
unsigned int m=0; m<dim; ++m)
794 result[
fe_to_real[comp_k]][j][l][m] += (third[k][j][l][m]
795 * data.local_dof_values[k]);
800 for (
unsigned int i=0; i<spacedim; ++i)
801 for (
unsigned int j=0; j<dim; ++j)
802 for (
unsigned int l=0;
l<dim; ++
l)
803 for (
unsigned int m=0; m<dim; ++m)
804 jacobian_2nd_derivatives[point][i][j][l][m] = result[i][j][l][m];
816 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
818 maybe_update_jacobian_pushed_forward_2nd_derivatives (
820 const typename ::QProjector<dim>::DataSetDescriptor data_set,
821 const typename ::MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::InternalData &data,
830 const unsigned int n_q_points = jacobian_pushed_forward_2nd_derivatives.size();
834 double tmp[spacedim][spacedim][spacedim][spacedim];
835 for (
unsigned int point=0;
point<n_q_points; ++
point)
838 &data.third_derivative(point+data_set, 0);
842 for (
unsigned int k=0; k<data.n_shape_functions; ++k)
844 unsigned int comp_k =
fe.system_to_component_index(k).first;
846 for (
unsigned int j=0; j<dim; ++j)
847 for (
unsigned int l=0;
l<dim; ++
l)
848 for (
unsigned int m=0; m<dim; ++m)
849 result[
fe_to_real[comp_k]][j][l][m] += (third[k][j][l][m]
850 * data.local_dof_values[k]);
854 for (
unsigned int i=0; i<spacedim; ++i)
855 for (
unsigned int j=0; j<spacedim; ++j)
856 for (
unsigned int l=0;
l<dim; ++
l)
857 for (
unsigned int m=0; m<dim; ++m)
859 jacobian_pushed_forward_2nd_derivatives[
point][i][j][
l][m]
860 = result[i][0][
l][m]*
861 data.covariant[
point][j][0];
862 for (
unsigned int jr=1; jr<dim; ++jr)
863 jacobian_pushed_forward_2nd_derivatives[point][i][j][l][m]
864 += result[i][jr][l][m]*
865 data.covariant[point][j][jr];
869 for (
unsigned int i=0; i<spacedim; ++i)
870 for (
unsigned int j=0; j<spacedim; ++j)
871 for (
unsigned int l=0;
l<spacedim; ++
l)
872 for (
unsigned int m=0; m<dim; ++m)
875 = jacobian_pushed_forward_2nd_derivatives[
point][i][j][0][m]*
876 data.covariant[
point][
l][0];
877 for (
unsigned int lr=1; lr<dim; ++lr)
879 += jacobian_pushed_forward_2nd_derivatives[point][i][j][lr][m]*
880 data.covariant[point][l][lr];
884 for (
unsigned int i=0; i<spacedim; ++i)
885 for (
unsigned int j=0; j<spacedim; ++j)
886 for (
unsigned int l=0;
l<spacedim; ++
l)
887 for (
unsigned int m=0; m<spacedim; ++m)
889 jacobian_pushed_forward_2nd_derivatives[
point][i][j][
l][m]
891 data.covariant[
point][m][0];
892 for (
unsigned int mr=1; mr<dim; ++mr)
893 jacobian_pushed_forward_2nd_derivatives[point][i][j][l][m]
895 data.covariant[point][m][mr];
909 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
912 const typename ::QProjector<dim>::DataSetDescriptor data_set,
913 const typename ::MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::InternalData &data,
922 const unsigned int n_q_points = jacobian_3rd_derivatives.size();
926 for (
unsigned int point=0; point<n_q_points; ++point)
929 &data.fourth_derivative(point+data_set, 0);
933 for (
unsigned int k=0; k<data.n_shape_functions; ++k)
935 unsigned int comp_k =
fe.system_to_component_index(k).first;
937 for (
unsigned int j=0; j<dim; ++j)
938 for (
unsigned int l=0; l<dim; ++l)
939 for (
unsigned int m=0; m<dim; ++m)
940 for (
unsigned int n=0; n<dim; ++n)
941 result[
fe_to_real[comp_k]][j][l][m][n] += (fourth[k][j][l][m][n]
942 * data.local_dof_values[k]);
947 for (
unsigned int i=0; i<spacedim; ++i)
948 for (
unsigned int j=0; j<dim; ++j)
949 for (
unsigned int l=0; l<dim; ++l)
950 for (
unsigned int m=0; m<dim; ++m)
951 for (
unsigned int n=0; n<dim; ++n)
952 jacobian_3rd_derivatives[point][i][j][l][m][n] = result[i][j][l][m][n];
965 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
969 const typename ::QProjector<dim>::DataSetDescriptor data_set,
970 const typename ::MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::InternalData &data,
979 const unsigned int n_q_points = jacobian_pushed_forward_3rd_derivatives.size();
983 double tmp[spacedim][spacedim][spacedim][spacedim][spacedim];
984 for (
unsigned int point=0; point<n_q_points; ++point)
987 &data.fourth_derivative(point+data_set, 0);
991 for (
unsigned int k=0; k<data.n_shape_functions; ++k)
993 unsigned int comp_k =
fe.system_to_component_index(k).first;
995 for (
unsigned int j=0; j<dim; ++j)
996 for (
unsigned int l=0; l<dim; ++l)
997 for (
unsigned int m=0; m<dim; ++m)
998 for (
unsigned int n=0; n<dim; ++n)
1000 += (fourth[k][j][l][m][n]
1001 * data.local_dof_values[k]);
1005 for (
unsigned int i=0; i<spacedim; ++i)
1006 for (
unsigned int j=0; j<spacedim; ++j)
1007 for (
unsigned int l=0; l<dim; ++l)
1008 for (
unsigned int m=0; m<dim; ++m)
1009 for (
unsigned int n=0; n<dim; ++n)
1011 tmp[i][j][l][m][n] = result[i][0][l][m][n] *
1012 data.covariant[point][j][0];
1013 for (
unsigned int jr=1; jr<dim; ++jr)
1014 tmp[i][j][l][m][n] += result[i][jr][l][m][n] *
1015 data.covariant[point][j][jr];
1019 for (
unsigned int i=0; i<spacedim; ++i)
1020 for (
unsigned int j=0; j<spacedim; ++j)
1021 for (
unsigned int l=0; l<spacedim; ++l)
1022 for (
unsigned int m=0; m<dim; ++m)
1023 for (
unsigned int n=0; n<dim; ++n)
1025 jacobian_pushed_forward_3rd_derivatives[point][i][j][l][m][n]
1026 = tmp[i][j][0][m][n] *
1027 data.covariant[point][l][0];
1028 for (
unsigned int lr=1; lr<dim; ++lr)
1029 jacobian_pushed_forward_3rd_derivatives[point][i][j][l][m][n]
1030 += tmp[i][j][lr][m][n] *
1031 data.covariant[point][l][lr];
1035 for (
unsigned int i=0; i<spacedim; ++i)
1036 for (
unsigned int j=0; j<spacedim; ++j)
1037 for (
unsigned int l=0; l<spacedim; ++l)
1038 for (
unsigned int m=0; m<spacedim; ++m)
1039 for (
unsigned int n=0; n<dim; ++n)
1042 = jacobian_pushed_forward_3rd_derivatives[point][i][j][l][0][n] *
1043 data.covariant[point][m][0];
1044 for (
unsigned int mr=1; mr<dim; ++mr)
1046 += jacobian_pushed_forward_3rd_derivatives[point][i][j][l][mr][n] *
1047 data.covariant[point][m][mr];
1051 for (
unsigned int i=0; i<spacedim; ++i)
1052 for (
unsigned int j=0; j<spacedim; ++j)
1053 for (
unsigned int l=0; l<spacedim; ++l)
1054 for (
unsigned int m=0; m<spacedim; ++m)
1055 for (
unsigned int n=0; n<spacedim; ++n)
1057 jacobian_pushed_forward_3rd_derivatives[point][i][j][l][m][n]
1058 = tmp[i][j][l][m][0] *
1059 data.covariant[point][n][0];
1060 for (
unsigned int nr=1; nr<dim; ++nr)
1061 jacobian_pushed_forward_3rd_derivatives[point][i][j][l][m][n]
1062 += tmp[i][j][l][m][nr] *
1063 data.covariant[point][n][nr];
1080 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1083 const typename ::Triangulation<dim,spacedim>::cell_iterator &cell,
1084 const unsigned int face_no,
1085 const unsigned int subface_no,
1086 const std::vector<double> &weights,
1087 const typename ::MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::InternalData &data,
1090 const UpdateFlags update_flags = data.update_each;
1094 const unsigned int n_q_points = output_data.
boundary_forms.size();
1103 for (
unsigned int d=0; d!=dim-1; ++d)
1106 data.unit_tangentials.size(),
1108 Assert (data.aux[d].size() <=
1115 make_array_view(data.aux[d]));
1120 if (dim == spacedim)
1122 for (
unsigned int i=0; i<n_q_points; ++i)
1134 output_data.
boundary_forms[i] = cross_product_2d(data.aux[0][i]);
1138 cross_product_3d(data.aux[0][i], data.aux[1][i]);
1154 for (
unsigned int point=0; point<n_q_points; ++point)
1159 output_data.
boundary_forms[point] = data.contravariant[point].transpose()[0];
1161 (face_no == 0 ? -1. : +1.) * output_data.
boundary_forms[point].norm();
1171 cross_product_3d(DX_t[0], DX_t[1]);
1172 cell_normal /= cell_normal.
norm();
1177 cross_product_3d(data.aux[0][point], cell_normal);
1193 cell->subface_case(face_no), subface_no);
1203 for (
unsigned int point=0; point<n_q_points; ++point)
1204 output_data.
jacobians[point] = data.contravariant[point];
1207 for (
unsigned int point=0; point<n_q_points; ++point)
1218 template<
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1221 const typename ::Triangulation<dim,spacedim>::cell_iterator &cell,
1222 const unsigned int face_no,
1223 const unsigned int subface_no,
1224 const typename ::QProjector<dim>::DataSetDescriptor data_set,
1226 const typename ::MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::InternalData &data,
1232 maybe_compute_q_points<dim,spacedim,VectorType,DoFHandlerType>
1238 maybe_update_Jacobians<dim,spacedim,VectorType,DoFHandlerType>
1244 maybe_update_jacobian_grads<dim,spacedim,VectorType,DoFHandlerType>
1251 maybe_update_jacobian_pushed_forward_grads<dim,spacedim,VectorType,DoFHandlerType>
1258 maybe_update_jacobian_2nd_derivatives<dim,spacedim,VectorType,DoFHandlerType>
1265 maybe_update_jacobian_pushed_forward_2nd_derivatives<dim,spacedim,VectorType,DoFHandlerType>
1272 maybe_update_jacobian_3rd_derivatives<dim,spacedim,VectorType,DoFHandlerType>
1279 maybe_update_jacobian_pushed_forward_3rd_derivatives<dim,spacedim,VectorType,DoFHandlerType>
1286 maybe_compute_face_data<dim,spacedim,VectorType,DoFHandlerType>
1288 cell, face_no, subface_no,
1297 template<
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1309 const InternalData &data =
static_cast<const InternalData &
> (internal_data);
1311 const unsigned int n_q_points=quadrature.
size();
1321 internal::maybe_compute_q_points<dim,spacedim,VectorType,DoFHandlerType>
1326 internal::maybe_update_Jacobians<dim,spacedim,VectorType,DoFHandlerType>
1331 const UpdateFlags update_flags = data.update_each;
1332 const std::vector<double> &weights=quadrature.
get_weights();
1347 for (
unsigned int point=0;
point<n_q_points; ++
point)
1349 if (dim == spacedim)
1351 const double det = data.contravariant[
point].determinant();
1358 Assert (det > 1e-12*Utilities::fixed_power<dim>(cell->diameter()/
1359 std::sqrt(
double(dim))),
1369 for (
unsigned int i=0; i<spacedim; ++i)
1370 for (
unsigned int j=0; j<dim; ++j)
1371 DX_t[j][i] = data.contravariant[point][i][j];
1374 for (
unsigned int i=0; i<dim; ++i)
1375 for (
unsigned int j=0; j<dim; ++j)
1376 G[i][j] = DX_t[i] * DX_t[j];
1390 Assert (spacedim - dim == 1,
1391 ExcMessage(
"There is no cell normal in codim 2."));
1395 cross_product_2d(-DX_t[0]);
1398 cross_product_3d(DX_t[0], DX_t[1]);
1402 if (cell->direction_flag() ==
false)
1416 for (
unsigned int point=0;
point<n_q_points; ++
point)
1417 output_data.
jacobians[point] = data.contravariant[point];
1425 for (
unsigned int point=0;
point<n_q_points; ++
point)
1430 internal::maybe_update_jacobian_grads<dim,spacedim,VectorType,DoFHandlerType>
1437 internal::maybe_update_jacobian_pushed_forward_grads<dim,spacedim,VectorType,DoFHandlerType>
1444 internal::maybe_update_jacobian_2nd_derivatives<dim,spacedim,VectorType,DoFHandlerType>
1451 internal::maybe_update_jacobian_pushed_forward_2nd_derivatives<dim,spacedim,VectorType,DoFHandlerType>
1458 internal::maybe_update_jacobian_3rd_derivatives<dim,spacedim,VectorType,DoFHandlerType>
1466 internal::maybe_update_jacobian_pushed_forward_3rd_derivatives<dim,spacedim,VectorType,DoFHandlerType>
1472 return updated_cell_similarity;
1477 template<
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1481 const unsigned int face_no,
1488 Assert (dynamic_cast<const InternalData *> (&internal_data) != 0,
1490 const InternalData &data =
static_cast<const InternalData &
> (internal_data);
1494 internal::do_fill_fe_face_values<dim,spacedim,VectorType,DoFHandlerType>
1499 cell->face_orientation(face_no),
1500 cell->face_flip(face_no),
1501 cell->face_rotation(face_no),
1510 template<
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1514 const unsigned int face_no,
1515 const unsigned int subface_no,
1522 Assert (dynamic_cast<const InternalData *> (&internal_data) != 0,
1524 const InternalData &data =
static_cast<const InternalData &
> (internal_data);
1528 internal::do_fill_fe_face_values<dim,spacedim,VectorType,DoFHandlerType>
1533 cell->face_orientation(face_no),
1534 cell->face_flip(face_no),
1535 cell->face_rotation(face_no),
1537 cell->subface_case(face_no)),
1547 template<
int dim,
int spacedim,
int rank,
typename VectorType,
typename DoFHandlerType>
1560 switch (mapping_type)
1567 for (
unsigned int i=0; i<output.size(); ++i)
1568 output[i] = apply_transformation(data.
contravariant[i], input[i]);
1580 for (
unsigned int i=0; i<output.size(); ++i)
1582 output[i] = apply_transformation(data.
contravariant[i], input[i]);
1597 for (
unsigned int i=0; i<output.size(); ++i)
1598 output[i] = apply_transformation(data.
covariant[i], input[i]);
1609 template<
int dim,
int spacedim,
int rank,
typename VectorType,
typename DoFHandlerType>
1611 transform_differential_forms
1624 switch (mapping_type)
1631 for (
unsigned int i=0; i<output.size(); ++i)
1632 output[i] = apply_transformation(data.
covariant[i], input[i]);
1645 template<
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1655 transform_fields<dim,spacedim,1,VectorType,DoFHandlerType>(input, mapping_type, mapping_data, output);
1660 template<
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1670 transform_differential_forms<dim,spacedim,1,VectorType,DoFHandlerType>(input, mapping_type, mapping_data, output);
1675 template<
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1693 template<
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1702 Assert (dynamic_cast<const InternalData *>(&mapping_data) != 0,
1706 switch (mapping_type)
1713 for (
unsigned int q=0; q<output.
size(); ++q)
1714 for (
unsigned int i=0; i<spacedim; ++i)
1715 for (
unsigned int j=0; j<spacedim; ++j)
1716 for (
unsigned int k=0; k<spacedim; ++k)
1718 output[q][i][j][k] = data.
covariant[q][j][0]
1720 * input[q][i][0][0];
1721 for (
unsigned int J=0; J<dim; ++J)
1723 const unsigned int K0 = (0==J)? 1 : 0;
1724 for (
unsigned int K=K0; K<dim; ++K)
1725 output[q][i][j][k] += data.
covariant[q][j][J]
1727 * input[q][i][J][K];
1742 template<
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1762 template<
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1781 template<
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1790 unsigned int comp_i =
fe->system_to_component_index(i).first;
1791 if (fe_mask[comp_i])
1800 template<
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1819 for (
unsigned int d=0; d<dim; ++d)
1820 initial_p_unit[d] = 0.5;
1833 std_cxx11::unique_ptr<InternalData>
1834 mdata (
get_data(update_flags,point_quadrature));
1843 template<
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1872 const double eps = 1.e-12*cell->diameter();
1873 const unsigned int newton_iteration_limit = 20;
1874 unsigned int newton_iteration=0;
1883 unsigned int comp_k =
fe->system_to_component_index(k).first;
1884 if (fe_mask[comp_k])
1885 for (
unsigned int j=0; j<dim; ++j)
1888 for (
unsigned int j=0; j<dim; ++j)
1890 f[j] = DF[j] * p_minus_F;
1891 for (
unsigned int l=0; l<dim; ++l)
1892 df[j][l] = -DF[j] * DF[l];
1898 double step_length = 1;
1911 for (
unsigned int i=0; i<dim; ++i)
1912 p_unit_trial[i] -= step_length * delta[i];
1921 if (f_trial.
norm() < p_minus_F.
norm())
1923 p_real = p_real_trial;
1924 p_unit = p_unit_trial;
1925 p_minus_F = f_trial;
1928 else if (step_length > 0.05)
1935 if (newton_iteration > newton_iteration_limit)
1951 template<
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1959 template<
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1963 return this->fe_mask;
1967 template<
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1975 template<
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1993 #define SPLIT_INSTANTIATIONS_COUNT 2 1994 #ifndef SPLIT_INSTANTIATIONS_INDEX 1995 #define SPLIT_INSTANTIATIONS_INDEX 0 1997 #include "mapping_fe_field.inst" 2000 DEAL_II_NAMESPACE_CLOSE
Transformed quadrature weights.
static const unsigned int invalid_unsigned_int
#define AssertDimension(dim1, dim2)
virtual Mapping< dim, spacedim >::InternalDataBase * get_subface_data(const UpdateFlags flags, const Quadrature< dim-1 > &quadrature) const
Contravariant transformation.
const std::vector< Point< dim > > & get_points() const
unsigned int n_shape_functions
const std::vector< double > & get_weights() const
virtual std::size_t memory_consumption() const
Outer normal vector, not normalized.
std::vector< unsigned int > fe_to_real
Determinant of the Jacobian.
Transformed quadrature points.
SmartPointer< const FiniteElement< dim, spacedim >, MappingFEField< dim, spacedim, VectorType, DoFHandlerType > > fe
#define AssertThrow(cond, exc)
void maybe_compute_face_data(const ::Mapping< dim, spacedim > &mapping, const typename ::Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const unsigned int subface_no, const std::vector< double > &weights, const typename ::MappingFEField< dim, spacedim, VectorType, DoFHandlerType >::InternalData &data, internal::FEValues::MappingRelatedData< dim, spacedim > &output_data)
numbers::NumberTraits< Number >::real_type norm() const
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
static DataSetDescriptor cell()
Point< spacedim > do_transform_unit_to_real_cell(const InternalData &mdata) const
unsigned int get_degree() const
void maybe_update_jacobian_pushed_forward_3rd_derivatives(const CellSimilarity::Similarity cell_similarity, const typename ::QProjector< dim >::DataSetDescriptor data_set, const typename ::MappingFEField< dim, spacedim, VectorType, DoFHandlerType >::InternalData &data, const FiniteElement< dim, spacedim > &fe, const ComponentMask &fe_mask, const std::vector< unsigned int > &fe_to_real, std::vector< Tensor< 5, spacedim > > &jacobian_pushed_forward_3rd_derivatives)
virtual Mapping< dim, spacedim > * clone() const
std::vector< DerivativeForm< 1, dim, spacedim > > covariant
virtual Point< dim > transform_real_to_unit_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< spacedim > &p) const
InternalData(const FiniteElement< dim, spacedim > &fe, const ComponentMask mask)
static ::ExceptionBase & ExcMessage(std::string arg1)
std::vector< Tensor< 3, dim > > shape_third_derivatives
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
Abstract base class for mapping classes.
virtual Point< spacedim > transform_unit_to_real_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< dim > &p) const
std::vector< double > volume_elements
numbers::NumberTraits< Number >::real_type norm_square() const
unsigned int size() const
const double & shape(const unsigned int qpoint, const unsigned int shape_nr) const
virtual InternalData * get_data(const UpdateFlags, const Quadrature< dim > &quadrature) const
virtual Mapping< dim, spacedim >::InternalDataBase * get_face_data(const UpdateFlags flags, const Quadrature< dim-1 > &quadrature) const
void do_fill_fe_face_values(const ::Mapping< 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 ::MappingFEField< dim, spacedim, VectorType, DoFHandlerType >::InternalData &data, const FiniteElement< dim, spacedim > &fe, const ComponentMask &fe_mask, const std::vector< unsigned int > &fe_to_real, internal::FEValues::MappingRelatedData< dim, spacedim > &output_data)
SmartPointer< const DoFHandlerType, MappingFEField< dim, spacedim, VectorType, DoFHandlerType > > euler_dof_handler
virtual bool preserves_vertex_locations() const
Gradient of volume element.
std::vector< double > local_dof_values
const Tensor< 3, dim > & third_derivative(const unsigned int qpoint, const unsigned int shape_nr) const
unsigned int size() const
const unsigned int dofs_per_cell
std::vector< double > shape_values
std::vector< Tensor< 4, dim > > shape_fourth_derivatives
friend class MappingFEField
std::vector< types::global_dof_index > local_dof_indices
virtual void compute_shapes_virtual(const std::vector< Point< dim > > &unit_points, typename MappingFEField< dim, spacedim, VectorType, DoFHandlerType >::InternalData &data) const
void maybe_update_jacobian_3rd_derivatives(const CellSimilarity::Similarity cell_similarity, const typename ::QProjector< dim >::DataSetDescriptor data_set, const typename ::MappingFEField< dim, spacedim, VectorType, DoFHandlerType >::InternalData &data, const FiniteElement< dim, spacedim > &fe, const ComponentMask &fe_mask, const std::vector< unsigned int > &fe_to_real, std::vector< DerivativeForm< 4, dim, spacedim > > &jacobian_3rd_derivatives)
const Tensor< 2, dim > & second_derivative(const unsigned int qpoint, const unsigned int shape_nr) const
SmartPointer< const VectorType, MappingFEField< dim, spacedim, VectorType, DoFHandlerType > > euler_vector
const Tensor< 4, dim > & fourth_derivative(const unsigned int qpoint, const unsigned int shape_nr) const
static Point< dim > project_to_unit_cell(const Point< dim > &p)
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)
const Tensor< 1, dim > & derivative(const unsigned int qpoint, const unsigned int shape_nr) const
static ::ExceptionBase & ExcNotImplemented()
std::vector< DerivativeForm< 1, dim, spacedim > > contravariant
virtual UpdateFlags requires_update_flags(const UpdateFlags update_flags) const
ComponentMask get_component_mask() const
std::vector< Tensor< 2, dim > > shape_second_derivatives
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
void update_internal_dofs(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const typename MappingFEField< dim, spacedim, VectorType, DoFHandlerType >::InternalData &data) const
static ::ExceptionBase & ExcInactiveCell()
Point< 3 > point(const gp_Pnt &p)
std::vector< Tensor< 1, dim > > shape_derivatives
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
static double subface_ratio(const internal::SubfaceCase< dim > &subface_case, const unsigned int subface_no)
Covariant transformation.
Tensor< 2, dim, Number > l(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
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)