17 #include <deal.II/base/derivative_form.h> 18 #include <deal.II/base/quadrature.h> 19 #include <deal.II/base/qprojector.h> 20 #include <deal.II/base/quadrature_lib.h> 21 #include <deal.II/base/tensor_product_polynomials.h> 22 #include <deal.II/base/memory_consumption.h> 23 #include <deal.II/base/std_cxx11/array.h> 24 #include <deal.II/base/std_cxx11/unique_ptr.h> 25 #include <deal.II/lac/full_matrix.h> 26 #include <deal.II/grid/tria.h> 27 #include <deal.II/grid/tria_iterator.h> 28 #include <deal.II/grid/tria_boundary.h> 29 #include <deal.II/dofs/dof_accessor.h> 30 #include <deal.II/fe/fe_tools.h> 31 #include <deal.II/fe/fe.h> 32 #include <deal.II/fe/fe_values.h> 33 #include <deal.II/fe/mapping_q_generic.h> 34 #include <deal.II/fe/mapping_q1.h> 41 DEAL_II_NAMESPACE_OPEN
47 std::vector<unsigned int>
48 get_dpo_vector (
const unsigned int degree)
50 std::vector<unsigned int> dpo(dim+1, 1U);
51 for (
unsigned int i=1; i<dpo.size(); ++i)
52 dpo[i]=dpo[i-1]*(degree-1);
69 template<
int spacedim>
71 transform_real_to_unit_cell
76 return Point<1>((p[0] - vertices[0](0))/(vertices[1](0) - vertices[0](0)));
81 template<
int spacedim>
83 transform_real_to_unit_cell
88 const double x = p(0);
89 const double y = p(1);
91 const double x0 = vertices[0](0);
92 const double x1 = vertices[1](0);
93 const double x2 = vertices[2](0);
94 const double x3 = vertices[3](0);
96 const double y0 = vertices[0](1);
97 const double y1 = vertices[1](1);
98 const double y2 = vertices[2](1);
99 const double y3 = vertices[3](1);
101 const double a = (x1 - x3)*(y0 - y2) - (x0 - x2)*(y1 - y3);
102 const double b = -(x0 - x1 - x2 + x3)*y + (x - 2*x1 + x3)*y0 - (x - 2*x0 + x2)*y1
103 - (x - x1)*y2 + (x - x0)*y3;
104 const double c = (x0 - x1)*y - (x - x1)*y0 + (x - x0)*y1;
106 const double discriminant =
b*
b - 4*a*c;
109 if (discriminant < 0.0)
118 if (a == 0.0 && b != 0.0)
125 else if (std::abs(c) < 1e-12*std::abs(b)
126 || std::abs(std::sqrt(discriminant) - b) <= 1e-14*std::abs(b))
128 eta1 = (-
b - std::sqrt(discriminant)) / (2*a);
129 eta2 = (-
b + std::sqrt(discriminant)) / (2*a);
134 eta1 = 2*c / (-
b - std::sqrt(discriminant));
135 eta2 = 2*c / (-
b + std::sqrt(discriminant));
138 const double eta = (std::abs(eta1 - 0.5) < std::abs(eta2 - 0.5)) ? eta1 : eta2;
144 const double subexpr0 = -eta*x2 + x0*(eta - 1);
145 const double xi_denominator0 = eta*x3 - x1*(eta - 1) + subexpr0;
146 const double max_x = std::max(std::max(std::abs(x0), std::abs(x1)),
147 std::max(std::abs(x2), std::abs(x3)));
149 if (std::abs(xi_denominator0) > 1e-10*max_x)
151 const double xi = (x + subexpr0)/xi_denominator0;
156 const double max_y = std::max(std::max(std::abs(y0), std::abs(y1)),
157 std::max(std::abs(y2), std::abs(y3)));
158 const double subexpr1 = -eta*y2 + y0*(eta - 1);
159 const double xi_denominator1 = eta*y3 - y1*(eta - 1) + subexpr1;
160 if (std::abs(xi_denominator1) > 1
e-10*max_y)
162 const double xi = (subexpr1 + y)/xi_denominator1;
174 return Point<2>(std::numeric_limits<double>::quiet_NaN(),
175 std::numeric_limits<double>::quiet_NaN());
180 template<
int spacedim>
182 transform_real_to_unit_cell
221 struct TransformR2UInitialGuess
236 TransformR2UInitialGuess<1>::
245 TransformR2UInitialGuess<1>::
257 TransformR2UInitialGuess<2>::
260 {-0.500000, -0.500000},
261 { 0.500000, -0.500000},
262 {-0.500000, 0.500000},
263 { 0.500000, 0.500000}
274 TransformR2UInitialGuess<2>::
276 {0.750000,0.250000,0.250000,-0.250000 };
281 TransformR2UInitialGuess<3>::
284 {-0.250000, -0.250000, -0.250000},
285 { 0.250000, -0.250000, -0.250000},
286 {-0.250000, 0.250000, -0.250000},
287 { 0.250000, 0.250000, -0.250000},
288 {-0.250000, -0.250000, 0.250000},
289 { 0.250000, -0.250000, 0.250000},
290 {-0.250000, 0.250000, 0.250000},
291 { 0.250000, 0.250000, 0.250000}
298 TransformR2UInitialGuess<3>::
300 {0.500000,0.250000,0.250000,0.000000,0.250000,0.000000,0.000000,-0.250000};
302 template<
int dim,
int spacedim>
304 transform_real_to_unit_cell_initial_guess (
const std::vector<
Point<spacedim> > &vertex,
312 KA.fill( (
double *)(TransformR2UInitialGuess<dim>::KA) );
313 for (
unsigned int i=0; i<GeometryInfo<dim>::vertices_per_cell; ++i)
314 Kb(i) = TransformR2UInitialGuess<dim>::Kb[i];
317 for (
unsigned int v=0; v<GeometryInfo<dim>::vertices_per_cell; v++)
318 for (
unsigned int i=0; i<spacedim; ++i)
319 Y(i,v) = vertex[v][i];
326 for (
unsigned int i=0; i<spacedim; ++i)
340 for (
unsigned int i=0; i<dim; ++i)
347 template <
int dim,
int spacedim>
348 void compute_shape_function_values_general (
const unsigned int n_shape_functions,
350 typename ::MappingQGeneric<dim,spacedim>::InternalData &data)
352 const unsigned int n_points=unit_points.size();
358 Assert (n_shape_functions==tensor_pols.n(),
362 const std::vector<unsigned int>
364 lexicographic_to_hierarchic_numbering (
366 data.polynomial_degree)));
368 std::vector<double> values;
369 std::vector<Tensor<1,dim> > grads;
370 if (data.shape_values.size()!=0)
372 Assert(data.shape_values.size()==n_shape_functions*n_points,
374 values.resize(n_shape_functions);
376 if (data.shape_derivatives.size()!=0)
378 Assert(data.shape_derivatives.size()==n_shape_functions*n_points,
380 grads.resize(n_shape_functions);
383 std::vector<Tensor<2,dim> > grad2;
384 if (data.shape_second_derivatives.size()!=0)
386 Assert(data.shape_second_derivatives.size()==n_shape_functions*n_points,
388 grad2.resize(n_shape_functions);
391 std::vector<Tensor<3,dim> > grad3;
392 if (data.shape_third_derivatives.size()!=0)
394 Assert(data.shape_third_derivatives.size()==n_shape_functions*n_points,
396 grad3.resize(n_shape_functions);
399 std::vector<Tensor<4,dim> > grad4;
400 if (data.shape_fourth_derivatives.size()!=0)
402 Assert(data.shape_fourth_derivatives.size()==n_shape_functions*n_points,
404 grad4.resize(n_shape_functions);
408 if (data.shape_values.size()!=0 ||
409 data.shape_derivatives.size()!=0 ||
410 data.shape_second_derivatives.size()!=0 ||
411 data.shape_third_derivatives.size()!=0 ||
412 data.shape_fourth_derivatives.size()!=0 )
413 for (
unsigned int point=0;
point<n_points; ++
point)
415 tensor_pols.compute(unit_points[point], values, grads, grad2, grad3, grad4);
417 if (data.shape_values.size()!=0)
418 for (
unsigned int i=0; i<n_shape_functions; ++i)
419 data.shape(point,renumber[i]) = values[i];
421 if (data.shape_derivatives.size()!=0)
422 for (
unsigned int i=0; i<n_shape_functions; ++i)
423 data.derivative(point,renumber[i]) = grads[i];
425 if (data.shape_second_derivatives.size()!=0)
426 for (
unsigned int i=0; i<n_shape_functions; ++i)
427 data.second_derivative(point,renumber[i]) = grad2[i];
429 if (data.shape_third_derivatives.size()!=0)
430 for (
unsigned int i=0; i<n_shape_functions; ++i)
431 data.third_derivative(point,renumber[i]) = grad3[i];
433 if (data.shape_fourth_derivatives.size()!=0)
434 for (
unsigned int i=0; i<n_shape_functions; ++i)
435 data.fourth_derivative(point,renumber[i]) = grad4[i];
441 compute_shape_function_values_hardcode (
const unsigned int n_shape_functions,
442 const std::vector<
Point<1> > &unit_points,
445 (void)n_shape_functions;
446 const unsigned int n_points=unit_points.size();
447 for (
unsigned int k = 0 ; k < n_points ; ++k)
449 double x = unit_points[k](0);
455 data.
shape(k,0) = 1.-x;
495 compute_shape_function_values_hardcode (
const unsigned int n_shape_functions,
496 const std::vector<
Point<2> > &unit_points,
500 (void)n_shape_functions;
501 const unsigned int n_points=unit_points.size();
502 for (
unsigned int k = 0 ; k < n_points ; ++k)
504 double x = unit_points[k](0);
505 double y = unit_points[k](1);
511 data.
shape(k,0) = (1.-x)*(1.-y);
512 data.
shape(k,1) = x*(1.-y);
513 data.
shape(k,2) = (1.-x)*y;
514 data.
shape(k,3) = x*y;
556 for (
unsigned int i=0; i<4; ++i)
564 for (
unsigned int i=0; i<4; ++i)
573 compute_shape_function_values_hardcode (
const unsigned int n_shape_functions,
574 const std::vector<
Point<3> > &unit_points,
577 (void)n_shape_functions;
578 const unsigned int n_points=unit_points.size();
579 for (
unsigned int k = 0 ; k < n_points ; ++k)
581 double x = unit_points[k](0);
582 double y = unit_points[k](1);
583 double z = unit_points[k](2);
589 data.
shape(k,0) = (1.-x)*(1.-y)*(1.-z);
590 data.
shape(k,1) = x*(1.-y)*(1.-z);
591 data.
shape(k,2) = (1.-x)*y*(1.-z);
592 data.
shape(k,3) = x*y*(1.-z);
593 data.
shape(k,4) = (1.-x)*(1.-y)*z;
594 data.
shape(k,5) = x*(1.-y)*z;
595 data.
shape(k,6) = (1.-x)*y*z;
596 data.
shape(k,7) = x*y*z;
712 for (
unsigned int i=0; i<3; ++i)
713 for (
unsigned int j=0; j<3; ++j)
714 for (
unsigned int l=0;
l<3; ++
l)
715 if ((i==j)||(j==
l)||(l==i))
717 for (
unsigned int m=0; m<8; ++m)
738 for (
unsigned int i=0; i<8; ++i)
749 template<
int dim,
int spacedim>
752 polynomial_degree (polynomial_degree),
753 n_shape_functions (
Utilities::fixed_power<dim>(polynomial_degree+1)),
759 template<
int dim,
int spacedim>
778 template <
int dim,
int spacedim>
783 const unsigned int n_original_q_points)
787 this->update_each = update_flags;
789 const unsigned int n_q_points = q.
size();
794 shape_values.resize(n_shape_functions * n_q_points);
809 shape_derivatives.resize(n_shape_functions * n_q_points);
812 covariant.resize(n_original_q_points);
815 contravariant.resize(n_original_q_points);
818 volume_elements.resize(n_original_q_points);
820 if (this->update_each &
822 shape_second_derivatives.resize(n_shape_functions * n_q_points);
824 if (this->update_each &
826 shape_third_derivatives.resize(n_shape_functions * n_q_points);
828 if (this->update_each &
830 shape_fourth_derivatives.resize(n_shape_functions * n_q_points);
833 compute_shape_function_values (q.
get_points());
838 template <
int dim,
int spacedim>
843 const unsigned int n_original_q_points)
845 initialize (update_flags, q, n_original_q_points);
858 for (
unsigned int i=0; i<unit_tangentials.size(); ++i)
859 unit_tangentials[i].resize (n_original_q_points);
865 static const int tangential_orientation[4]= {-1,1,1,-1};
866 for (
unsigned int i=0; i<GeometryInfo<dim>::faces_per_cell; ++i)
869 tang[1-i/2] = tangential_orientation[i];
870 std::fill (unit_tangentials[i].begin(),
871 unit_tangentials[i].end(),
880 for (
unsigned int i=0; i<GeometryInfo<dim>::faces_per_cell; ++i)
884 const unsigned int nd=
896 tang2[(nd+2)%dim]=1.;
901 std::fill (unit_tangentials[i].begin(),
902 unit_tangentials[i].end(),
931 internal::MappingQ1::compute_shape_function_values_hardcode (n_shape_functions,
936 internal::MappingQ1::compute_shape_function_values_general<1,1>(n_shape_functions,
949 internal::MappingQ1::compute_shape_function_values_hardcode (n_shape_functions,
954 internal::MappingQ1::compute_shape_function_values_general<2,2>(n_shape_functions,
967 internal::MappingQ1::compute_shape_function_values_hardcode (n_shape_functions,
972 internal::MappingQ1::compute_shape_function_values_general<3,3>(n_shape_functions,
977 template<
int dim,
int spacedim>
984 internal::MappingQ1::compute_shape_function_values_general<dim,spacedim>(n_shape_functions,
1014 const unsigned int n_outer = (dim==1) ? 2 :
1022 const unsigned int n_q_points=quadrature.size();
1025 quadrature_data.shape_derivatives.resize(quadrature_data.n_shape_functions *
1027 quadrature_data.compute_shape_function_values(quadrature.get_points());
1031 for (
unsigned int point=0; point<n_q_points; ++point)
1032 for (
unsigned int i=0; i<n_inner; ++i)
1033 for (
unsigned int j=0; j<n_inner; ++j)
1035 long double res = 0.;
1036 for (
unsigned int l=0; l<dim; ++l)
1037 res += (
long double)quadrature_data.derivative(point, n_outer+i)[l] *
1038 (
long double)quadrature_data.derivative(point, n_outer+j)[l];
1040 S(i,j) += res * (
long double)quadrature.weight(point);
1046 for (
unsigned int point=0; point<n_q_points; ++point)
1047 for (
unsigned int i=0; i<n_inner; ++i)
1048 for (
unsigned int k=0; k<n_outer; ++k)
1050 long double res = 0.;
1051 for (
unsigned int l=0; l<dim; ++l)
1052 res += (
long double)quadrature_data.derivative(point, n_outer+i)[l] *
1053 (
long double)quadrature_data.derivative(point, k)[l];
1055 T(i,k) += res *(
long double)quadrature.weight(point);
1067 lvs.
reinit (n_inner, n_outer);
1068 for (
unsigned int i=0; i<n_inner; ++i)
1069 for (
unsigned int k=0; k<n_outer; ++k)
1070 lvs(i,k) = -S_1_T(i,k);
1107 static const double loqv2[1*8]
1108 = {1/16., 1/16., 1/16., 1/16., 3/16., 3/16., 3/16., 3/16.};
1109 Assert (
sizeof(loqv2)/
sizeof(loqv2[0]) ==
1110 n_inner_2d * n_outer_2d,
1114 loqvs.
reinit(n_inner_2d, n_outer_2d);
1115 for (
unsigned int unit_point=0; unit_point<n_inner_2d; ++unit_point)
1116 for (
unsigned int k=0; k<n_outer_2d; ++k)
1117 loqvs[unit_point][k] = loqv2[unit_point*n_outer_2d+k];
1127 for (
unsigned int unit_point=0; unit_point<loqvs.n_rows(); ++unit_point)
1128 Assert(std::fabs(std::accumulate(loqvs[unit_point].begin(),
1163 static const double lohv2[26]
1164 = {1/128., 1/128., 1/128., 1/128., 1/128., 1/128., 1/128., 1/128.,
1165 7/192., 7/192., 7/192., 7/192., 7/192., 7/192., 7/192., 7/192.,
1166 7/192., 7/192., 7/192., 7/192.,
1167 1/12., 1/12., 1/12., 1/12., 1/12., 1/12.
1171 lohvs.
reinit(n_inner, n_outer);
1172 for (
unsigned int unit_point=0; unit_point<n_inner; ++unit_point)
1173 for (
unsigned int k=0; k<n_outer; ++k)
1174 lohvs[unit_point][k] = lohv2[unit_point*n_outer+k];
1184 for (
unsigned int unit_point=0; unit_point<n_inner; ++unit_point)
1185 Assert(std::fabs(std::accumulate(lohvs[unit_point].begin(),
1196 std::vector<Table<2,double> >
1197 compute_support_point_weights_perimeter_to_interior(
const unsigned int polynomial_degree,
1198 const unsigned int dim)
1201 std::vector<Table<2,double> > output(dim);
1209 for (
unsigned int i=0; i<GeometryInfo<1>::vertices_per_cell; ++i)
1234 std::vector<unsigned int> h2l(quadrature.size());
1239 for (
unsigned int q=0; q<output.size(0); ++q)
1240 for (
unsigned int i=0; i<GeometryInfo<dim>::vertices_per_cell; ++i)
1251 template<
int dim,
int spacedim>
1260 Assert (p >= 1,
ExcMessage (
"It only makes sense to create polynomial mappings " 1261 "with a polynomial degree greater or equal to one."));
1266 template<
int dim,
int spacedim>
1269 polynomial_degree(mapping.polynomial_degree),
1270 line_support_points(mapping.line_support_points),
1271 fe_q(dim == 3 ? new
FE_Q<dim>(*mapping.fe_q) : 0),
1272 support_point_weights_perimeter_to_interior (mapping.support_point_weights_perimeter_to_interior),
1273 support_point_weights_cell (mapping.support_point_weights_cell)
1279 template<
int dim,
int spacedim>
1289 template<
int dim,
int spacedim>
1293 return polynomial_degree;
1298 template<
int dim,
int spacedim>
1307 Assert (tensor_pols.
n() == Utilities::fixed_power<dim>(polynomial_degree+1),
1311 const std::vector<unsigned int>
1313 lexicographic_to_hierarchic_numbering (
1315 polynomial_degree)));
1317 const std::vector<Point<spacedim> > support_points
1318 = this->compute_mapping_support_points(cell);
1321 for (
unsigned int i=0; i<tensor_pols.
n(); ++i)
1322 mapped_point += support_points[renumber[i]] * tensor_pols.
compute_value (i, p);
1324 return mapped_point;
1348 template<
int dim,
int spacedim>
1369 do_transform_real_to_unit_cell_internal
1375 const unsigned int spacedim = dim;
1400 Point<spacedim> p_real = compute_mapped_location_of_point<dim,spacedim>(mdata);
1404 if (f.norm_square() < 1
e-24 * cell->diameter() * cell->diameter())
1440 const double eps = 1.e-11;
1441 const unsigned int newton_iteration_limit = 20;
1443 unsigned int newton_iteration = 0;
1444 double last_f_weighted_norm;
1447 #ifdef DEBUG_TRANSFORM_REAL_TO_UNIT_CELL 1448 std::cout <<
"Newton iteration " << newton_iteration << std::endl;
1458 for (
unsigned int i=0; i<spacedim; ++i)
1459 for (
unsigned int j=0; j<dim; ++j)
1460 df[i][j]+=point[i]*grad_transform[j];
1467 #ifdef DEBUG_TRANSFORM_REAL_TO_UNIT_CELL 1468 std::cout <<
" delta=" << delta << std::endl;
1472 double step_length = 1;
1480 for (
unsigned int i=0; i<dim; ++i)
1481 p_unit_trial[i] -= step_length * delta[i];
1488 Point<spacedim> p_real_trial = compute_mapped_location_of_point<dim,spacedim>(mdata);
1491 #ifdef DEBUG_TRANSFORM_REAL_TO_UNIT_CELL 1492 std::cout <<
" step_length=" << step_length << std::endl
1493 <<
" ||f || =" << f.
norm() << std::endl
1494 <<
" ||f*|| =" << f_trial.norm() << std::endl
1495 <<
" ||f*||_A =" << (df_inverse * f_trial).
norm() << std::endl;
1505 if (f_trial.norm() < f.norm())
1507 p_real = p_real_trial;
1508 p_unit = p_unit_trial;
1512 else if (step_length > 0.05)
1521 if (newton_iteration > newton_iteration_limit)
1524 last_f_weighted_norm = (df_inverse * f).
norm();
1526 while (last_f_weighted_norm > eps);
1538 do_transform_real_to_unit_cell_internal_codim1
1544 const unsigned int spacedim = dim+1;
1573 for (
unsigned int j=0; j<dim; ++j)
1575 DF[j] += grad_phi_k[j] * point_k;
1576 for (
unsigned int l=0;
l<dim; ++
l)
1577 D2F[j][l] += hessian_k[j][l] * point_k;
1582 p_minus_F -= compute_mapped_location_of_point<dim,spacedim>(mdata);
1585 for (
unsigned int j=0; j<dim; ++j)
1586 f[j] = DF[j] * p_minus_F;
1588 for (
unsigned int j=0; j<dim; ++j)
1590 f[j] = DF[j] * p_minus_F;
1591 for (
unsigned int l=0;
l<dim; ++
l)
1592 df[j][l] = -DF[j]*DF[l] + D2F[j][l] * p_minus_F;
1596 const double eps = 1.e-12*cell->diameter();
1597 const unsigned int loop_limit = 10;
1599 unsigned int loop=0;
1607 for (
unsigned int j=0; j<dim; ++j)
1610 for (
unsigned int l=0;
l<dim; ++
l)
1622 for (
unsigned int j=0; j<dim; ++j)
1624 DF[j] += grad_phi_k[j] * point_k;
1625 for (
unsigned int l=0;
l<dim; ++
l)
1626 D2F[j][l] += hessian_k[j][l] * point_k;
1633 p_minus_F -= compute_mapped_location_of_point<dim,spacedim>(mdata);
1635 for (
unsigned int j=0; j<dim; ++j)
1637 f[j] = DF[j] * p_minus_F;
1638 for (
unsigned int l=0;
l<dim; ++
l)
1639 df[j][l] = -DF[j]*DF[l] + D2F[j][l] * p_minus_F;
1665 template<
int dim,
int spacedim>
1684 const Point<1> &initial_p_unit)
const 1687 const int spacedim = 1;
1694 std_cxx11::unique_ptr<InternalData> mdata (get_data(update_flags,
1701 return do_transform_real_to_unit_cell_internal<1>(cell, p, initial_p_unit, *mdata);
1710 const Point<2> &initial_p_unit)
const 1713 const int spacedim = 2;
1720 std_cxx11::unique_ptr<InternalData> mdata (get_data(update_flags,
1727 return do_transform_real_to_unit_cell_internal<2>(cell, p, initial_p_unit, *mdata);
1736 const Point<3> &initial_p_unit)
const 1739 const int spacedim = 3;
1746 std_cxx11::unique_ptr<InternalData> mdata (get_data(update_flags,
1753 return do_transform_real_to_unit_cell_internal<3>(cell, p, initial_p_unit, *mdata);
1762 const Point<1> &initial_p_unit)
const 1765 const int spacedim = 2;
1772 std_cxx11::unique_ptr<InternalData> mdata (get_data(update_flags,
1779 return do_transform_real_to_unit_cell_internal_codim1<1>(cell, p, initial_p_unit, *mdata);
1788 const Point<2> &initial_p_unit)
const 1791 const int spacedim = 3;
1798 std_cxx11::unique_ptr<InternalData> mdata (get_data(update_flags,
1805 return do_transform_real_to_unit_cell_internal_codim1<2>(cell, p, initial_p_unit, *mdata);
1822 template<
int dim,
int spacedim>
1830 if ((polynomial_degree == 1) &&
1833 ((dim == 2) && (dim == spacedim))))
1857 vertices = this->get_vertices(cell);
1866 return internal::MappingQ1::transform_real_to_unit_cell(vertices, p);
1869 const std::vector<Point<spacedim> > a (vertices.begin(),
1871 return internal::MappingQ1::transform_real_to_unit_cell_initial_guess<dim,spacedim>(a,p);
1878 = internal::MappingQ1::transform_real_to_unit_cell(vertices, p);
1883 const double eps = 1e-15;
1884 if (-eps <= point(1) && point(1) <= 1 + eps &&
1885 -eps <= point(0) && point(0) <= 1 + eps)
1912 if (polynomial_degree == 1)
1917 const std::vector<Point<spacedim> > a
1918 = this->compute_mapping_support_points (cell);
1921 initial_p_unit = internal::MappingQ1::transform_real_to_unit_cell_initial_guess<dim,spacedim>(a,p);
1934 std::vector<Point<spacedim> > a
1935 = this->compute_mapping_support_points (cell);
1937 initial_p_unit = internal::MappingQ1::transform_real_to_unit_cell_initial_guess<dim,spacedim>(a,p);
1941 for (
unsigned int d=0; d<dim; ++d)
1942 initial_p_unit[d] = 0.5;
1958 return this->transform_real_to_unit_cell_internal(cell, p, initial_p_unit);
1963 template<
int dim,
int spacedim>
1974 for (
unsigned int i=0; i<5; ++i)
2023 template<
int dim,
int spacedim>
2029 data->
initialize (this->requires_update_flags(update_flags), q, q.
size());
2036 template<
int dim,
int spacedim>
2051 template<
int dim,
int spacedim>
2076 template <
int dim,
int spacedim>
2079 const typename ::MappingQGeneric<dim,spacedim>::InternalData &data,
2082 const UpdateFlags update_flags = data.update_each;
2086 for (
unsigned int point=0; point<quadrature_points.size(); ++point)
2088 const double *shape = &data.shape(point+data_set,0);
2090 data.mapping_support_points[0]);
2091 for (
unsigned int k=1; k<data.n_shape_functions; ++k)
2092 for (
unsigned int i=0; i<spacedim; ++i)
2093 result[i] += shape[k] * data.mapping_support_points[k][i];
2094 quadrature_points[point] = result;
2107 template <
int dim,
int spacedim>
2110 const typename ::QProjector<dim>::DataSetDescriptor data_set,
2111 const typename ::MappingQGeneric<dim,spacedim>::InternalData &data)
2113 const UpdateFlags update_flags = data.update_each;
2121 const unsigned int n_q_points = data.contravariant.size();
2123 std::fill(data.contravariant.begin(), data.contravariant.end(),
2128 &data.mapping_support_points[0];
2130 for (
unsigned int point=0;
point<n_q_points; ++
point)
2133 &data.derivative(point+data_set, 0);
2135 double result [spacedim][dim];
2139 for (
unsigned int i=0; i<spacedim; ++i)
2140 for (
unsigned int j=0; j<dim; ++j)
2141 result[i][j] = data_derv[0][j] * supp_pts[0][i];
2142 for (
unsigned int k=1; k<data.n_shape_functions; ++k)
2143 for (
unsigned int i=0; i<spacedim; ++i)
2144 for (
unsigned int j=0; j<dim; ++j)
2145 result[i][j] += data_derv[k][j] * supp_pts[k][i];
2152 for (
unsigned int i=0; i<spacedim; ++i)
2153 for (
unsigned int j=0; j<dim; ++j)
2154 data.contravariant[point][i][j] = result[i][j];
2161 const unsigned int n_q_points = data.contravariant.size();
2162 for (
unsigned int point=0;
point<n_q_points; ++
point)
2164 data.covariant[
point] = (data.contravariant[
point]).covariant_form();
2171 const unsigned int n_q_points = data.contravariant.size();
2172 for (
unsigned int point=0;
point<n_q_points; ++
point)
2173 data.volume_elements[point] = data.contravariant[point].
determinant();
2184 template <
int dim,
int spacedim>
2188 const typename ::MappingQGeneric<dim,spacedim>::InternalData &data,
2191 const UpdateFlags update_flags = data.update_each;
2194 const unsigned int n_q_points = jacobian_grads.size();
2198 for (
unsigned int point=0;
point<n_q_points; ++
point)
2201 &data.second_derivative(point+data_set, 0);
2202 double result [spacedim][dim][dim];
2203 for (
unsigned int i=0; i<spacedim; ++i)
2204 for (
unsigned int j=0; j<dim; ++j)
2205 for (
unsigned int l=0;
l<dim; ++
l)
2206 result[i][j][l] = (second[0][j][l] *
2207 data.mapping_support_points[0][i]);
2208 for (
unsigned int k=1; k<data.n_shape_functions; ++k)
2209 for (
unsigned int i=0; i<spacedim; ++i)
2210 for (
unsigned int j=0; j<dim; ++j)
2211 for (
unsigned int l=0;
l<dim; ++
l)
2215 data.mapping_support_points[k][i]);
2217 for (
unsigned int i=0; i<spacedim; ++i)
2218 for (
unsigned int j=0; j<dim; ++j)
2219 for (
unsigned int l=0;
l<dim; ++
l)
2220 jacobian_grads[point][i][j][l] = result[i][j][l];
2232 template <
int dim,
int spacedim>
2236 const typename ::MappingQGeneric<dim,spacedim>::InternalData &data,
2239 const UpdateFlags update_flags = data.update_each;
2242 const unsigned int n_q_points = jacobian_pushed_forward_grads.size();
2246 double tmp[spacedim][spacedim][spacedim];
2247 for (
unsigned int point=0;
point<n_q_points; ++
point)
2250 &data.second_derivative(point+data_set, 0);
2251 double result [spacedim][dim][dim];
2252 for (
unsigned int i=0; i<spacedim; ++i)
2253 for (
unsigned int j=0; j<dim; ++j)
2254 for (
unsigned int l=0;
l<dim; ++
l)
2255 result[i][j][l] = (second[0][j][l] *
2256 data.mapping_support_points[0][i]);
2257 for (
unsigned int k=1; k<data.n_shape_functions; ++k)
2258 for (
unsigned int i=0; i<spacedim; ++i)
2259 for (
unsigned int j=0; j<dim; ++j)
2260 for (
unsigned int l=0;
l<dim; ++
l)
2264 data.mapping_support_points[k][i]);
2267 for (
unsigned int i=0; i<spacedim; ++i)
2268 for (
unsigned int j=0; j<spacedim; ++j)
2269 for (
unsigned int l=0;
l<dim; ++
l)
2271 tmp[i][j][
l] = result[i][0][
l] *
2272 data.covariant[
point][j][0];
2273 for (
unsigned int jr=1; jr<dim; ++jr)
2275 tmp[i][j][
l] += result[i][jr][
l] *
2276 data.covariant[
point][j][jr];
2281 for (
unsigned int i=0; i<spacedim; ++i)
2282 for (
unsigned int j=0; j<spacedim; ++j)
2283 for (
unsigned int l=0;
l<spacedim; ++
l)
2285 jacobian_pushed_forward_grads[
point][i][j][
l] = tmp[i][j][0] *
2286 data.covariant[
point][
l][0];
2287 for (
unsigned int lr=1; lr<dim; ++lr)
2289 jacobian_pushed_forward_grads[
point][i][j][
l] += tmp[i][j][lr] *
2290 data.covariant[
point][
l][lr];
2305 template <
int dim,
int spacedim>
2309 const typename ::MappingQGeneric<dim,spacedim>::InternalData &data,
2312 const UpdateFlags update_flags = data.update_each;
2315 const unsigned int n_q_points = jacobian_2nd_derivatives.size();
2319 for (
unsigned int point=0;
point<n_q_points; ++
point)
2322 &data.third_derivative(point+data_set, 0);
2323 double result [spacedim][dim][dim][dim];
2324 for (
unsigned int i=0; i<spacedim; ++i)
2325 for (
unsigned int j=0; j<dim; ++j)
2326 for (
unsigned int l=0;
l<dim; ++
l)
2327 for (
unsigned int m=0; m<dim; ++m)
2328 result[i][j][l][m] = (third[0][j][l][m] *
2329 data.mapping_support_points[0][i]);
2330 for (
unsigned int k=1; k<data.n_shape_functions; ++k)
2331 for (
unsigned int i=0; i<spacedim; ++i)
2332 for (
unsigned int j=0; j<dim; ++j)
2333 for (
unsigned int l=0;
l<dim; ++
l)
2334 for (
unsigned int m=0; m<dim; ++m)
2336 += (third[k][j][l][m]
2338 data.mapping_support_points[k][i]);
2340 for (
unsigned int i=0; i<spacedim; ++i)
2341 for (
unsigned int j=0; j<dim; ++j)
2342 for (
unsigned int l=0;
l<dim; ++
l)
2343 for (
unsigned int m=0; m<dim; ++m)
2344 jacobian_2nd_derivatives[point][i][j][l][m] = result[i][j][l][m];
2357 template <
int dim,
int spacedim>
2361 const typename ::MappingQGeneric<dim,spacedim>::InternalData &data,
2364 const UpdateFlags update_flags = data.update_each;
2367 const unsigned int n_q_points = jacobian_pushed_forward_2nd_derivatives.size();
2371 double tmp[spacedim][spacedim][spacedim][spacedim];
2372 for (
unsigned int point=0;
point<n_q_points; ++
point)
2375 &data.third_derivative(point+data_set, 0);
2376 double result [spacedim][dim][dim][dim];
2377 for (
unsigned int i=0; i<spacedim; ++i)
2378 for (
unsigned int j=0; j<dim; ++j)
2379 for (
unsigned int l=0;
l<dim; ++
l)
2380 for (
unsigned int m=0; m<dim; ++m)
2381 result[i][j][l][m] = (third[0][j][l][m] *
2382 data.mapping_support_points[0][i]);
2383 for (
unsigned int k=1; k<data.n_shape_functions; ++k)
2384 for (
unsigned int i=0; i<spacedim; ++i)
2385 for (
unsigned int j=0; j<dim; ++j)
2386 for (
unsigned int l=0;
l<dim; ++
l)
2387 for (
unsigned int m=0; m<dim; ++m)
2389 += (third[k][j][l][m]
2391 data.mapping_support_points[k][i]);
2394 for (
unsigned int i=0; i<spacedim; ++i)
2395 for (
unsigned int j=0; j<spacedim; ++j)
2396 for (
unsigned int l=0;
l<dim; ++
l)
2397 for (
unsigned int m=0; m<dim; ++m)
2399 jacobian_pushed_forward_2nd_derivatives[
point][i][j][
l][m]
2400 = result[i][0][
l][m]*
2401 data.covariant[
point][j][0];
2402 for (
unsigned int jr=1; jr<dim; ++jr)
2403 jacobian_pushed_forward_2nd_derivatives[point][i][j][l][m]
2404 += result[i][jr][l][m]*
2405 data.covariant[point][j][jr];
2409 for (
unsigned int i=0; i<spacedim; ++i)
2410 for (
unsigned int j=0; j<spacedim; ++j)
2411 for (
unsigned int l=0;
l<spacedim; ++
l)
2412 for (
unsigned int m=0; m<dim; ++m)
2415 = jacobian_pushed_forward_2nd_derivatives[
point][i][j][0][m]*
2416 data.covariant[
point][
l][0];
2417 for (
unsigned int lr=1; lr<dim; ++lr)
2419 += jacobian_pushed_forward_2nd_derivatives[point][i][j][lr][m]*
2420 data.covariant[point][l][lr];
2424 for (
unsigned int i=0; i<spacedim; ++i)
2425 for (
unsigned int j=0; j<spacedim; ++j)
2426 for (
unsigned int l=0;
l<spacedim; ++
l)
2427 for (
unsigned int m=0; m<spacedim; ++m)
2429 jacobian_pushed_forward_2nd_derivatives[
point][i][j][
l][m]
2431 data.covariant[
point][m][0];
2432 for (
unsigned int mr=1; mr<dim; ++mr)
2433 jacobian_pushed_forward_2nd_derivatives[point][i][j][l][m]
2434 += tmp[i][j][l][mr]*
2435 data.covariant[point][m][mr];
2448 template <
int dim,
int spacedim>
2452 const typename ::MappingQGeneric<dim,spacedim>::InternalData &data,
2455 const UpdateFlags update_flags = data.update_each;
2458 const unsigned int n_q_points = jacobian_3rd_derivatives.size();
2462 for (
unsigned int point=0;
point<n_q_points; ++
point)
2465 &data.fourth_derivative(point+data_set, 0);
2466 double result [spacedim][dim][dim][dim][dim];
2467 for (
unsigned int i=0; i<spacedim; ++i)
2468 for (
unsigned int j=0; j<dim; ++j)
2469 for (
unsigned int l=0;
l<dim; ++
l)
2470 for (
unsigned int m=0; m<dim; ++m)
2471 for (
unsigned int n=0; n<dim; ++n)
2472 result[i][j][l][m][n] = (fourth[0][j][l][m][n] *
2473 data.mapping_support_points[0][i]);
2474 for (
unsigned int k=1; k<data.n_shape_functions; ++k)
2475 for (
unsigned int i=0; i<spacedim; ++i)
2476 for (
unsigned int j=0; j<dim; ++j)
2477 for (
unsigned int l=0;
l<dim; ++
l)
2478 for (
unsigned int m=0; m<dim; ++m)
2479 for (
unsigned int n=0; n<dim; ++n)
2480 result[i][j][l][m][n]
2481 += (fourth[k][j][l][m][n]
2483 data.mapping_support_points[k][i]);
2485 for (
unsigned int i=0; i<spacedim; ++i)
2486 for (
unsigned int j=0; j<dim; ++j)
2487 for (
unsigned int l=0;
l<dim; ++
l)
2488 for (
unsigned int m=0; m<dim; ++m)
2489 for (
unsigned int n=0; n<dim; ++n)
2490 jacobian_3rd_derivatives[point][i][j][l][m][n] = result[i][j][l][m][n];
2502 template <
int dim,
int spacedim>
2506 const typename ::MappingQGeneric<dim,spacedim>::InternalData &data,
2509 const UpdateFlags update_flags = data.update_each;
2512 const unsigned int n_q_points = jacobian_pushed_forward_3rd_derivatives.size();
2516 double tmp[spacedim][spacedim][spacedim][spacedim][spacedim];
2517 for (
unsigned int point=0;
point<n_q_points; ++
point)
2520 &data.fourth_derivative(point+data_set, 0);
2521 double result [spacedim][dim][dim][dim][dim];
2522 for (
unsigned int i=0; i<spacedim; ++i)
2523 for (
unsigned int j=0; j<dim; ++j)
2524 for (
unsigned int l=0;
l<dim; ++
l)
2525 for (
unsigned int m=0; m<dim; ++m)
2526 for (
unsigned int n=0; n<dim; ++n)
2527 result[i][j][l][m][n] = (fourth[0][j][l][m][n] *
2528 data.mapping_support_points[0][i]);
2529 for (
unsigned int k=1; k<data.n_shape_functions; ++k)
2530 for (
unsigned int i=0; i<spacedim; ++i)
2531 for (
unsigned int j=0; j<dim; ++j)
2532 for (
unsigned int l=0;
l<dim; ++
l)
2533 for (
unsigned int m=0; m<dim; ++m)
2534 for (
unsigned int n=0; n<dim; ++n)
2535 result[i][j][l][m][n]
2536 += (fourth[k][j][l][m][n]
2538 data.mapping_support_points[k][i]);
2541 for (
unsigned int i=0; i<spacedim; ++i)
2542 for (
unsigned int j=0; j<spacedim; ++j)
2543 for (
unsigned int l=0;
l<dim; ++
l)
2544 for (
unsigned int m=0; m<dim; ++m)
2545 for (
unsigned int n=0; n<dim; ++n)
2547 tmp[i][j][
l][m][n] = result[i][0][
l][m][n] *
2548 data.covariant[
point][j][0];
2549 for (
unsigned int jr=1; jr<dim; ++jr)
2550 tmp[i][j][l][m][n] += result[i][jr][l][m][n] *
2551 data.covariant[point][j][jr];
2555 for (
unsigned int i=0; i<spacedim; ++i)
2556 for (
unsigned int j=0; j<spacedim; ++j)
2557 for (
unsigned int l=0;
l<spacedim; ++
l)
2558 for (
unsigned int m=0; m<dim; ++m)
2559 for (
unsigned int n=0; n<dim; ++n)
2561 jacobian_pushed_forward_3rd_derivatives[
point][i][j][
l][m][n]
2562 = tmp[i][j][0][m][n] *
2563 data.covariant[
point][
l][0];
2564 for (
unsigned int lr=1; lr<dim; ++lr)
2565 jacobian_pushed_forward_3rd_derivatives[point][i][j][l][m][n]
2566 += tmp[i][j][lr][m][n] *
2567 data.covariant[point][l][lr];
2571 for (
unsigned int i=0; i<spacedim; ++i)
2572 for (
unsigned int j=0; j<spacedim; ++j)
2573 for (
unsigned int l=0;
l<spacedim; ++
l)
2574 for (
unsigned int m=0; m<spacedim; ++m)
2575 for (
unsigned int n=0; n<dim; ++n)
2578 = jacobian_pushed_forward_3rd_derivatives[
point][i][j][
l][0][n] *
2579 data.covariant[
point][m][0];
2580 for (
unsigned int mr=1; mr<dim; ++mr)
2582 += jacobian_pushed_forward_3rd_derivatives[point][i][j][l][mr][n] *
2583 data.covariant[point][m][mr];
2587 for (
unsigned int i=0; i<spacedim; ++i)
2588 for (
unsigned int j=0; j<spacedim; ++j)
2589 for (
unsigned int l=0;
l<spacedim; ++
l)
2590 for (
unsigned int m=0; m<spacedim; ++m)
2591 for (
unsigned int n=0; n<spacedim; ++n)
2593 jacobian_pushed_forward_3rd_derivatives[
point][i][j][
l][m][n]
2594 = tmp[i][j][
l][m][0] *
2595 data.covariant[
point][n][0];
2596 for (
unsigned int nr=1; nr<dim; ++nr)
2597 jacobian_pushed_forward_3rd_derivatives[point][i][j][l][m][n]
2598 += tmp[i][j][l][m][nr] *
2599 data.covariant[point][n][nr];
2611 template<
int dim,
int spacedim>
2621 Assert (dynamic_cast<const InternalData *>(&internal_data) != 0,
2625 const unsigned int n_q_points=quadrature.
size();
2650 internal::maybe_update_Jacobians<dim,spacedim> (computed_cell_similarity,
2654 const UpdateFlags update_flags = data.update_each;
2655 const std::vector<double> &weights=quadrature.
get_weights();
2671 for (
unsigned int point=0; point<n_q_points; ++point)
2674 if (dim == spacedim)
2676 const double det = data.contravariant[point].determinant();
2683 Assert (det > 1e-12*Utilities::fixed_power<dim>(cell->diameter()/
2684 std::sqrt(
double(dim))),
2687 output_data.
JxW_values[point] = weights[point] * det;
2695 for (
unsigned int i=0; i<spacedim; ++i)
2696 for (
unsigned int j=0; j<dim; ++j)
2697 DX_t[j][i] = data.contravariant[point][i][j];
2700 for (
unsigned int i=0; i<dim; ++i)
2701 for (
unsigned int j=0; j<dim; ++j)
2702 G[i][j] = DX_t[i] * DX_t[j];
2717 Assert(spacedim == dim+1,
2718 ExcMessage(
"There is no (unique) cell normal for " 2720 "-dimensional cells in " 2722 "-dimensional space. This only works if the " 2723 "space dimension is one greater than the " 2724 "dimensionality of the mesh cells."));
2735 if (cell->direction_flag() ==
false)
2752 for (
unsigned int point=0; point<n_q_points; ++point)
2753 output_data.
jacobians[point] = data.contravariant[point];
2761 for (
unsigned int point=0; point<n_q_points; ++point)
2765 internal::maybe_update_jacobian_grads<dim,spacedim> (computed_cell_similarity,
2770 internal::maybe_update_jacobian_pushed_forward_grads<dim,spacedim> (computed_cell_similarity,
2775 internal::maybe_update_jacobian_2nd_derivatives<dim,spacedim> (computed_cell_similarity,
2780 internal::maybe_update_jacobian_pushed_forward_2nd_derivatives<dim,spacedim> (computed_cell_similarity,
2785 internal::maybe_update_jacobian_3rd_derivatives<dim,spacedim> (computed_cell_similarity,
2790 internal::maybe_update_jacobian_pushed_forward_3rd_derivatives<dim,spacedim> (computed_cell_similarity,
2795 return computed_cell_similarity;
2816 template <
int dim,
int spacedim>
2819 const typename ::Triangulation<dim,spacedim>::cell_iterator &cell,
2820 const unsigned int face_no,
2821 const unsigned int subface_no,
2822 const unsigned int n_q_points,
2823 const std::vector<double> &weights,
2824 const typename ::MappingQGeneric<dim,spacedim>::InternalData &data,
2827 const UpdateFlags update_flags = data.update_each;
2850 for (
unsigned int d=0; d!=dim-1; ++d)
2853 data.unit_tangentials.size(),
2855 Assert (data.aux[d].size() <=
2862 make_array_view(data.aux[d]));
2869 if (dim == spacedim)
2871 for (
unsigned int i=0; i<n_q_points; ++i)
2884 cross_product_2d(data.aux[0][i]);
2888 cross_product_3d(data.aux[0][i], data.aux[1][i]);
2904 for (
unsigned int point=0;
point<n_q_points; ++
point)
2920 cross_product_3d(DX_t[0], DX_t[1]);
2921 cell_normal /= cell_normal.
norm();
2926 cross_product_3d(data.aux[0][point], cell_normal);
2951 for (
unsigned int point=0;
point<n_q_points; ++
point)
2952 output_data.
jacobians[point] = data.contravariant[point];
2955 for (
unsigned int point=0;
point<n_q_points; ++
point)
2967 template<
int dim,
int spacedim>
2970 const typename ::Triangulation<dim,spacedim>::cell_iterator &cell,
2971 const unsigned int face_no,
2972 const unsigned int subface_no,
2975 const typename ::MappingQGeneric<dim,spacedim>::InternalData &data,
2978 maybe_compute_q_points<dim,spacedim> (data_set,
3010 cell, face_no, subface_no, quadrature.
size(),
3019 template<
int dim,
int spacedim>
3023 const unsigned int face_no,
3029 Assert ((dynamic_cast<const InternalData *>(&internal_data) != 0),
3040 (&cell->get_triangulation() !=
3052 cell->face_orientation(face_no),
3053 cell->face_flip(face_no),
3054 cell->face_rotation(face_no),
3063 template<
int dim,
int spacedim>
3067 const unsigned int face_no,
3068 const unsigned int subface_no,
3074 Assert ((dynamic_cast<const InternalData *>(&internal_data) != 0),
3085 (&cell->get_triangulation() !=
3095 cell, face_no, subface_no,
3097 cell->face_orientation(face_no),
3098 cell->face_flip(face_no),
3099 cell->face_rotation(face_no),
3101 cell->subface_case(face_no)),
3111 template <
int dim,
int spacedim,
int rank>
3124 switch (mapping_type)
3131 for (
unsigned int i=0; i<output.size(); ++i)
3147 for (
unsigned int i=0; i<output.size(); ++i)
3162 for (
unsigned int i=0; i<output.size(); ++i)
3174 template <
int dim,
int spacedim,
int rank>
3187 switch (mapping_type)
3197 for (
unsigned int i=0; i<output.size(); ++i)
3213 for (
unsigned int i=0; i<output.size(); ++i)
3233 for (
unsigned int i=0; i<output.size(); ++i)
3255 template <
int dim,
int spacedim>
3268 switch (mapping_type)
3277 for (
unsigned int q=0; q<output.size(); ++q)
3278 for (
unsigned int i=0; i<spacedim; ++i)
3280 double tmp1[dim][dim];
3281 for (
unsigned int J=0; J<dim; ++J)
3282 for (
unsigned int K=0; K<dim; ++K)
3284 tmp1[J][K] = data.
contravariant[q][i][0] * input[q][0][J][K];
3285 for (
unsigned int I=1; I<dim; ++I)
3286 tmp1[J][K] += data.
contravariant[q][i][I] * input[q][I][J][K];
3288 for (
unsigned int j=0; j<spacedim; ++j)
3291 for (
unsigned int K=0; K<dim; ++K)
3293 tmp2[K] = data.
covariant[q][j][0] * tmp1[0][K];
3294 for (
unsigned int J=1; J<dim; ++J)
3295 tmp2[K] += data.
covariant[q][j][J] * tmp1[J][K];
3297 for (
unsigned int k=0; k<spacedim; ++k)
3299 output[q][i][j][k] = data.
covariant[q][k][0] * tmp2[0];
3300 for (
unsigned int K=1; K<dim; ++K)
3301 output[q][i][j][k] += data.
covariant[q][k][K] * tmp2[K];
3313 for (
unsigned int q=0; q<output.size(); ++q)
3314 for (
unsigned int i=0; i<spacedim; ++i)
3316 double tmp1[dim][dim];
3317 for (
unsigned int J=0; J<dim; ++J)
3318 for (
unsigned int K=0; K<dim; ++K)
3320 tmp1[J][K] = data.
covariant[q][i][0] * input[q][0][J][K];
3321 for (
unsigned int I=1; I<dim; ++I)
3322 tmp1[J][K] += data.
covariant[q][i][I] * input[q][I][J][K];
3324 for (
unsigned int j=0; j<spacedim; ++j)
3327 for (
unsigned int K=0; K<dim; ++K)
3329 tmp2[K] = data.
covariant[q][j][0] * tmp1[0][K];
3330 for (
unsigned int J=1; J<dim; ++J)
3331 tmp2[K] += data.
covariant[q][j][J] * tmp1[J][K];
3333 for (
unsigned int k=0; k<spacedim; ++k)
3335 output[q][i][j][k] = data.
covariant[q][k][0] * tmp2[0];
3336 for (
unsigned int K=1; K<dim; ++K)
3337 output[q][i][j][k] += data.
covariant[q][k][K] * tmp2[K];
3354 for (
unsigned int q=0; q<output.size(); ++q)
3355 for (
unsigned int i=0; i<spacedim; ++i)
3358 for (
unsigned int I=0; I<dim; ++I)
3360 double tmp1[dim][dim];
3361 for (
unsigned int J=0; J<dim; ++J)
3362 for (
unsigned int K=0; K<dim; ++K)
3364 tmp1[J][K] = factor[0] * input[q][0][J][K];
3365 for (
unsigned int I=1; I<dim; ++I)
3366 tmp1[J][K] += factor[I] * input[q][I][J][K];
3368 for (
unsigned int j=0; j<spacedim; ++j)
3371 for (
unsigned int K=0; K<dim; ++K)
3373 tmp2[K] = data.
covariant[q][j][0] * tmp1[0][K];
3374 for (
unsigned int J=1; J<dim; ++J)
3375 tmp2[K] += data.
covariant[q][j][J] * tmp1[J][K];
3377 for (
unsigned int k=0; k<spacedim; ++k)
3379 output[q][i][j][k] = data.
covariant[q][k][0] * tmp2[0];
3380 for (
unsigned int K=1; K<dim; ++K)
3381 output[q][i][j][k] += data.
covariant[q][k][K] * tmp2[K];
3397 template<
int dim,
int spacedim,
int rank>
3410 switch (mapping_type)
3417 for (
unsigned int i=0; i<output.size(); ++i)
3430 template<
int dim,
int spacedim>
3438 transform_fields(input, mapping_type, mapping_data, output);
3443 template<
int dim,
int spacedim>
3451 transform_differential_forms(input, mapping_type, mapping_data, output);
3456 template<
int dim,
int spacedim>
3464 switch (mapping_type)
3467 transform_fields(input, mapping_type, mapping_data, output);
3473 transform_gradients(input, mapping_type, mapping_data, output);
3482 template<
int dim,
int spacedim>
3492 Assert (dynamic_cast<const InternalData *>(&mapping_data) != 0,
3496 switch (mapping_type)
3503 for (
unsigned int q=0; q<output.size(); ++q)
3504 for (
unsigned int i=0; i<spacedim; ++i)
3505 for (
unsigned int j=0; j<spacedim; ++j)
3508 for (
unsigned int K=0; K<dim; ++K)
3510 tmp[K] = data.
covariant[q][j][0] * input[q][i][0][K];
3511 for (
unsigned int J=1; J<dim; ++J)
3512 tmp[K] += data.
covariant[q][j][J] * input[q][i][J][K];
3514 for (
unsigned int k=0; k<spacedim; ++k)
3516 output[q][i][j][k] = data.
covariant[q][k][0] * tmp[0];
3517 for (
unsigned int K=1; K<dim; ++K)
3518 output[q][i][j][k] += data.
covariant[q][k][K] * tmp[K];
3531 template<
int dim,
int spacedim>
3539 switch (mapping_type)
3544 transform_hessians(input, mapping_type, mapping_data, output);
3557 template <
typename Iterator>
3558 bool check_identical_manifolds_of_quads(
const Iterator &)
3566 for (
unsigned int f=0; f<GeometryInfo<3>::faces_per_cell; ++f)
3567 if (&cell->face(f)->get_manifold() != &cell->get_manifold())
3575 template <
int dim,
int spacedim>
3582 if (this->polynomial_degree==2)
3584 for (
unsigned int line_no=0; line_no<GeometryInfo<dim>::lines_per_cell; ++line_no)
3586 const typename Triangulation<dim,spacedim>::line_iterator line =
3588 static_cast<typename Triangulation<dim,spacedim>::line_iterator
>(cell) :
3589 cell->line(line_no));
3595 cell->get_manifold()
3605 std::vector<Point<spacedim> > tmp_points;
3608 for (
unsigned int line_no=0; line_no<GeometryInfo<dim>::lines_per_cell; ++line_no)
3610 const typename Triangulation<dim,spacedim>::line_iterator
3613 static_cast<typename Triangulation<dim,spacedim>::line_iterator
>(cell)
3615 cell->line(line_no));
3621 cell->get_manifold() :
3627 tmp_points.resize(this->polynomial_degree-1);
3628 boundary->get_intermediate_points_on_line(line, tmp_points);
3629 if (dim != 3 || cell->line_orientation(line_no))
3630 a.insert (a.end(), tmp_points.begin(), tmp_points.end());
3632 a.insert (a.end(), tmp_points.rbegin(), tmp_points.rend());
3636 tmp_points.resize(2);
3640 support_point_weights_perimeter_to_interior[0], a);
3657 std::vector<Point<3> > tmp_points;
3660 for (
unsigned int face_no=0; face_no<faces_per_cell; ++face_no)
3665 const bool face_orientation = cell->face_orientation(face_no),
3666 face_flip = cell->face_flip (face_no),
3667 face_rotation = cell->face_rotation (face_no);
3674 for (
unsigned int i=0; i<vertices_per_face; ++i)
3675 Assert(face->vertex_index(i)==cell->vertex_index(
3684 for (
unsigned int i=0; i<lines_per_face; ++i)
3686 face_no, i, face_orientation, face_flip, face_rotation)),
3698 if (boundary != NULL &&
3699 std::string(
typeid(*boundary).name()).find(
"StraightBoundary") ==
3703 tmp_points.resize((polynomial_degree-1)*(polynomial_degree-1));
3705 for (
unsigned int i=0; i<tmp_points.size(); ++i)
3706 a.push_back(tmp_points[fe_q->adjust_quad_dof_index_for_face_orientation(i,
3716 tmp_points.resize(4 + 4*(polynomial_degree-1));
3717 for (
unsigned int v=0; v<GeometryInfo<2>::vertices_per_cell; ++v)
3719 if (polynomial_degree > 1)
3720 for (
unsigned int line=0; line<GeometryInfo<2>::lines_per_cell; ++line)
3721 for (
unsigned int i=0; i<polynomial_degree-1; ++i)
3722 tmp_points[4+line*(polynomial_degree-1)+i] =
3724 (polynomial_degree-1)*
3726 face->get_manifold().add_new_points (tmp_points,
3727 support_point_weights_perimeter_to_interior[1],
3744 std::vector<Point<3> > points((polynomial_degree-1)*(polynomial_degree-1));
3746 a.insert(a.end(), points.begin(), points.end());
3750 std::vector<Point<3> > vertices;
3751 for (
unsigned int i=0; i<GeometryInfo<2>::vertices_per_cell; ++i)
3752 vertices.push_back(cell->vertex(i));
3753 Table<2,double> weights(Utilities::fixed_power<2>(polynomial_degree-1),
3755 for (
unsigned int q=0, q2=0; q2<polynomial_degree-1; ++q2)
3756 for (
unsigned int q1=0; q1<polynomial_degree-1; ++q1, ++q)
3759 line_support_points.point(q2+1)[0]);
3760 for (
unsigned int i=0; i<GeometryInfo<2>::vertices_per_cell; ++i)
3764 cell->get_manifold().add_new_points(vertices, weights, a);
3770 template <
int dim,
int spacedim>
3781 template<
int dim,
int spacedim>
3782 std::vector<Point<spacedim> >
3787 std::vector<Point<spacedim> > a;
3788 a.reserve(Utilities::fixed_power<dim>(polynomial_degree+1));
3789 for (
unsigned int i=0; i<GeometryInfo<dim>::vertices_per_cell; ++i)
3790 a.push_back(cell->vertex(i));
3792 if (this->polynomial_degree > 1)
3797 bool all_manifold_ids_are_equal = (dim == spacedim);
3799 for (
unsigned int l=0; l<GeometryInfo<dim>::lines_per_cell; ++l)
3800 if (&cell->line(l)->get_manifold() != &cell->get_manifold())
3801 all_manifold_ids_are_equal =
false;
3803 if (check_identical_manifolds_of_quads(cell) ==
false)
3804 all_manifold_ids_are_equal =
false;
3805 if (all_manifold_ids_are_equal)
3807 std::vector<Point<spacedim> > vertices(a);
3808 cell->get_manifold().add_new_points(vertices, support_point_weights_cell, a);
3814 add_line_support_points(cell, a);
3819 add_line_support_points(cell, a);
3822 if (dim != spacedim)
3823 add_quad_support_points(cell, a);
3826 std::vector<Point<spacedim> > tmp_points(a);
3827 cell->get_manifold().add_new_points(tmp_points,
3828 support_point_weights_perimeter_to_interior[1],
3835 add_line_support_points (cell, a);
3836 add_quad_support_points (cell, a);
3840 std::vector<Point<spacedim> > tmp_points(a);
3841 cell->get_manifold().add_new_points(tmp_points,
3842 support_point_weights_perimeter_to_interior[2],
3859 #include "mapping_q_generic.inst" 3862 DEAL_II_NAMESPACE_CLOSE
Transformed quadrature weights.
std::vector< DerivativeForm< 1, dim, spacedim > > covariant
static const unsigned int invalid_unsigned_int
const std_cxx11::unique_ptr< FE_Q< dim > > fe_q
#define AssertDimension(dim1, dim2)
std::vector< Tensor< 2, dim > > shape_second_derivatives
const unsigned int polynomial_degree
virtual CellSimilarity::Similarity fill_fe_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const CellSimilarity::Similarity cell_similarity, const Quadrature< dim > &quadrature, const typename Mapping< dim, spacedim >::InternalDataBase &internal_data, ::internal::FEValues::MappingRelatedData< dim, spacedim > &output_data) const
Contravariant transformation.
const std::vector< Point< dim > > & get_points() const
virtual void fill_fe_face_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const Quadrature< dim-1 > &quadrature, const typename Mapping< dim, spacedim >::InternalDataBase &internal_data, ::internal::FEValues::MappingRelatedData< dim, spacedim > &output_data) const
const std::vector< double > & get_weights() const
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
virtual InternalData * get_subface_data(const UpdateFlags flags, const Quadrature< dim-1 > &quadrature) const
virtual InternalData * get_data(const UpdateFlags, const Quadrature< dim > &quadrature) const
std::vector< Table< 2, double > > support_point_weights_perimeter_to_interior
std::vector< Tensor< 4, dim > > shape_fourth_derivatives
virtual Mapping< dim, spacedim > * clone() const
virtual Point< dim > transform_real_to_unit_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< spacedim > &p) const
Outer normal vector, not normalized.
std::vector< Polynomial< double > > generate_complete_Lagrange_basis(const std::vector< Point< 1 > > &points)
Table< 2, double > support_point_weights_cell
virtual UpdateFlags requires_update_flags(const UpdateFlags update_flags) const
Determinant of the Jacobian.
Triangulation< dim, spacedim >::cell_iterator cell_of_current_support_points
Transformed quadrature points.
const Tensor< 3, dim > & third_derivative(const unsigned int qpoint, const unsigned int shape_nr) const
MappingQGeneric(const unsigned int polynomial_degree)
#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 DataSetDescriptor cell()
const Tensor< 4, dim > & fourth_derivative(const unsigned int qpoint, const unsigned int shape_nr) const
InternalData(const unsigned int polynomial_degree)
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)
std::vector< Tensor< 1, dim > > shape_derivatives
virtual void add_quad_support_points(const typename Triangulation< dim, spacedim >::cell_iterator &cell, std::vector< Point< spacedim > > &a) const
void compute_shape_function_values(const std::vector< Point< dim > > &unit_points)
virtual void get_intermediate_points_on_quad(const typename Triangulation< dim, spacedim >::quad_iterator &quad, std::vector< Point< spacedim > > &points) const
static ::ExceptionBase & ExcMessage(std::string arg1)
virtual Point< spacedim > get_new_point_on_line(const typename Triangulation< dim, spacedim >::line_iterator &line) const
static ::ExceptionBase & ExcImpossibleInDim(int arg1)
void reinit(const TableIndices< N > &new_size, const bool omit_default_initialization=false)
Tensor< 1, dim, Number > cross_product_2d(const Tensor< 1, dim, Number > &src)
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
Abstract base class for mapping classes.
virtual void transform(const ArrayView< const Tensor< 1, dim > > &input, const MappingType type, const typename Mapping< dim, spacedim >::InternalDataBase &internal, const ArrayView< Tensor< 1, spacedim > > &output) const
void loop(ITERATOR begin, typename identity< ITERATOR >::type end, DOFINFO &dinfo, INFOBOX &info, const std_cxx11::function< void(DOFINFO &, typename INFOBOX::CellInfo &)> &cell_worker, const std_cxx11::function< void(DOFINFO &, typename INFOBOX::CellInfo &)> &boundary_worker, const std_cxx11::function< void(DOFINFO &, DOFINFO &, typename INFOBOX::CellInfo &, typename INFOBOX::CellInfo &)> &face_worker, ASSEMBLER &assembler, const LoopControl &lctrl=LoopControl())
std::vector< Point< spacedim > > mapping_support_points
std::vector< DerivativeForm< 1, dim, spacedim > > contravariant
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)
void initialize(const UpdateFlags update_flags, const Quadrature< dim > &quadrature, const unsigned int n_original_q_points)
std::vector< double > volume_elements
Gradient of volume element.
std::string int_to_string(const unsigned int value, const unsigned int digits=numbers::invalid_unsigned_int)
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
const unsigned int n_shape_functions
unsigned int size() const
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
Tensor< 1, dim, Number > cross_product_3d(const Tensor< 1, dim, Number > &src1, const Tensor< 1, dim, Number > &src2)
Point< dim > transform_real_to_unit_cell_internal(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< spacedim > &p, const Point< dim > &initial_p_unit) const
virtual void add_new_points(const std::vector< Point< spacedim > > &surrounding_points, const Table< 2, double > &weights, std::vector< Point< spacedim > > &new_points) const
virtual std::size_t memory_consumption() const
unsigned int get_degree() const
double norm(const FEValuesBase< dim > &fe, const VectorSlice< const std::vector< std::vector< Tensor< 1, dim > > > > &Du)
std_cxx11::enable_if< std_cxx11::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
const double & shape(const unsigned int qpoint, const unsigned int shape_nr) const
Number determinant(const SymmetricTensor< 2, dim, Number > &t)
VectorizedArray< Number > sqrt(const ::VectorizedArray< Number > &x)
const types::manifold_id invalid_manifold_id
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)
Number determinant(const Tensor< 2, dim, Number > &t)
virtual Point< spacedim > transform_unit_to_real_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< dim > &p) const
virtual void fill_fe_subface_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const unsigned int subface_no, const Quadrature< dim-1 > &quadrature, const typename Mapping< dim, spacedim >::InternalDataBase &internal_data, ::internal::FEValues::MappingRelatedData< dim, spacedim > &output_data) const
virtual std::vector< Point< spacedim > > compute_mapping_support_points(const typename Triangulation< dim, spacedim >::cell_iterator &cell) const
virtual void add_line_support_points(const typename Triangulation< dim, spacedim >::cell_iterator &cell, std::vector< Point< spacedim > > &a) const
virtual InternalData * get_face_data(const UpdateFlags flags, const Quadrature< dim-1 > &quadrature) const
static Point< dim > project_to_unit_cell(const Point< dim > &p)
static ::ExceptionBase & ExcNotImplemented()
std::vector< Tensor< 3, dim > > shape_third_derivatives
const Tensor< 2, dim > & second_derivative(const unsigned int qpoint, const unsigned int shape_nr) const
const Tensor< 1, dim > & derivative(const unsigned int qpoint, const unsigned int shape_nr) const
SymmetricTensor< 2, dim, Number > invert(const SymmetricTensor< 2, dim, Number > &)
void initialize_face(const UpdateFlags update_flags, const Quadrature< dim > &quadrature, const unsigned int n_original_q_points)
double compute_value(const unsigned int i, const Point< dim > &p) const
std::vector< double > shape_values
Point< 3 > point(const gp_Pnt &p)
static double subface_ratio(const internal::SubfaceCase< dim > &subface_case, const unsigned int subface_no)
const Manifold< dim, spacedim > & get_manifold(const types::manifold_id number) const
Covariant transformation.
static double d_linear_shape_function(const Point< dim > &xi, const unsigned int i)
Tensor< 2, dim, Number > l(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
static ::ExceptionBase & ExcInternalError()