49 template <
int dim,
int spacedim>
69 template <
int dim,
int spacedim>
74 const unsigned int n_original_q_points)
78 this->update_each = update_flags;
88 if (this->update_each &
90 compute_manifold_quadrature_weights(q);
93 covariant.resize(n_original_q_points);
96 contravariant.resize(n_original_q_points);
99 volume_elements.resize(n_original_q_points);
103 template <
int dim,
int spacedim>
108 const unsigned int n_original_q_points)
110 initialize(update_flags, q, n_original_q_points);
122 unit_tangentials[i].resize(n_original_q_points);
123 std::fill(unit_tangentials[i].
begin(),
124 unit_tangentials[i].
end(),
129 .resize(n_original_q_points);
144 template <
int dim,
int spacedim>
151 template <
int dim,
int spacedim>
152 std::unique_ptr<Mapping<dim, spacedim>>
155 return std_cxx14::make_unique<MappingManifold<dim, spacedim>>(*this);
160 template <
int dim,
int spacedim>
172 template <
int dim,
int spacedim>
179 std::array<double, GeometryInfo<dim>::vertices_per_cell> weights;
186 return cell->get_manifold().get_new_point(
206 template <
int dim,
int spacedim>
218 for (
unsigned int i = 0; i < 5; ++i)
268 template <
int dim,
int spacedim>
269 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
273 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase> data_ptr =
274 std_cxx14::make_unique<InternalData>();
283 template <
int dim,
int spacedim>
284 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
289 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase> data_ptr =
290 std_cxx14::make_unique<InternalData>();
301 template <
int dim,
int spacedim>
302 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
307 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase> data_ptr =
308 std_cxx14::make_unique<InternalData>();
321 namespace MappingManifoldImplementation
331 template <
int dim,
int spacedim>
333 maybe_compute_q_points(
335 const typename ::MappingManifold<dim, spacedim>::InternalData
352 data.cell_manifold_quadrature_weights[
point + data_set]));
365 template <
int dim,
int spacedim>
367 maybe_update_Jacobians(
368 const typename ::QProjector<dim>::DataSetDescriptor data_set,
369 const typename ::MappingManifold<dim, spacedim>::InternalData
376 const unsigned int n_q_points = data.contravariant.size();
378 std::fill(data.contravariant.begin(),
379 data.contravariant.end(),
383 data.vertices.size());
394 data.cell_manifold_quadrature_weights[
point + data_set]));
403 for (
unsigned int i = 0; i < dim; ++i)
406 const double pi = p[i];
407 Assert(pi >= 0 && pi <= 1.0,
409 "Was expecting a quadrature point "
410 "inside the unit reference element."));
414 const double L = pi > .5 ? -pi : 1 - pi;
419 for (
const unsigned int j :
421 data.vertex_weights[j] =
429 data.manifold->get_tangent_vector(P, NP);
431 for (
unsigned int d = 0;
d < spacedim; ++
d)
432 data.contravariant[
point][
d][i] =
T[
d] /
L;
438 const unsigned int n_q_points = data.contravariant.size();
441 data.covariant[
point] =
442 (data.contravariant[
point]).covariant_form();
448 const unsigned int n_q_points = data.contravariant.size();
450 data.volume_elements[
point] =
451 data.contravariant[
point].determinant();
461 template <
int dim,
int spacedim>
476 const unsigned int n_q_points = quadrature.
size();
479 data.
manifold = &(cell->get_manifold());
481 internal::MappingManifoldImplementation::maybe_compute_q_points<dim,
487 internal::MappingManifoldImplementation::maybe_update_Jacobians<dim,
492 const std::vector<double> &weights = quadrature.
get_weights();
511 const double det = data.contravariant[
point].determinant();
518 Assert(det > 1
e-12 * Utilities::fixed_power<dim>(
519 cell->diameter() / std::sqrt(
double(dim))),
521 cell->center(), det,
point)));
531 for (
unsigned int i = 0; i < spacedim; ++i)
532 for (
unsigned int j = 0; j < dim; ++j)
533 DX_t[j][i] = data.contravariant[
point][i][j];
536 for (
unsigned int i = 0; i < dim; ++i)
537 for (
unsigned int j = 0; j < dim; ++j)
538 G[i][j] = DX_t[i] * DX_t[j];
545 Assert(spacedim == dim + 1,
547 "There is no (unique) cell normal for " +
549 "-dimensional cells in " +
551 "-dimensional space. This only works if the "
552 "space dimension is one greater than the "
553 "dimensionality of the mesh cells."));
565 if (cell->direction_flag() ==
false)
588 data.covariant[
point].transpose();
598 namespace MappingManifoldImplementation
611 template <
int dim,
int spacedim>
613 maybe_compute_face_data(
614 const ::MappingManifold<dim, spacedim> &mapping,
615 const typename ::Triangulation<dim, spacedim>::cell_iterator
617 const unsigned int face_no,
618 const unsigned int subface_no,
619 const unsigned int n_q_points,
620 const std::vector<double> &weights,
621 const typename ::MappingManifold<dim, spacedim>::InternalData
639 for (
unsigned int d = 0;
d != dim - 1; ++
d)
642 data.unit_tangentials.size(),
645 data.aux[
d].size() <=
647 .unit_tangentials[face_no +
655 .unit_tangentials[face_no +
666 for (
unsigned int i = 0; i < n_q_points; ++i)
675 (face_no == 0 ? -1 : +1);
707 data.contravariant[
point].transpose()[0];
709 (face_no == 0 ? -1. : +1.) *
722 cell_normal /= cell_normal.
norm();
749 const double area_ratio =
751 cell->subface_case(face_no), subface_no);
769 data.covariant[
point].transpose();
780 template <
int dim,
int spacedim>
782 do_fill_fe_face_values(
783 const ::MappingManifold<dim, spacedim> &mapping,
784 const typename ::Triangulation<dim, spacedim>::cell_iterator
786 const unsigned int face_no,
787 const unsigned int subface_no,
790 const typename ::MappingManifold<dim, spacedim>::InternalData
795 data.store_vertices(cell);
797 data.manifold = &cell->face(face_no)->get_manifold();
799 maybe_compute_q_points<dim, spacedim>(data_set,
802 maybe_update_Jacobians<dim, spacedim>(data_set, data);
804 maybe_compute_face_data(mapping,
814 template <
int dim,
int spacedim,
int rank>
823 Assert((
dynamic_cast<const typename ::
824 MappingManifold<dim, spacedim>::InternalData *
>(
825 &mapping_data) !=
nullptr),
827 const typename ::MappingManifold<dim, spacedim>::InternalData
829 static_cast<const typename ::MappingManifold<dim, spacedim>::
830 InternalData &
>(mapping_data);
832 switch (mapping_kind)
839 "update_contravariant_transformation"));
841 for (
unsigned int i = 0; i < output.size(); ++i)
853 "update_contravariant_transformation"));
857 "update_volume_elements"));
862 for (
unsigned int i = 0; i < output.size(); ++i)
866 output[i] /= data.volume_elements[i];
878 "update_covariant_transformation"));
880 for (
unsigned int i = 0; i < output.size(); ++i)
892 template <
int dim,
int spacedim,
int rank>
901 Assert((
dynamic_cast<const typename ::
902 MappingManifold<dim, spacedim>::InternalData *
>(
903 &mapping_data) !=
nullptr),
905 const typename ::MappingManifold<dim, spacedim>::InternalData
907 static_cast<const typename ::MappingManifold<dim, spacedim>::
908 InternalData &
>(mapping_data);
910 switch (mapping_kind)
917 "update_covariant_transformation"));
921 "update_contravariant_transformation"));
924 for (
unsigned int i = 0; i < output.size(); ++i)
941 "update_covariant_transformation"));
944 for (
unsigned int i = 0; i < output.size(); ++i)
961 "update_covariant_transformation"));
965 "update_contravariant_transformation"));
969 "update_volume_elements"));
972 for (
unsigned int i = 0; i < output.size(); ++i)
981 output[i] /= data.volume_elements[i];
994 template <
int dim,
int spacedim>
1003 Assert((
dynamic_cast<const typename ::
1004 MappingManifold<dim, spacedim>::InternalData *
>(
1005 &mapping_data) !=
nullptr),
1007 const typename ::MappingManifold<dim, spacedim>::InternalData
1009 static_cast<const typename ::MappingManifold<dim, spacedim>::
1010 InternalData &
>(mapping_data);
1012 switch (mapping_kind)
1019 "update_covariant_transformation"));
1023 "update_contravariant_transformation"));
1025 for (
unsigned int q = 0; q < output.size(); ++q)
1026 for (
unsigned int i = 0; i < spacedim; ++i)
1028 double tmp1[dim][dim];
1029 for (
unsigned int J = 0; J < dim; ++J)
1030 for (
unsigned int K = 0; K < dim; ++K)
1033 data.contravariant[q][i][0] * input[q][0][J][K];
1034 for (
unsigned int I = 1; I < dim; ++I)
1036 data.contravariant[q][i][I] * input[q][I][J][K];
1038 for (
unsigned int j = 0; j < spacedim; ++j)
1041 for (
unsigned int K = 0; K < dim; ++K)
1043 tmp2[K] = data.covariant[q][j][0] * tmp1[0][K];
1044 for (
unsigned int J = 1; J < dim; ++J)
1045 tmp2[K] += data.covariant[q][j][J] * tmp1[J][K];
1047 for (
unsigned int k = 0; k < spacedim; ++k)
1049 output[q][i][j][k] =
1050 data.covariant[q][k][0] * tmp2[0];
1051 for (
unsigned int K = 1; K < dim; ++K)
1052 output[q][i][j][k] +=
1053 data.covariant[q][k][K] * tmp2[K];
1065 "update_covariant_transformation"));
1067 for (
unsigned int q = 0; q < output.size(); ++q)
1068 for (
unsigned int i = 0; i < spacedim; ++i)
1070 double tmp1[dim][dim];
1071 for (
unsigned int J = 0; J < dim; ++J)
1072 for (
unsigned int K = 0; K < dim; ++K)
1075 data.covariant[q][i][0] * input[q][0][J][K];
1076 for (
unsigned int I = 1; I < dim; ++I)
1078 data.covariant[q][i][I] * input[q][I][J][K];
1080 for (
unsigned int j = 0; j < spacedim; ++j)
1083 for (
unsigned int K = 0; K < dim; ++K)
1085 tmp2[K] = data.covariant[q][j][0] * tmp1[0][K];
1086 for (
unsigned int J = 1; J < dim; ++J)
1087 tmp2[K] += data.covariant[q][j][J] * tmp1[J][K];
1089 for (
unsigned int k = 0; k < spacedim; ++k)
1091 output[q][i][j][k] =
1092 data.covariant[q][k][0] * tmp2[0];
1093 for (
unsigned int K = 1; K < dim; ++K)
1094 output[q][i][j][k] +=
1095 data.covariant[q][k][K] * tmp2[K];
1108 "update_covariant_transformation"));
1112 "update_contravariant_transformation"));
1116 "update_volume_elements"));
1118 for (
unsigned int q = 0; q < output.size(); ++q)
1119 for (
unsigned int i = 0; i < spacedim; ++i)
1122 for (
unsigned int I = 0; I < dim; ++I)
1124 data.contravariant[q][i][I] / data.volume_elements[q];
1125 double tmp1[dim][dim];
1126 for (
unsigned int J = 0; J < dim; ++J)
1127 for (
unsigned int K = 0; K < dim; ++K)
1129 tmp1[J][K] = factor[0] * input[q][0][J][K];
1130 for (
unsigned int I = 1; I < dim; ++I)
1131 tmp1[J][K] += factor[I] * input[q][I][J][K];
1133 for (
unsigned int j = 0; j < spacedim; ++j)
1136 for (
unsigned int K = 0; K < dim; ++K)
1138 tmp2[K] = data.covariant[q][j][0] * tmp1[0][K];
1139 for (
unsigned int J = 1; J < dim; ++J)
1140 tmp2[K] += data.covariant[q][j][J] * tmp1[J][K];
1142 for (
unsigned int k = 0; k < spacedim; ++k)
1144 output[q][i][j][k] =
1145 data.covariant[q][k][0] * tmp2[0];
1146 for (
unsigned int K = 1; K < dim; ++K)
1147 output[q][i][j][k] +=
1148 data.covariant[q][k][K] * tmp2[K];
1163 template <
int dim,
int spacedim,
int rank>
1165 transform_differential_forms(
1172 Assert((
dynamic_cast<const typename ::
1173 MappingManifold<dim, spacedim>::InternalData *
>(
1174 &mapping_data) !=
nullptr),
1176 const typename ::MappingManifold<dim, spacedim>::InternalData
1178 static_cast<const typename ::MappingManifold<dim, spacedim>::
1179 InternalData &
>(mapping_data);
1181 switch (mapping_kind)
1188 "update_covariant_transformation"));
1190 for (
unsigned int i = 0; i < output.size(); ++i)
1205 template <
int dim,
int spacedim>
1209 const unsigned int face_no,
1220 internal::MappingManifoldImplementation::do_fill_fe_face_values(
1226 cell->face_orientation(face_no),
1227 cell->face_flip(face_no),
1228 cell->face_rotation(face_no),
1237 template <
int dim,
int spacedim>
1241 const unsigned int face_no,
1242 const unsigned int subface_no,
1253 internal::MappingManifoldImplementation::do_fill_fe_face_values(
1260 cell->face_orientation(face_no),
1261 cell->face_flip(face_no),
1262 cell->face_rotation(face_no),
1264 cell->subface_case(face_no)),
1272 template <
int dim,
int spacedim>
1280 internal::MappingManifoldImplementation::transform_fields(input,
1288 template <
int dim,
int spacedim>
1296 internal::MappingManifoldImplementation::transform_differential_forms(
1297 input, mapping_kind, mapping_data, output);
1302 template <
int dim,
int spacedim>
1310 switch (mapping_kind)
1313 internal::MappingManifoldImplementation::transform_fields(input,
1322 internal::MappingManifoldImplementation::transform_gradients(
1323 input, mapping_kind, mapping_data, output);
1332 template <
int dim,
int spacedim>
1345 switch (mapping_kind)
1351 "update_covariant_transformation"));
1353 for (
unsigned int q = 0; q < output.size(); ++q)
1354 for (
unsigned int i = 0; i < spacedim; ++i)
1355 for (
unsigned int j = 0; j < spacedim; ++j)
1358 for (
unsigned int K = 0; K < dim; ++K)
1360 tmp[K] = data.
covariant[q][j][0] * input[q][i][0][K];
1361 for (
unsigned int J = 1; J < dim; ++J)
1362 tmp[K] += data.
covariant[q][j][J] * input[q][i][J][K];
1364 for (
unsigned int k = 0; k < spacedim; ++k)
1366 output[q][i][j][k] = data.
covariant[q][k][0] * tmp[0];
1367 for (
unsigned int K = 1; K < dim; ++K)
1368 output[q][i][j][k] += data.
covariant[q][k][K] * tmp[K];
1381 template <
int dim,
int spacedim>
1389 switch (mapping_kind)
1394 internal::MappingManifoldImplementation::transform_hessians(
1395 input, mapping_kind, mapping_data, output);
1403 #include "mapping_manifold.inst"