48template <
int dim,
int spacedim>
68template <
int dim,
int spacedim>
73 const unsigned int n_original_q_points)
77 this->update_each = update_flags;
87 if (this->update_each &
89 compute_manifold_quadrature_weights(q);
92 covariant.resize(n_original_q_points);
95 contravariant.resize(n_original_q_points);
98 volume_elements.resize(n_original_q_points);
102template <
int dim,
int spacedim>
107 const unsigned int n_original_q_points)
109 initialize(update_flags, q, n_original_q_points);
121 unit_tangentials[i].resize(n_original_q_points);
122 std::fill(unit_tangentials[i].
begin(),
123 unit_tangentials[i].
end(),
128 .resize(n_original_q_points);
143template <
int dim,
int spacedim>
150template <
int dim,
int spacedim>
151std::unique_ptr<Mapping<dim, spacedim>>
154 return std::make_unique<MappingManifold<dim, spacedim>>(*this);
159template <
int dim,
int spacedim>
171template <
int dim,
int spacedim>
178 std::array<double, GeometryInfo<dim>::vertices_per_cell> weights;
205template <
int dim,
int spacedim>
217 for (
unsigned int i = 0; i < 5; ++i)
267template <
int dim,
int spacedim>
268std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
272 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase> data_ptr =
273 std::make_unique<InternalData>();
282template <
int dim,
int spacedim>
283std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
290 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase> data_ptr =
291 std::make_unique<InternalData>();
295 ReferenceCells::get_hypercube<dim>(), quadrature[0]),
296 quadrature[0].size());
303template <
int dim,
int spacedim>
304std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
309 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase> data_ptr =
310 std::make_unique<InternalData>();
314 ReferenceCells::get_hypercube<dim>(), quadrature),
324 namespace MappingManifoldImplementation
334 template <
int dim,
int spacedim>
338 const typename ::MappingManifold<dim, spacedim>::InternalData
355 data.cell_manifold_quadrature_weights[
point + data_set]));
368 template <
int dim,
int spacedim>
371 const typename ::QProjector<dim>::DataSetDescriptor data_set,
372 const typename ::MappingManifold<dim, spacedim>::InternalData
379 const unsigned int n_q_points = data.contravariant.size();
381 std::fill(data.contravariant.begin(),
382 data.contravariant.end(),
386 data.vertices.size());
397 data.cell_manifold_quadrature_weights[
point + data_set]));
406 for (
unsigned int i = 0; i < dim; ++i)
409 const double pi = p[i];
410 Assert(pi >= 0 && pi <= 1.0,
412 "Was expecting a quadrature point "
413 "inside the unit reference element."));
417 const double L = pi > .5 ? -pi : 1 - pi;
422 for (
const unsigned int j :
424 data.vertex_weights[j] =
432 data.manifold->get_tangent_vector(P, NP);
434 for (
unsigned int d = 0;
d < spacedim; ++
d)
435 data.contravariant[
point][
d][i] =
T[
d] /
L;
441 const unsigned int n_q_points = data.contravariant.size();
444 data.covariant[
point] =
445 (data.contravariant[
point]).covariant_form();
451 const unsigned int n_q_points = data.contravariant.size();
453 data.volume_elements[
point] =
454 data.contravariant[
point].determinant();
464template <
int dim,
int spacedim>
479 const unsigned int n_q_points = quadrature.
size();
495 const std::vector<double> &weights = quadrature.
get_weights();
521 Assert(det > 1
e-12 * Utilities::fixed_power<dim>(
522 cell->diameter() /
std::sqrt(
double(dim))),
524 cell->center(), det,
point)));
534 for (
unsigned int i = 0; i < spacedim; ++i)
535 for (
unsigned int j = 0; j < dim; ++j)
539 for (
unsigned int i = 0; i < dim; ++i)
540 for (
unsigned int j = 0; j < dim; ++j)
541 G[i][j] = DX_t[i] * DX_t[j];
548 Assert(spacedim == dim + 1,
550 "There is no (unique) cell normal for " +
552 "-dimensional cells in " +
554 "-dimensional space. This only works if the "
555 "space dimension is one greater than the "
556 "dimensionality of the mesh cells."));
568 if (cell->direction_flag() ==
false)
601 namespace MappingManifoldImplementation
614 template <
int dim,
int spacedim>
617 const ::MappingManifold<dim, spacedim> &mapping,
618 const typename ::Triangulation<dim, spacedim>::cell_iterator
620 const unsigned int face_no,
621 const unsigned int subface_no,
622 const unsigned int n_q_points,
623 const std::vector<double> &weights,
624 const typename ::MappingManifold<dim, spacedim>::InternalData
642 for (
unsigned int d = 0;
d != dim - 1; ++
d)
645 data.unit_tangentials.size(),
648 data.aux[
d].size() <=
650 .unit_tangentials[face_no +
658 .unit_tangentials[face_no +
669 for (
unsigned int i = 0; i < n_q_points; ++i)
678 (face_no == 0 ? -1 : +1);
710 data.contravariant[
point].transpose()[0];
712 (face_no == 0 ? -1. : +1.) *
725 cell_normal /= cell_normal.
norm();
752 const double area_ratio =
754 cell->subface_case(face_no), subface_no);
772 data.covariant[
point].transpose();
783 template <
int dim,
int spacedim>
786 const ::MappingManifold<dim, spacedim> &mapping,
787 const typename ::Triangulation<dim, spacedim>::cell_iterator
789 const unsigned int face_no,
790 const unsigned int subface_no,
793 const typename ::MappingManifold<dim, spacedim>::InternalData
798 data.store_vertices(cell);
800 data.manifold = &cell->face(face_no)->get_manifold();
802 maybe_compute_q_points<dim, spacedim>(data_set,
805 maybe_update_Jacobians<dim, spacedim>(data_set, data);
817 template <
int dim,
int spacedim,
int rank>
826 Assert((
dynamic_cast<const typename ::
827 MappingManifold<dim, spacedim>::InternalData *
>(
828 &mapping_data) !=
nullptr),
830 const typename ::MappingManifold<dim, spacedim>::InternalData
832 static_cast<const typename ::MappingManifold<dim, spacedim>::
833 InternalData &
>(mapping_data);
835 switch (mapping_kind)
842 "update_contravariant_transformation"));
844 for (
unsigned int i = 0; i < output.size(); ++i)
856 "update_contravariant_transformation"));
860 "update_volume_elements"));
865 for (
unsigned int i = 0; i < output.size(); ++i)
869 output[i] /= data.volume_elements[i];
881 "update_covariant_transformation"));
883 for (
unsigned int i = 0; i < output.size(); ++i)
895 template <
int dim,
int spacedim,
int rank>
904 Assert((
dynamic_cast<const typename ::
905 MappingManifold<dim, spacedim>::InternalData *
>(
906 &mapping_data) !=
nullptr),
908 const typename ::MappingManifold<dim, spacedim>::InternalData
910 static_cast<const typename ::MappingManifold<dim, spacedim>::
911 InternalData &
>(mapping_data);
913 switch (mapping_kind)
920 "update_covariant_transformation"));
924 "update_contravariant_transformation"));
927 for (
unsigned int i = 0; i < output.size(); ++i)
944 "update_covariant_transformation"));
947 for (
unsigned int i = 0; i < output.size(); ++i)
964 "update_covariant_transformation"));
968 "update_contravariant_transformation"));
972 "update_volume_elements"));
975 for (
unsigned int i = 0; i < output.size(); ++i)
984 output[i] /= data.volume_elements[i];
997 template <
int dim,
int spacedim>
1006 Assert((
dynamic_cast<const typename ::
1007 MappingManifold<dim, spacedim>::InternalData *
>(
1008 &mapping_data) !=
nullptr),
1010 const typename ::MappingManifold<dim, spacedim>::InternalData
1012 static_cast<const typename ::MappingManifold<dim, spacedim>::
1013 InternalData &
>(mapping_data);
1015 switch (mapping_kind)
1022 "update_covariant_transformation"));
1026 "update_contravariant_transformation"));
1028 for (
unsigned int q = 0; q < output.size(); ++q)
1029 for (
unsigned int i = 0; i < spacedim; ++i)
1031 double tmp1[dim][dim];
1032 for (
unsigned int J = 0; J < dim; ++J)
1033 for (
unsigned int K = 0; K < dim; ++K)
1036 data.contravariant[q][i][0] * input[q][0][J][K];
1037 for (
unsigned int I = 1; I < dim; ++I)
1039 data.contravariant[q][i][I] * input[q][I][J][K];
1041 for (
unsigned int j = 0; j < spacedim; ++j)
1044 for (
unsigned int K = 0; K < dim; ++K)
1046 tmp2[K] = data.covariant[q][j][0] * tmp1[0][K];
1047 for (
unsigned int J = 1; J < dim; ++J)
1048 tmp2[K] += data.covariant[q][j][J] * tmp1[J][K];
1050 for (
unsigned int k = 0; k < spacedim; ++k)
1052 output[q][i][j][k] =
1053 data.covariant[q][k][0] * tmp2[0];
1054 for (
unsigned int K = 1; K < dim; ++K)
1055 output[q][i][j][k] +=
1056 data.covariant[q][k][K] * tmp2[K];
1068 "update_covariant_transformation"));
1070 for (
unsigned int q = 0; q < output.size(); ++q)
1071 for (
unsigned int i = 0; i < spacedim; ++i)
1073 double tmp1[dim][dim];
1074 for (
unsigned int J = 0; J < dim; ++J)
1075 for (
unsigned int K = 0; K < dim; ++K)
1078 data.covariant[q][i][0] * input[q][0][J][K];
1079 for (
unsigned int I = 1; I < dim; ++I)
1081 data.covariant[q][i][I] * input[q][I][J][K];
1083 for (
unsigned int j = 0; j < spacedim; ++j)
1086 for (
unsigned int K = 0; K < dim; ++K)
1088 tmp2[K] = data.covariant[q][j][0] * tmp1[0][K];
1089 for (
unsigned int J = 1; J < dim; ++J)
1090 tmp2[K] += data.covariant[q][j][J] * tmp1[J][K];
1092 for (
unsigned int k = 0; k < spacedim; ++k)
1094 output[q][i][j][k] =
1095 data.covariant[q][k][0] * tmp2[0];
1096 for (
unsigned int K = 1; K < dim; ++K)
1097 output[q][i][j][k] +=
1098 data.covariant[q][k][K] * tmp2[K];
1111 "update_covariant_transformation"));
1115 "update_contravariant_transformation"));
1119 "update_volume_elements"));
1121 for (
unsigned int q = 0; q < output.size(); ++q)
1122 for (
unsigned int i = 0; i < spacedim; ++i)
1125 for (
unsigned int I = 0; I < dim; ++I)
1127 data.contravariant[q][i][I] / data.volume_elements[q];
1128 double tmp1[dim][dim];
1129 for (
unsigned int J = 0; J < dim; ++J)
1130 for (
unsigned int K = 0; K < dim; ++K)
1132 tmp1[J][K] = factor[0] * input[q][0][J][K];
1133 for (
unsigned int I = 1; I < dim; ++I)
1134 tmp1[J][K] += factor[I] * input[q][I][J][K];
1136 for (
unsigned int j = 0; j < spacedim; ++j)
1139 for (
unsigned int K = 0; K < dim; ++K)
1141 tmp2[K] = data.covariant[q][j][0] * tmp1[0][K];
1142 for (
unsigned int J = 1; J < dim; ++J)
1143 tmp2[K] += data.covariant[q][j][J] * tmp1[J][K];
1145 for (
unsigned int k = 0; k < spacedim; ++k)
1147 output[q][i][j][k] =
1148 data.covariant[q][k][0] * tmp2[0];
1149 for (
unsigned int K = 1; K < dim; ++K)
1150 output[q][i][j][k] +=
1151 data.covariant[q][k][K] * tmp2[K];
1166 template <
int dim,
int spacedim,
int rank>
1175 Assert((
dynamic_cast<const typename ::
1176 MappingManifold<dim, spacedim>::InternalData *
>(
1177 &mapping_data) !=
nullptr),
1179 const typename ::MappingManifold<dim, spacedim>::InternalData
1181 static_cast<const typename ::MappingManifold<dim, spacedim>::
1182 InternalData &
>(mapping_data);
1184 switch (mapping_kind)
1191 "update_covariant_transformation"));
1193 for (
unsigned int i = 0; i < output.size(); ++i)
1208template <
int dim,
int spacedim>
1212 const unsigned int face_no,
1231 ReferenceCells::get_hypercube<dim>(),
1233 cell->face_orientation(face_no),
1234 cell->face_flip(face_no),
1235 cell->face_rotation(face_no),
1236 quadrature[0].
size()),
1244template <
int dim,
int spacedim>
1248 const unsigned int face_no,
1249 const unsigned int subface_no,
1266 ReferenceCells::get_hypercube<dim>(),
1269 cell->face_orientation(face_no),
1270 cell->face_flip(face_no),
1271 cell->face_rotation(face_no),
1273 cell->subface_case(face_no)),
1281template <
int dim,
int spacedim>
1297template <
int dim,
int spacedim>
1306 input, mapping_kind, mapping_data, output);
1311template <
int dim,
int spacedim>
1319 switch (mapping_kind)
1332 input, mapping_kind, mapping_data, output);
1341template <
int dim,
int spacedim>
1354 switch (mapping_kind)
1360 "update_covariant_transformation"));
1362 for (
unsigned int q = 0; q < output.size(); ++q)
1363 for (
unsigned int i = 0; i < spacedim; ++i)
1364 for (
unsigned int j = 0; j < spacedim; ++j)
1367 for (
unsigned int K = 0; K < dim; ++K)
1369 tmp[K] = data.
covariant[q][j][0] * input[q][i][0][K];
1370 for (
unsigned int J = 1; J < dim; ++J)
1371 tmp[K] += data.
covariant[q][j][J] * input[q][i][J][K];
1373 for (
unsigned int k = 0; k < spacedim; ++k)
1375 output[q][i][j][k] = data.
covariant[q][k][0] * tmp[0];
1376 for (
unsigned int K = 1; K < dim; ++K)
1377 output[q][i][j][k] += data.
covariant[q][k][K] * tmp[K];
1390template <
int dim,
int spacedim>
1398 switch (mapping_kind)
1404 input, mapping_kind, mapping_data, output);
1412#include "mapping_manifold.inst"
ArrayView< typename std::remove_reference< typename std::iterator_traits< Iterator >::reference >::type, MemorySpaceType > make_array_view(const Iterator begin, const Iterator end)
virtual Point< spacedim > get_new_point(const ArrayView< const Point< spacedim > > &surrounding_points, const ArrayView< const double > &weights) const
void store_vertices(const typename Triangulation< dim, spacedim >::cell_iterator &cell) const
std::vector< double > volume_elements
std::array< std::vector< Tensor< 1, dim > >, GeometryInfo< dim >::faces_per_cell *(dim - 1)> unit_tangentials
std::vector< DerivativeForm< 1, dim, spacedim > > contravariant
void initialize(const UpdateFlags update_flags, const Quadrature< dim > &quadrature, const unsigned int n_original_q_points)
SmartPointer< const Manifold< dim, spacedim > > manifold
std::vector< std::vector< Tensor< 1, spacedim > > > aux
virtual std::size_t memory_consumption() const override
std::vector< std::vector< double > > cell_manifold_quadrature_weights
void initialize_face(const UpdateFlags update_flags, const Quadrature< dim > &quadrature, const unsigned int n_original_q_points)
std::vector< Point< spacedim > > vertices
std::vector< double > vertex_weights
std::vector< DerivativeForm< 1, dim, spacedim > > covariant
Triangulation< dim, spacedim >::cell_iterator cell
virtual Point< spacedim > transform_unit_to_real_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< dim > &p) const override
MappingManifold()=default
virtual Point< dim > transform_real_to_unit_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< spacedim > &p) const override
virtual void transform(const ArrayView< const Tensor< 1, dim > > &input, const MappingKind kind, const typename Mapping< dim, spacedim >::InternalDataBase &internal, const ArrayView< Tensor< 1, spacedim > > &output) const override
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::FEValuesImplementation::MappingRelatedData< dim, spacedim > &output_data) const override
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::FEValuesImplementation::MappingRelatedData< dim, spacedim > &output_data) const override
virtual UpdateFlags requires_update_flags(const UpdateFlags update_flags) const override
virtual std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBase > get_data(const UpdateFlags, const Quadrature< dim > &quadrature) const override
virtual std::unique_ptr< Mapping< dim, spacedim > > clone() const override
virtual std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBase > get_face_data(const UpdateFlags flags, const hp::QCollection< dim - 1 > &quadrature) const override
virtual std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBase > get_subface_data(const UpdateFlags flags, const Quadrature< dim - 1 > &quadrature) const override
virtual void fill_fe_face_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const hp::QCollection< dim - 1 > &quadrature, const typename Mapping< dim, spacedim >::InternalDataBase &internal_data, ::internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &output_data) const override
Abstract base class for mapping classes.
static Point< dim, Number > unit_vector(const unsigned int i)
static DataSetDescriptor cell()
const std::vector< double > & get_weights() const
unsigned int size() const
numbers::NumberTraits< Number >::real_type norm() const
unsigned int size() const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
@ update_jacobian_pushed_forward_2nd_derivatives
@ update_volume_elements
Determinant of the Jacobian.
@ update_contravariant_transformation
Contravariant transformation.
@ update_jacobian_pushed_forward_grads
@ update_jacobian_grads
Gradient of volume element.
@ update_normal_vectors
Normal vectors.
@ update_JxW_values
Transformed quadrature weights.
@ update_covariant_transformation
Covariant transformation.
@ update_jacobians
Volume element.
@ update_inverse_jacobians
Volume element.
@ update_quadrature_points
Transformed quadrature points.
@ update_jacobian_pushed_forward_3rd_derivatives
@ update_boundary_forms
Outer normal vector, not normalized.
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
static ::ExceptionBase & ExcMessage(std::string arg1)
const Manifold< dim, spacedim > & get_manifold(const types::manifold_id number) const
@ mapping_covariant_gradient
@ mapping_contravariant_hessian
@ mapping_covariant_hessian
@ mapping_contravariant_gradient
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
Point< spacedim > point(const gp_Pnt &p, const double tolerance=1e-10)
void quadrature_points(const Triangulation< dim, spacedim > &triangulation, const Quadrature< dim > &quadrature, const std::vector< std::vector< BoundingBox< spacedim > > > &global_bounding_boxes, ParticleHandler< dim, spacedim > &particle_handler, const Mapping< dim, spacedim > &mapping=(ReferenceCells::get_hypercube< dim >() .template get_default_linear_mapping< dim, spacedim >()), const std::vector< std::vector< double > > &properties={})
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
VectorType::value_type * end(VectorType &V)
VectorType::value_type * begin(VectorType &V)
std::string int_to_string(const unsigned int value, const unsigned int digits=numbers::invalid_unsigned_int)
void transform_differential_forms(const ArrayView< const DerivativeForm< rank, dim, spacedim > > &input, const MappingKind mapping_kind, const typename Mapping< dim, spacedim >::InternalDataBase &mapping_data, const ArrayView< Tensor< rank+1, spacedim > > &output)
void transform_hessians(const ArrayView< const Tensor< 3, dim > > &input, const MappingKind mapping_kind, const typename Mapping< dim, spacedim >::InternalDataBase &mapping_data, const ArrayView< Tensor< 3, spacedim > > &output)
void maybe_update_Jacobians(const CellSimilarity::Similarity cell_similarity, const typename ::QProjector< dim >::DataSetDescriptor data_set, const typename ::MappingQGeneric< dim, spacedim >::InternalData &data)
void do_fill_fe_face_values(const ::MappingQGeneric< dim, spacedim > &mapping, const typename ::Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const unsigned int subface_no, const typename QProjector< dim >::DataSetDescriptor data_set, const Quadrature< dim - 1 > &quadrature, const typename ::MappingQGeneric< dim, spacedim >::InternalData &data, internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &output_data)
void transform_gradients(const ArrayView< const Tensor< rank, dim > > &input, const MappingKind mapping_kind, const typename Mapping< dim, spacedim >::InternalDataBase &mapping_data, const ArrayView< Tensor< rank, spacedim > > &output)
void transform_fields(const ArrayView< const Tensor< rank, dim > > &input, const MappingKind mapping_kind, const typename Mapping< dim, spacedim >::InternalDataBase &mapping_data, const ArrayView< Tensor< rank, spacedim > > &output)
void maybe_compute_face_data(const ::MappingQGeneric< dim, spacedim > &mapping, const typename ::Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const unsigned int subface_no, const unsigned int n_q_points, const std::vector< double > &weights, const typename ::MappingQGeneric< dim, spacedim >::InternalData &data, internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &output_data)
void maybe_compute_q_points(const typename QProjector< dim >::DataSetDescriptor data_set, const typename ::MappingQGeneric< dim, spacedim >::InternalData &data, std::vector< Point< spacedim > > &quadrature_points)
static const unsigned int invalid_unsigned_int
::VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &)
static double subface_ratio(const internal::SubfaceCase< dim > &subface_case, const unsigned int subface_no)
static double d_linear_shape_function(const Point< dim > &xi, const unsigned int i)
constexpr Number determinant(const SymmetricTensor< 2, dim, Number > &)
constexpr Tensor< 1, dim, Number > cross_product_2d(const Tensor< 1, dim, Number > &src)
constexpr Tensor< 1, dim, typename ProductType< Number1, Number2 >::type > cross_product_3d(const Tensor< 1, dim, Number1 > &src1, const Tensor< 1, dim, Number2 > &src2)