16 #include <deal.II/base/array_view.h> 17 #include <deal.II/base/tensor_product_polynomials.h> 18 #include <deal.II/base/polynomial.h> 19 #include <deal.II/base/quadrature.h> 20 #include <deal.II/base/quadrature_lib.h> 21 #include <deal.II/base/qprojector.h> 22 #include <deal.II/base/memory_consumption.h> 23 #include <deal.II/base/std_cxx14/memory.h> 24 #include <deal.II/base/utilities.h> 25 #include <deal.II/lac/full_matrix.h> 26 #include <deal.II/lac/vector.h> 27 #include <deal.II/lac/block_vector.h> 28 #include <deal.II/lac/la_vector.h> 29 #include <deal.II/lac/parallel_vector.h> 30 #include <deal.II/lac/parallel_block_vector.h> 31 #include <deal.II/lac/petsc_parallel_vector.h> 32 #include <deal.II/lac/petsc_parallel_block_vector.h> 33 #include <deal.II/lac/trilinos_vector.h> 34 #include <deal.II/lac/trilinos_parallel_block_vector.h> 35 #include <deal.II/lac/trilinos_parallel_block_vector.h> 36 #include <deal.II/grid/tria_iterator.h> 37 #include <deal.II/grid/tria_boundary.h> 38 #include <deal.II/dofs/dof_accessor.h> 39 #include <deal.II/fe/fe_tools.h> 40 #include <deal.II/fe/fe_values.h> 41 #include <deal.II/fe/fe_system.h> 42 #include <deal.II/fe/mapping_fe_field.h> 43 #include <deal.II/fe/fe_q.h> 44 #include <deal.II/fe/mapping.h> 45 #include <deal.II/fe/mapping_q1.h> 46 #include <deal.II/base/qprojector.h> 47 #include <deal.II/base/thread_management.h> 48 #include <deal.II/numerics/vector_tools.h> 56 DEAL_II_NAMESPACE_OPEN
59 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
73 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
83 template <
int dim,
int spacedim,
typename DoFHandlerType,
typename VectorType>
86 (
const unsigned int qpoint,
87 const unsigned int shape_nr)
89 Assert(qpoint*n_shape_functions + shape_nr < shape_values.size(),
91 shape_values.size()));
92 return shape_values [qpoint*n_shape_functions + shape_nr];
96 template <
int dim,
int spacedim,
typename DoFHandlerType,
typename VectorType>
99 (
const unsigned int qpoint,
100 const unsigned int shape_nr)
const 102 Assert(qpoint*n_shape_functions + shape_nr < shape_derivatives.size(),
104 shape_derivatives.size()));
105 return shape_derivatives [qpoint*n_shape_functions + shape_nr];
110 template <
int dim,
int spacedim,
typename DoFHandlerType,
typename VectorType>
113 (
const unsigned int qpoint,
114 const unsigned int shape_nr)
116 Assert(qpoint*n_shape_functions + shape_nr < shape_derivatives.size(),
118 shape_derivatives.size()));
119 return shape_derivatives [qpoint*n_shape_functions + shape_nr];
123 template <
int dim,
int spacedim,
typename DoFHandlerType,
typename VectorType>
126 (
const unsigned int qpoint,
127 const unsigned int shape_nr)
const 129 Assert(qpoint*n_shape_functions + shape_nr < shape_second_derivatives.size(),
131 shape_second_derivatives.size()));
132 return shape_second_derivatives [qpoint*n_shape_functions + shape_nr];
137 template <
int dim,
int spacedim,
typename DoFHandlerType,
typename VectorType>
140 (
const unsigned int qpoint,
141 const unsigned int shape_nr)
143 Assert(qpoint*n_shape_functions + shape_nr < shape_second_derivatives.size(),
145 shape_second_derivatives.size()));
146 return shape_second_derivatives [qpoint*n_shape_functions + shape_nr];
150 template <
int dim,
int spacedim,
typename DoFHandlerType,
typename VectorType>
153 (
const unsigned int qpoint,
154 const unsigned int shape_nr)
const 156 Assert(qpoint*n_shape_functions + shape_nr < shape_third_derivatives.size(),
158 shape_third_derivatives.size()));
159 return shape_third_derivatives [qpoint*n_shape_functions + shape_nr];
164 template <
int dim,
int spacedim,
typename DoFHandlerType,
typename VectorType>
167 (
const unsigned int qpoint,
168 const unsigned int shape_nr)
170 Assert(qpoint*n_shape_functions + shape_nr < shape_third_derivatives.size(),
172 shape_third_derivatives.size()));
173 return shape_third_derivatives [qpoint*n_shape_functions + shape_nr];
177 template <
int dim,
int spacedim,
typename DoFHandlerType,
typename VectorType>
180 (
const unsigned int qpoint,
181 const unsigned int shape_nr)
const 183 Assert(qpoint*n_shape_functions + shape_nr < shape_fourth_derivatives.size(),
185 shape_fourth_derivatives.size()));
186 return shape_fourth_derivatives [qpoint*n_shape_functions + shape_nr];
191 template <
int dim,
int spacedim,
typename DoFHandlerType,
typename VectorType>
194 (
const unsigned int qpoint,
195 const unsigned int shape_nr)
197 Assert(qpoint*n_shape_functions + shape_nr < shape_fourth_derivatives.size(),
199 shape_fourth_derivatives.size()));
200 return shape_fourth_derivatives [qpoint*n_shape_functions + shape_nr];
213 if (quad.
size() == 0)
216 for (
unsigned int i=0; i<GeometryInfo<dim>::vertices_per_cell; ++i)
226 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
234 fe_mask(mask.
size() ? mask :
239 unsigned int size = 0;
240 for (
unsigned int i=0; i<fe_mask.
size(); ++i)
249 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
255 fe_mask(mapping.fe_mask),
262 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
266 (
const unsigned int qpoint,
267 const unsigned int shape_nr)
const 269 Assert(qpoint*n_shape_functions + shape_nr < shape_values.size(),
271 shape_values.size()));
272 return shape_values [qpoint*n_shape_functions + shape_nr];
277 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
286 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
301 std::vector<Vector<typename VectorType::value_type> >
312 for (
unsigned int i=0; i<GeometryInfo<dim>::vertices_per_cell; ++i)
313 for (
unsigned int j=0; j<
fe_to_real.size(); ++j)
322 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
329 const unsigned int n_points=unit_points.size();
331 for (
unsigned int point=0; point<n_points; ++point)
356 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
367 for (
unsigned int i=0; i<5; ++i)
415 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
420 const unsigned int n_original_q_points,
421 InternalData &data)
const 428 const unsigned int n_q_points = q.
size();
433 data.shape_values.resize(data.n_shape_functions * n_q_points);
443 data.shape_derivatives.resize(data.n_shape_functions * n_q_points);
446 data.covariant.resize(n_original_q_points);
449 data.contravariant.resize(n_original_q_points);
452 data.volume_elements.resize(n_original_q_points);
455 data.shape_second_derivatives.resize(data.n_shape_functions * n_q_points);
458 data.shape_third_derivatives.resize(data.n_shape_functions * n_q_points);
461 data.shape_fourth_derivatives.resize(data.n_shape_functions * n_q_points);
467 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
472 const unsigned int n_original_q_points,
473 InternalData &data)
const 475 compute_data (update_flags, q, n_original_q_points, data);
484 for (
unsigned int i=0; i<data.unit_tangentials.size(); ++i)
485 data.unit_tangentials[i].resize (n_original_q_points);
491 static const int tangential_orientation[4]= {-1,1,1,-1};
492 for (
unsigned int i=0; i<GeometryInfo<dim>::faces_per_cell; ++i)
495 tang[1-i/2]=tangential_orientation[i];
496 std::fill (data.unit_tangentials[i].begin(),
497 data.unit_tangentials[i].end(),
503 for (
unsigned int i=0; i<GeometryInfo<dim>::faces_per_cell; ++i)
507 const unsigned int nd=
519 tang2[(nd+2)%dim]=1.;
524 std::fill (data.unit_tangentials[i].begin(),
525 data.unit_tangentials[i].end(),
537 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
539 std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
543 auto data = std_cxx14::make_unique<InternalData>(
euler_dof_handler->get_fe(), fe_mask);
544 this->compute_data (update_flags, quadrature,
545 quadrature.
size(), *data);
546 return std::move(data);
551 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
552 std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
557 auto data = std_cxx14::make_unique<InternalData>(
euler_dof_handler->get_fe(), fe_mask);
559 this->compute_face_data (update_flags, q,
560 quadrature.
size(), *data);
562 return std::move(data);
566 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
567 std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
572 auto data = std_cxx14::make_unique<InternalData>(
euler_dof_handler->get_fe(), fe_mask);
574 this->compute_face_data (update_flags, q,
575 quadrature.
size(), *data);
577 return std::move(data);
584 namespace MappingFEFieldImplementation
594 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
596 maybe_compute_q_points (
const typename ::QProjector<dim>::DataSetDescriptor data_set,
597 const typename ::MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::InternalData &data,
607 for (
unsigned int point=0; point<quadrature_points.size(); ++point)
610 const double *shape = &data.shape(point+data_set,0);
612 for (
unsigned int k=0; k<data.n_shape_functions; ++k)
616 result[
fe_to_real[comp_k]] += data.local_dof_values[k] * shape[k];
619 quadrature_points[
point] = result;
631 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
634 const typename ::QProjector<dim>::DataSetDescriptor data_set,
635 const typename ::MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::InternalData &data,
650 const unsigned int n_q_points = data.contravariant.size();
654 for (
unsigned int point=0;
point<n_q_points; ++
point)
657 &data.derivative(point+data_set, 0);
661 for (
unsigned int k=0; k<data.n_shape_functions; ++k)
665 result[
fe_to_real[comp_k]] += data.local_dof_values[k] * data_derv[k];
669 for (
unsigned int i=0; i<spacedim; ++i)
671 data.contravariant[
point][i] = result[i];
681 for (
unsigned int point=0;
point<data.contravariant.size(); ++
point)
682 data.covariant[point] = (data.contravariant[point]).covariant_form();
689 for (
unsigned int point=0;
point<data.contravariant.size(); ++
point)
690 data.volume_elements[point] = data.contravariant[point].determinant();
700 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
703 const typename ::QProjector<dim>::DataSetDescriptor data_set,
704 const typename ::MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::InternalData &data,
713 const unsigned int n_q_points = jacobian_grads.size();
717 for (
unsigned int point=0;
point<n_q_points; ++
point)
720 &data.second_derivative(point+data_set, 0);
724 for (
unsigned int k=0; k<data.n_shape_functions; ++k)
728 for (
unsigned int j=0; j<dim; ++j)
729 for (
unsigned int l=0;
l<dim; ++
l)
730 result[
fe_to_real[comp_k]][j][l] += (second[k][j][l]
731 * data.local_dof_values[k]);
736 for (
unsigned int i=0; i<spacedim; ++i)
737 for (
unsigned int j=0; j<dim; ++j)
738 for (
unsigned int l=0;
l<dim; ++
l)
739 jacobian_grads[point][i][j][l] = result[i][j][l];
751 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
753 maybe_update_jacobian_pushed_forward_grads
755 const typename ::QProjector<dim>::DataSetDescriptor data_set,
756 const typename ::MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::InternalData &data,
765 const unsigned int n_q_points = jacobian_pushed_forward_grads.size();
769 double tmp[spacedim][spacedim][spacedim];
770 for (
unsigned int point=0;
point<n_q_points; ++
point)
773 &data.second_derivative(point+data_set, 0);
777 for (
unsigned int k=0; k<data.n_shape_functions; ++k)
781 for (
unsigned int j=0; j<dim; ++j)
782 for (
unsigned int l=0;
l<dim; ++
l)
783 result[
fe_to_real[comp_k]][j][l] += (second[k][j][l]
784 * data.local_dof_values[k]);
788 for (
unsigned int i=0; i<spacedim; ++i)
789 for (
unsigned int j=0; j<spacedim; ++j)
790 for (
unsigned int l=0;
l<dim; ++
l)
792 tmp[i][j][
l] = result[i][0][
l] *
793 data.covariant[
point][j][0];
794 for (
unsigned int jr=1; jr<dim; ++jr)
796 tmp[i][j][
l] += result[i][jr][
l] *
797 data.covariant[
point][j][jr];
802 for (
unsigned int i=0; i<spacedim; ++i)
803 for (
unsigned int j=0; j<spacedim; ++j)
804 for (
unsigned int l=0;
l<spacedim; ++
l)
806 jacobian_pushed_forward_grads[
point][i][j][
l] = tmp[i][j][0] *
807 data.covariant[
point][
l][0];
808 for (
unsigned int lr=1; lr<dim; ++lr)
810 jacobian_pushed_forward_grads[
point][i][j][
l] += tmp[i][j][lr] *
811 data.covariant[
point][
l][lr];
826 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
829 const typename ::QProjector<dim>::DataSetDescriptor data_set,
830 const typename ::MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::InternalData &data,
839 const unsigned int n_q_points = jacobian_2nd_derivatives.size();
843 for (
unsigned int point=0;
point<n_q_points; ++
point)
846 &data.third_derivative(point+data_set, 0);
850 for (
unsigned int k=0; k<data.n_shape_functions; ++k)
854 for (
unsigned int j=0; j<dim; ++j)
855 for (
unsigned int l=0;
l<dim; ++
l)
856 for (
unsigned int m=0; m<dim; ++m)
857 result[
fe_to_real[comp_k]][j][l][m] += (third[k][j][l][m]
858 * data.local_dof_values[k]);
863 for (
unsigned int i=0; i<spacedim; ++i)
864 for (
unsigned int j=0; j<dim; ++j)
865 for (
unsigned int l=0;
l<dim; ++
l)
866 for (
unsigned int m=0; m<dim; ++m)
867 jacobian_2nd_derivatives[point][i][j][l][m] = result[i][j][l][m];
879 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
881 maybe_update_jacobian_pushed_forward_2nd_derivatives
883 const typename ::QProjector<dim>::DataSetDescriptor data_set,
884 const typename ::MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::InternalData &data,
893 const unsigned int n_q_points = jacobian_pushed_forward_2nd_derivatives.size();
897 double tmp[spacedim][spacedim][spacedim][spacedim];
898 for (
unsigned int point=0;
point<n_q_points; ++
point)
901 &data.third_derivative(point+data_set, 0);
905 for (
unsigned int k=0; k<data.n_shape_functions; ++k)
909 for (
unsigned int j=0; j<dim; ++j)
910 for (
unsigned int l=0;
l<dim; ++
l)
911 for (
unsigned int m=0; m<dim; ++m)
912 result[
fe_to_real[comp_k]][j][l][m] += (third[k][j][l][m]
913 * data.local_dof_values[k]);
917 for (
unsigned int i=0; i<spacedim; ++i)
918 for (
unsigned int j=0; j<spacedim; ++j)
919 for (
unsigned int l=0;
l<dim; ++
l)
920 for (
unsigned int m=0; m<dim; ++m)
922 jacobian_pushed_forward_2nd_derivatives[
point][i][j][
l][m]
923 = result[i][0][
l][m]*
924 data.covariant[
point][j][0];
925 for (
unsigned int jr=1; jr<dim; ++jr)
926 jacobian_pushed_forward_2nd_derivatives[point][i][j][l][m]
927 += result[i][jr][l][m]*
928 data.covariant[point][j][jr];
932 for (
unsigned int i=0; i<spacedim; ++i)
933 for (
unsigned int j=0; j<spacedim; ++j)
934 for (
unsigned int l=0;
l<spacedim; ++
l)
935 for (
unsigned int m=0; m<dim; ++m)
938 = jacobian_pushed_forward_2nd_derivatives[
point][i][j][0][m]*
939 data.covariant[
point][
l][0];
940 for (
unsigned int lr=1; lr<dim; ++lr)
942 += jacobian_pushed_forward_2nd_derivatives[point][i][j][lr][m]*
943 data.covariant[point][l][lr];
947 for (
unsigned int i=0; i<spacedim; ++i)
948 for (
unsigned int j=0; j<spacedim; ++j)
949 for (
unsigned int l=0;
l<spacedim; ++
l)
950 for (
unsigned int m=0; m<spacedim; ++m)
952 jacobian_pushed_forward_2nd_derivatives[
point][i][j][
l][m]
954 data.covariant[
point][m][0];
955 for (
unsigned int mr=1; mr<dim; ++mr)
956 jacobian_pushed_forward_2nd_derivatives[point][i][j][l][m]
958 data.covariant[point][m][mr];
971 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
974 const typename ::QProjector<dim>::DataSetDescriptor data_set,
975 const typename ::MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::InternalData &data,
984 const unsigned int n_q_points = jacobian_3rd_derivatives.size();
988 for (
unsigned int point=0;
point<n_q_points; ++
point)
991 &data.fourth_derivative(point+data_set, 0);
995 for (
unsigned int k=0; k<data.n_shape_functions; ++k)
999 for (
unsigned int j=0; j<dim; ++j)
1000 for (
unsigned int l=0;
l<dim; ++
l)
1001 for (
unsigned int m=0; m<dim; ++m)
1002 for (
unsigned int n=0; n<dim; ++n)
1003 result[
fe_to_real[comp_k]][j][l][m][n] += (fourth[k][j][l][m][n]
1004 * data.local_dof_values[k]);
1009 for (
unsigned int i=0; i<spacedim; ++i)
1010 for (
unsigned int j=0; j<dim; ++j)
1011 for (
unsigned int l=0;
l<dim; ++
l)
1012 for (
unsigned int m=0; m<dim; ++m)
1013 for (
unsigned int n=0; n<dim; ++n)
1014 jacobian_3rd_derivatives[point][i][j][l][m][n] = result[i][j][l][m][n];
1027 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1029 maybe_update_jacobian_pushed_forward_3rd_derivatives
1031 const typename ::QProjector<dim>::DataSetDescriptor data_set,
1032 const typename ::MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::InternalData &data,
1038 const UpdateFlags update_flags = data.update_each;
1041 const unsigned int n_q_points = jacobian_pushed_forward_3rd_derivatives.size();
1045 double tmp[spacedim][spacedim][spacedim][spacedim][spacedim];
1046 for (
unsigned int point=0;
point<n_q_points; ++
point)
1049 &data.fourth_derivative(point+data_set, 0);
1053 for (
unsigned int k=0; k<data.n_shape_functions; ++k)
1056 if (fe_mask[comp_k])
1057 for (
unsigned int j=0; j<dim; ++j)
1058 for (
unsigned int l=0;
l<dim; ++
l)
1059 for (
unsigned int m=0; m<dim; ++m)
1060 for (
unsigned int n=0; n<dim; ++n)
1062 += (fourth[k][j][l][m][n]
1063 * data.local_dof_values[k]);
1067 for (
unsigned int i=0; i<spacedim; ++i)
1068 for (
unsigned int j=0; j<spacedim; ++j)
1069 for (
unsigned int l=0;
l<dim; ++
l)
1070 for (
unsigned int m=0; m<dim; ++m)
1071 for (
unsigned int n=0; n<dim; ++n)
1073 tmp[i][j][
l][m][n] = result[i][0][
l][m][n] *
1074 data.covariant[
point][j][0];
1075 for (
unsigned int jr=1; jr<dim; ++jr)
1076 tmp[i][j][l][m][n] += result[i][jr][l][m][n] *
1077 data.covariant[point][j][jr];
1081 for (
unsigned int i=0; i<spacedim; ++i)
1082 for (
unsigned int j=0; j<spacedim; ++j)
1083 for (
unsigned int l=0;
l<spacedim; ++
l)
1084 for (
unsigned int m=0; m<dim; ++m)
1085 for (
unsigned int n=0; n<dim; ++n)
1087 jacobian_pushed_forward_3rd_derivatives[
point][i][j][
l][m][n]
1088 = tmp[i][j][0][m][n] *
1089 data.covariant[
point][
l][0];
1090 for (
unsigned int lr=1; lr<dim; ++lr)
1091 jacobian_pushed_forward_3rd_derivatives[point][i][j][l][m][n]
1092 += tmp[i][j][lr][m][n] *
1093 data.covariant[point][l][lr];
1097 for (
unsigned int i=0; i<spacedim; ++i)
1098 for (
unsigned int j=0; j<spacedim; ++j)
1099 for (
unsigned int l=0;
l<spacedim; ++
l)
1100 for (
unsigned int m=0; m<spacedim; ++m)
1101 for (
unsigned int n=0; n<dim; ++n)
1104 = jacobian_pushed_forward_3rd_derivatives[
point][i][j][
l][0][n] *
1105 data.covariant[
point][m][0];
1106 for (
unsigned int mr=1; mr<dim; ++mr)
1108 += jacobian_pushed_forward_3rd_derivatives[point][i][j][l][mr][n] *
1109 data.covariant[point][m][mr];
1113 for (
unsigned int i=0; i<spacedim; ++i)
1114 for (
unsigned int j=0; j<spacedim; ++j)
1115 for (
unsigned int l=0;
l<spacedim; ++
l)
1116 for (
unsigned int m=0; m<spacedim; ++m)
1117 for (
unsigned int n=0; n<spacedim; ++n)
1119 jacobian_pushed_forward_3rd_derivatives[
point][i][j][
l][m][n]
1120 = tmp[i][j][
l][m][0] *
1121 data.covariant[
point][n][0];
1122 for (
unsigned int nr=1; nr<dim; ++nr)
1123 jacobian_pushed_forward_3rd_derivatives[point][i][j][l][m][n]
1124 += tmp[i][j][l][m][nr] *
1125 data.covariant[point][n][nr];
1142 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1144 maybe_compute_face_data (const ::Mapping<dim,spacedim> &mapping,
1145 const typename ::Triangulation<dim,spacedim>::cell_iterator &cell,
1146 const unsigned int face_no,
1147 const unsigned int subface_no,
1148 const std::vector<double> &weights,
1149 const typename ::MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::InternalData &data,
1152 const UpdateFlags update_flags = data.update_each;
1156 const unsigned int n_q_points = output_data.
boundary_forms.size();
1165 for (
unsigned int d=0;
d!=dim-1; ++
d)
1168 data.unit_tangentials.size(),
1170 Assert (data.aux[d].size() <=
1177 make_array_view(data.aux[d]));
1182 if (dim == spacedim)
1184 for (
unsigned int i=0; i<n_q_points; ++i)
1196 output_data.
boundary_forms[i] = cross_product_2d(data.aux[0][i]);
1200 cross_product_3d(data.aux[0][i], data.aux[1][i]);
1216 for (
unsigned int point=0;
point<n_q_points; ++
point)
1233 cross_product_3d(DX_t[0], DX_t[1]);
1234 cell_normal /= cell_normal.
norm();
1239 cross_product_3d(data.aux[0][point], cell_normal);
1255 cell->subface_case(face_no), subface_no);
1265 for (
unsigned int point=0;
point<n_q_points; ++
point)
1266 output_data.
jacobians[point] = data.contravariant[point];
1269 for (
unsigned int point=0;
point<n_q_points; ++
point)
1280 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1282 do_fill_fe_face_values (const ::Mapping<dim,spacedim> &mapping,
1283 const typename ::Triangulation<dim,spacedim>::cell_iterator &cell,
1284 const unsigned int face_no,
1285 const unsigned int subface_no,
1286 const typename ::QProjector<dim>::DataSetDescriptor data_set,
1288 const typename ::MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::InternalData &data,
1294 maybe_compute_q_points<dim,spacedim,VectorType,DoFHandlerType>
1300 maybe_update_Jacobians<dim,spacedim,VectorType,DoFHandlerType>
1306 maybe_update_jacobian_grads<dim,spacedim,VectorType,DoFHandlerType>
1313 maybe_update_jacobian_pushed_forward_grads<dim,spacedim,VectorType,DoFHandlerType>
1320 maybe_update_jacobian_2nd_derivatives<dim,spacedim,VectorType,DoFHandlerType>
1327 maybe_update_jacobian_pushed_forward_2nd_derivatives<dim,spacedim,VectorType,DoFHandlerType>
1334 maybe_update_jacobian_3rd_derivatives<dim,spacedim,VectorType,DoFHandlerType>
1341 maybe_update_jacobian_pushed_forward_3rd_derivatives<dim,spacedim,VectorType,DoFHandlerType>
1348 maybe_compute_face_data<dim,spacedim,VectorType,DoFHandlerType>
1350 cell, face_no, subface_no,
1361 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1373 const InternalData &data =
static_cast<const InternalData &
> (internal_data);
1375 const unsigned int n_q_points=quadrature.
size();
1385 internal::MappingFEFieldImplementation::maybe_compute_q_points<dim,spacedim,VectorType,DoFHandlerType>
1390 internal::MappingFEFieldImplementation::maybe_update_Jacobians<dim,spacedim,VectorType,DoFHandlerType>
1395 const UpdateFlags update_flags = data.update_each;
1396 const std::vector<double> &weights=quadrature.
get_weights();
1411 for (
unsigned int point=0;
point<n_q_points; ++
point)
1413 if (dim == spacedim)
1415 const double det = data.contravariant[
point].determinant();
1422 Assert (det > 1e-12*Utilities::fixed_power<dim>(cell->diameter()/
1423 std::sqrt(
double(dim))),
1433 for (
unsigned int i=0; i<spacedim; ++i)
1434 for (
unsigned int j=0; j<dim; ++j)
1435 DX_t[j][i] = data.contravariant[point][i][j];
1438 for (
unsigned int i=0; i<dim; ++i)
1439 for (
unsigned int j=0; j<dim; ++j)
1440 G[i][j] = DX_t[i] * DX_t[j];
1454 Assert (spacedim - dim == 1,
1455 ExcMessage(
"There is no cell normal in codim 2."));
1459 cross_product_2d(-DX_t[0]);
1462 cross_product_3d(DX_t[0], DX_t[1]);
1466 if (cell->direction_flag() ==
false)
1480 for (
unsigned int point=0;
point<n_q_points; ++
point)
1481 output_data.
jacobians[point] = data.contravariant[point];
1489 for (
unsigned int point=0;
point<n_q_points; ++
point)
1494 internal::MappingFEFieldImplementation::maybe_update_jacobian_grads<dim,spacedim,VectorType,DoFHandlerType>
1501 internal::MappingFEFieldImplementation::maybe_update_jacobian_pushed_forward_grads<dim,spacedim,VectorType,DoFHandlerType>
1508 internal::MappingFEFieldImplementation::maybe_update_jacobian_2nd_derivatives<dim,spacedim,VectorType,DoFHandlerType>
1515 internal::MappingFEFieldImplementation::maybe_update_jacobian_pushed_forward_2nd_derivatives<dim,spacedim,VectorType,DoFHandlerType>
1522 internal::MappingFEFieldImplementation::maybe_update_jacobian_3rd_derivatives<dim,spacedim,VectorType,DoFHandlerType>
1530 internal::MappingFEFieldImplementation::maybe_update_jacobian_pushed_forward_3rd_derivatives<dim,spacedim,VectorType,DoFHandlerType>
1536 return updated_cell_similarity;
1541 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1545 const unsigned int face_no,
1552 Assert (dynamic_cast<const InternalData *> (&internal_data) !=
nullptr,
1554 const InternalData &data =
static_cast<const InternalData &
> (internal_data);
1558 internal::MappingFEFieldImplementation::do_fill_fe_face_values<dim,spacedim,VectorType,DoFHandlerType>
1563 cell->face_orientation(face_no),
1564 cell->face_flip(face_no),
1565 cell->face_rotation(face_no),
1574 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1578 const unsigned int face_no,
1579 const unsigned int subface_no,
1586 Assert (dynamic_cast<const InternalData *> (&internal_data) !=
nullptr,
1588 const InternalData &data =
static_cast<const InternalData &
> (internal_data);
1592 internal::MappingFEFieldImplementation::do_fill_fe_face_values<dim,spacedim,VectorType,DoFHandlerType>
1597 cell->face_orientation(face_no),
1598 cell->face_flip(face_no),
1599 cell->face_rotation(face_no),
1601 cell->subface_case(face_no)),
1611 namespace MappingFEFieldImplementation
1615 template <
int dim,
int spacedim,
int rank,
typename VectorType,
typename DoFHandlerType>
1623 Assert ((
dynamic_cast<const typename ::MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::InternalData *
>(&mapping_data) !=
nullptr),
1625 const typename ::MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::InternalData
1626 &data =
static_cast<const typename ::MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::InternalData &
>(mapping_data);
1628 switch (mapping_type)
1635 for (
unsigned int i=0; i<output.size(); ++i)
1636 output[i] = apply_transformation(data.contravariant[i], input[i]);
1648 for (
unsigned int i=0; i<output.size(); ++i)
1650 output[i] = apply_transformation(data.contravariant[i], input[i]);
1651 output[i] /= data.volume_elements[i];
1665 for (
unsigned int i=0; i<output.size(); ++i)
1666 output[i] = apply_transformation(data.covariant[i], input[i]);
1677 template <
int dim,
int spacedim,
int rank,
typename VectorType,
typename DoFHandlerType>
1679 transform_differential_forms
1687 Assert ((
dynamic_cast<const typename ::MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::InternalData *
>(&mapping_data) !=
nullptr),
1689 const typename ::MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::InternalData
1690 &data =
static_cast<const typename ::MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::InternalData &
>(mapping_data);
1692 switch (mapping_type)
1699 for (
unsigned int i=0; i<output.size(); ++i)
1700 output[i] = apply_transformation(data.covariant[i], input[i]);
1715 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1725 internal::MappingFEFieldImplementation::transform_fields<dim,spacedim,1,VectorType,DoFHandlerType>(input, mapping_type, mapping_data, output);
1730 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1740 internal::MappingFEFieldImplementation::transform_differential_forms<dim,spacedim,1,VectorType,DoFHandlerType>(input, mapping_type, mapping_data, output);
1745 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1763 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1772 Assert (dynamic_cast<const InternalData *>(&mapping_data) !=
nullptr,
1776 switch (mapping_type)
1783 for (
unsigned int q=0; q<output.
size(); ++q)
1784 for (
unsigned int i=0; i<spacedim; ++i)
1785 for (
unsigned int j=0; j<spacedim; ++j)
1786 for (
unsigned int k=0; k<spacedim; ++k)
1788 output[q][i][j][k] = data.
covariant[q][j][0]
1790 * input[q][i][0][0];
1791 for (
unsigned int J=0; J<dim; ++J)
1793 const unsigned int K0 = (0==J)? 1 : 0;
1794 for (
unsigned int K=K0; K<dim; ++K)
1795 output[q][i][j][k] += data.
covariant[q][j][J]
1797 * input[q][i][J][K];
1812 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1832 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1842 std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
1845 Assert (dynamic_cast<InternalData *>(mdata.get()) !=
nullptr,
1849 dynamic_cast<InternalData &>(*mdata));
1855 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1864 unsigned int comp_i =
euler_dof_handler->get_fe().system_to_component_index(i).first;
1865 if (fe_mask[comp_i])
1874 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1893 for (
unsigned int d=0; d<dim; ++d)
1894 initial_p_unit[d] = 0.5;
1907 std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
1908 mdata (
get_data(update_flags,point_quadrature));
1909 Assert (dynamic_cast<InternalData *>(mdata.get()) !=
nullptr,
1915 dynamic_cast<InternalData &>(*mdata));
1920 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
1949 const double eps = 1.e-12*cell->diameter();
1950 const unsigned int newton_iteration_limit = 20;
1951 unsigned int newton_iteration=0;
1960 unsigned int comp_k =
euler_dof_handler->get_fe().system_to_component_index(k).first;
1961 if (fe_mask[comp_k])
1962 for (
unsigned int j=0; j<dim; ++j)
1965 for (
unsigned int j=0; j<dim; ++j)
1967 f[j] = DF[j] * p_minus_F;
1968 for (
unsigned int l=0; l<dim; ++l)
1969 df[j][l] = -DF[j] * DF[l];
1975 double step_length = 1;
1988 for (
unsigned int i=0; i<dim; ++i)
1989 p_unit_trial[i] -= step_length * delta[i];
1998 if (f_trial.
norm() < p_minus_F.
norm())
2000 p_real = p_real_trial;
2001 p_unit = p_unit_trial;
2002 p_minus_F = f_trial;
2005 else if (step_length > 0.05)
2012 if (newton_iteration > newton_iteration_limit)
2028 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
2036 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
2040 return this->fe_mask;
2044 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
2045 std::unique_ptr<Mapping<dim,spacedim> >
2048 return std_cxx14::make_unique<MappingFEField<dim,spacedim,VectorType,DoFHandlerType>>(*this);
2052 template <
int dim,
int spacedim,
typename VectorType,
typename DoFHandlerType>
2071 #define SPLIT_INSTANTIATIONS_COUNT 2 2072 #ifndef SPLIT_INSTANTIATIONS_INDEX 2073 #define SPLIT_INSTANTIATIONS_INDEX 0 2075 #include "mapping_fe_field.inst" 2078 DEAL_II_NAMESPACE_CLOSE
Transformed quadrature weights.
virtual std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBase > get_data(const UpdateFlags, const Quadrature< dim > &quadrature) const override
static const unsigned int invalid_unsigned_int
#define AssertDimension(dim1, dim2)
Number determinant(const SymmetricTensor< 2, dim, Number > &)
Contravariant transformation.
virtual Tensor< 3, dim > shape_3rd_derivative(const unsigned int i, const Point< dim > &p) const
const std::vector< Point< dim > > & get_points() const
unsigned int n_shape_functions
virtual std::unique_ptr< Mapping< dim, spacedim > > clone() const override
const std::vector< double > & get_weights() const
Point< spacedim > point(const gp_Pnt &p, const double &tolerance=1e-10)
virtual Tensor< 1, dim > shape_grad(const unsigned int i, const Point< dim > &p) const
Outer normal vector, not normalized.
std::vector< unsigned int > fe_to_real
Determinant of the Jacobian.
Transformed quadrature points.
#define AssertThrow(cond, exc)
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
virtual std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBase > get_face_data(const UpdateFlags flags, const Quadrature< dim-1 > &quadrature) const override
unsigned int get_degree() const
std::vector< DerivativeForm< 1, dim, spacedim > > covariant
SymmetricTensor< 2, dim, Number > invert(const SymmetricTensor< 2, dim, Number > &)
virtual void transform(const ArrayView< const Tensor< 1, dim > > &input, const MappingType type, const typename Mapping< dim, spacedim >::InternalDataBase &internal, const ArrayView< Tensor< 1, spacedim > > &output) const override
static ::ExceptionBase & ExcMessage(std::string arg1)
const double & shape(const unsigned int qpoint, const unsigned int shape_nr) const
ActiveSelector::cell_iterator cell_iterator
std::vector< Tensor< 3, dim > > shape_third_derivatives
#define Assert(cond, exc)
Threads::Mutex fe_values_mutex
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
Abstract base class for mapping classes.
numbers::NumberTraits< Number >::real_type norm_square() const
unsigned int size() const
SmartPointer< const DoFHandlerType, MappingFEField< dim, spacedim, VectorType, DoFHandlerType > > euler_dof_handler
virtual Point< dim > transform_real_to_unit_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< spacedim > &p) const override
Gradient of volume element.
std::vector< double > local_dof_values
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
const Tensor< 3, dim > & third_derivative(const unsigned int qpoint, const unsigned int shape_nr) const
virtual std::array< Point< spacedim >, GeometryInfo< dim >::vertices_per_cell > get_vertices(const typename Triangulation< dim, spacedim >::cell_iterator &cell) const override
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
static Point< dim > project_to_unit_cell(const Point< dim > &p)
std::pair< unsigned int, unsigned int > system_to_component_index(const unsigned int index) const
virtual double shape_value(const unsigned int i, const Point< dim > &p) const
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
FEValues< dim, spacedim > fe_values
const Tensor< 4, dim > & fourth_derivative(const unsigned int qpoint, const unsigned int shape_nr) const
virtual Point< spacedim > transform_unit_to_real_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< dim > &p) const override
virtual Tensor< 2, dim > shape_grad_grad(const unsigned int i, const Point< dim > &p) const
static DataSetDescriptor subface(const unsigned int face_no, const unsigned int subface_no, const bool face_orientation, const bool face_flip, const bool face_rotation, const unsigned int n_quadrature_points, const internal::SubfaceCase< dim > ref_case=internal::SubfaceCase< dim >::case_isotropic)
virtual std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBase > get_subface_data(const UpdateFlags flags, const Quadrature< dim-1 > &quadrature) const override
const Tensor< 1, dim > & derivative(const unsigned int qpoint, const unsigned int shape_nr) const
static ::ExceptionBase & ExcNotImplemented()
ComponentMask get_component_mask() const
std::vector< Tensor< 2, dim > > shape_second_derivatives
void update_internal_dofs(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const typename MappingFEField< dim, spacedim, VectorType, DoFHandlerType >::InternalData &data) const
virtual bool preserves_vertex_locations() const override
static ::ExceptionBase & ExcInactiveCell()
virtual Tensor< 4, dim > shape_4th_derivative(const unsigned int i, const Point< dim > &p) const
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.
virtual std::size_t memory_consumption() const override
InternalData(const FiniteElement< dim, spacedim > &fe, const ComponentMask &mask)
virtual UpdateFlags requires_update_flags(const UpdateFlags update_flags) const override
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)