42 "You are using MappingCartesian, but the incoming cell is not Cartesian.");
51template <
class CellType>
55 if (!cell->reference_cell().is_hyper_cube())
58 const double tolerance = 1e-14;
59 const auto bounding_box = cell->bounding_box();
60 const auto & bounding_vertices = bounding_box.get_boundary_points();
61 const auto cell_measure =
62 bounding_vertices.first.distance_square(bounding_vertices.second);
64 for (
const unsigned int v : cell->vertex_indices())
66 const double vertex_tolerance =
67 tolerance *
std::max(cell->vertex(v).norm_square(), cell_measure);
69 if (cell->vertex(v).distance_square(bounding_box.vertex(v)) >
79template <
int dim,
int spacedim>
83 , volume_element(
numbers::signaling_nan<double>())
84 , quadrature_points(q.get_points())
89template <
int dim,
int spacedim>
101template <
int dim,
int spacedim>
110template <
int dim,
int spacedim>
115 Assert(dim == reference_cell.get_dimension(),
116 ExcMessage(
"The dimension of your mapping (" +
118 ") and the reference cell cell_type (" +
120 " ) do not agree."));
122 return reference_cell.is_hyper_cube();
127template <
int dim,
int spacedim>
146template <
int dim,
int spacedim>
147std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
151 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase> data_ptr =
152 std::make_unique<InternalData>(q);
165template <
int dim,
int spacedim>
166std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
173 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase> data_ptr =
175 ReferenceCells::get_hypercube<dim>(), quadrature[0]));
185 data.update_each = update_flags;
192template <
int dim,
int spacedim>
193std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
198 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase> data_ptr =
200 ReferenceCells::get_hypercube<dim>(), quadrature));
210 data.update_each = update_flags;
217template <
int dim,
int spacedim>
253template <
int dim,
int spacedim>
258 std::vector<
Point<dim>> &quadrature_points)
const
270template <
int dim,
int spacedim>
274 const unsigned int face_no,
276 std::vector<
Point<dim>> &quadrature_points)
const
283 ReferenceCells::get_hypercube<dim>(),
285 cell->face_orientation(face_no),
286 cell->face_flip(face_no),
287 cell->face_rotation(face_no),
288 quadrature_points.size());
297template <
int dim,
int spacedim>
301 const unsigned int face_no,
302 const unsigned int sub_no,
304 std::vector<
Point<dim>> &quadrature_points)
const
308 if (cell->face(face_no)->has_children())
316 ReferenceCells::get_hypercube<dim>(),
319 cell->face_orientation(face_no),
320 cell->face_flip(face_no),
321 cell->face_rotation(face_no),
322 quadrature_points.size(),
323 cell->subface_case(face_no));
331template <
int dim,
int spacedim>
337 std::vector<
Point<dim>> &quadrature_points)
const
343 for (
unsigned int i = 0; i < quadrature_points.size(); ++i)
345 quadrature_points[i] = start;
346 for (
unsigned int d = 0; d < dim; ++d)
347 quadrature_points[i](d) +=
354template <
int dim,
int spacedim>
357 const unsigned int face_no,
365 std::fill(normal_vectors.begin(),
366 normal_vectors.end(),
373template <
int dim,
int spacedim>
384 for (
unsigned int i = 0; i < output_data.
jacobian_grads.size(); ++i)
388 for (
unsigned int i = 0;
394 for (
unsigned int i = 0;
401 for (
unsigned int i = 0;
408 for (
unsigned int i = 0;
415 for (
unsigned int i = 0;
425template <
int dim,
int spacedim>
433 for (
unsigned int d = 1; d < dim; ++d)
441template <
int dim,
int spacedim>
453 for (
unsigned int i = 0; i < output_data.
jacobians.size(); ++i)
456 for (
unsigned int j = 0; j < dim; ++j)
463template <
int dim,
int spacedim>
478 for (
unsigned int j = 0; j < dim; ++j)
485template <
int dim,
int spacedim>
516 for (
unsigned int d = 1; d < dim; ++d)
520 for (
unsigned int i = 0; i < output_data.
JxW_values.size(); ++i)
529 return cell_similarity;
534template <
int dim,
int spacedim>
553 output_data.
initialize(unit_points.size(), update_flags);
556 data.update_each = update_flags;
558 std::vector<Point<dim>>(unit_points.begin(), unit_points.end());
572template <
int dim,
int spacedim>
576 const unsigned int face_no,
605 for (
unsigned int d = 0; d < dim; ++d)
610 for (
unsigned int i = 0; i < output_data.
JxW_values.size(); ++i)
611 output_data.
JxW_values[i] = J * quadrature[0].weight(i);
614 for (
unsigned int i = 0; i < output_data.
boundary_forms.size(); ++i)
625template <
int dim,
int spacedim>
629 const unsigned int face_no,
630 const unsigned int subface_no,
654 for (
unsigned int d = 0; d < dim; ++d)
664 const unsigned int n_subfaces =
665 cell->face(face_no)->has_children() ?
666 cell->face(face_no)->n_children() :
668 for (
unsigned int i = 0; i < output_data.
JxW_values.size(); ++i)
673 for (
unsigned int i = 0; i < output_data.
boundary_forms.size(); ++i)
684template <
int dim,
int spacedim>
710 for (
unsigned int i = 0; i < output_data.
normal_vectors.size(); ++i)
715 for (
unsigned int d = 0; d < dim; ++d)
719 normal /= normal.
norm();
724 for (
unsigned int i = 0; i < output_data.
JxW_values.size(); ++i)
730 double det_jacobian = 1.;
731 for (
unsigned int d = 0; d < dim; ++d)
734 invJTxNormal[d] = ref_space_normal[d] / data.
cell_extents[d];
737 det_jacobian * invJTxNormal.
norm() * quadrature.
weight(i);
748template <
int dim,
int spacedim>
761 switch (mapping_kind)
767 "update_covariant_transformation"));
769 for (
unsigned int i = 0; i < output.size(); ++i)
770 for (
unsigned int d = 0; d < dim; ++d)
779 "update_contravariant_transformation"));
781 for (
unsigned int i = 0; i < output.size(); ++i)
782 for (
unsigned int d = 0; d < dim; ++d)
790 "update_contravariant_transformation"));
793 "update_volume_elements"));
795 for (
unsigned int i = 0; i < output.size(); ++i)
796 for (
unsigned int d = 0; d < dim; ++d)
808template <
int dim,
int spacedim>
821 switch (mapping_kind)
827 "update_covariant_transformation"));
829 for (
unsigned int i = 0; i < output.size(); ++i)
830 for (
unsigned int d1 = 0; d1 < dim; ++d1)
831 for (
unsigned int d2 = 0; d2 < dim; ++d2)
832 output[i][d1][d2] = input[i][d1][d2] / data.
cell_extents[d2];
840 "update_contravariant_transformation"));
842 for (
unsigned int i = 0; i < output.size(); ++i)
843 for (
unsigned int d1 = 0; d1 < dim; ++d1)
844 for (
unsigned int d2 = 0; d2 < dim; ++d2)
845 output[i][d1][d2] = input[i][d1][d2] * data.
cell_extents[d2];
853 "update_covariant_transformation"));
855 for (
unsigned int i = 0; i < output.size(); ++i)
856 for (
unsigned int d1 = 0; d1 < dim; ++d1)
857 for (
unsigned int d2 = 0; d2 < dim; ++d2)
858 output[i][d1][d2] = input[i][d1][d2] / data.
cell_extents[d2] /
867 "update_contravariant_transformation"));
869 for (
unsigned int i = 0; i < output.size(); ++i)
870 for (
unsigned int d1 = 0; d1 < dim; ++d1)
871 for (
unsigned int d2 = 0; d2 < dim; ++d2)
872 output[i][d1][d2] = input[i][d1][d2] * data.
cell_extents[d2] /
881 "update_contravariant_transformation"));
884 "update_volume_elements"));
886 for (
unsigned int i = 0; i < output.size(); ++i)
887 for (
unsigned int d1 = 0; d1 < dim; ++d1)
888 for (
unsigned int d2 = 0; d2 < dim; ++d2)
889 output[i][d1][d2] = input[i][d1][d2] * data.
cell_extents[d2] /
898 "update_contravariant_transformation"));
901 "update_volume_elements"));
903 for (
unsigned int i = 0; i < output.size(); ++i)
904 for (
unsigned int d1 = 0; d1 < dim; ++d1)
905 for (
unsigned int d2 = 0; d2 < dim; ++d2)
906 output[i][d1][d2] = input[i][d1][d2] * data.
cell_extents[d2] /
918template <
int dim,
int spacedim>
931 switch (mapping_kind)
937 "update_covariant_transformation"));
939 for (
unsigned int i = 0; i < output.size(); ++i)
940 for (
unsigned int d1 = 0; d1 < dim; ++d1)
941 for (
unsigned int d2 = 0; d2 < dim; ++d2)
942 output[i][d1][d2] = input[i][d1][d2] / data.
cell_extents[d2];
950 "update_contravariant_transformation"));
952 for (
unsigned int i = 0; i < output.size(); ++i)
953 for (
unsigned int d1 = 0; d1 < dim; ++d1)
954 for (
unsigned int d2 = 0; d2 < dim; ++d2)
955 output[i][d1][d2] = input[i][d1][d2] * data.
cell_extents[d2];
963 "update_covariant_transformation"));
965 for (
unsigned int i = 0; i < output.size(); ++i)
966 for (
unsigned int d1 = 0; d1 < dim; ++d1)
967 for (
unsigned int d2 = 0; d2 < dim; ++d2)
968 output[i][d1][d2] = input[i][d1][d2] / data.
cell_extents[d2] /
977 "update_contravariant_transformation"));
979 for (
unsigned int i = 0; i < output.size(); ++i)
980 for (
unsigned int d1 = 0; d1 < dim; ++d1)
981 for (
unsigned int d2 = 0; d2 < dim; ++d2)
982 output[i][d1][d2] = input[i][d1][d2] * data.
cell_extents[d2] /
991 "update_contravariant_transformation"));
994 "update_volume_elements"));
996 for (
unsigned int i = 0; i < output.size(); ++i)
997 for (
unsigned int d1 = 0; d1 < dim; ++d1)
998 for (
unsigned int d2 = 0; d2 < dim; ++d2)
999 output[i][d1][d2] = input[i][d1][d2] * data.
cell_extents[d2] /
1008 "update_contravariant_transformation"));
1011 "update_volume_elements"));
1013 for (
unsigned int i = 0; i < output.size(); ++i)
1014 for (
unsigned int d1 = 0; d1 < dim; ++d1)
1015 for (
unsigned int d2 = 0; d2 < dim; ++d2)
1016 output[i][d1][d2] = input[i][d1][d2] * data.
cell_extents[d2] /
1028template <
int dim,
int spacedim>
1041 switch (mapping_kind)
1047 "update_covariant_transformation"));
1049 for (
unsigned int q = 0; q < output.size(); ++q)
1050 for (
unsigned int i = 0; i < spacedim; ++i)
1051 for (
unsigned int j = 0; j < spacedim; ++j)
1052 for (
unsigned int k = 0; k < spacedim; ++k)
1054 output[q][i][j][k] = input[q][i][j][k] /
1067template <
int dim,
int spacedim>
1080 switch (mapping_kind)
1086 "update_covariant_transformation"));
1089 "update_contravariant_transformation"));
1091 for (
unsigned int q = 0; q < output.size(); ++q)
1092 for (
unsigned int i = 0; i < spacedim; ++i)
1093 for (
unsigned int j = 0; j < spacedim; ++j)
1094 for (
unsigned int k = 0; k < spacedim; ++k)
1096 output[q][i][j][k] =
1107 "update_covariant_transformation"));
1109 for (
unsigned int q = 0; q < output.size(); ++q)
1110 for (
unsigned int i = 0; i < spacedim; ++i)
1111 for (
unsigned int j = 0; j < spacedim; ++j)
1112 for (
unsigned int k = 0; k < spacedim; ++k)
1114 output[q][i][j][k] =
1126 "update_covariant_transformation"));
1129 "update_contravariant_transformation"));
1132 "update_volume_elements"));
1134 for (
unsigned int q = 0; q < output.size(); ++q)
1135 for (
unsigned int i = 0; i < spacedim; ++i)
1136 for (
unsigned int j = 0; j < spacedim; ++j)
1137 for (
unsigned int k = 0; k < spacedim; ++k)
1139 output[q][i][j][k] =
1155template <
int dim,
int spacedim>
1168 length[0] = cell->vertex(1)(0) - start(0);
1171 length[0] = cell->vertex(1)(0) - start(0);
1172 length[1] = cell->vertex(2)(1) - start(1);
1175 length[0] = cell->vertex(1)(0) - start(0);
1176 length[1] = cell->vertex(2)(1) - start(1);
1177 length[2] = cell->vertex(4)(2) - start(2);
1184 for (
unsigned int d = 0; d < dim; ++d)
1185 p_real(d) += length[d] * p(d);
1192template <
int dim,
int spacedim>
1200 if (dim != spacedim)
1209 real(0) /= cell->vertex(1)(0) - start(0);
1212 real(0) /= cell->vertex(1)(0) - start(0);
1213 real(1) /= cell->vertex(2)(1) - start(1);
1216 real(0) /= cell->vertex(1)(0) - start(0);
1217 real(1) /= cell->vertex(2)(1) - start(1);
1218 real(2) /= cell->vertex(4)(2) - start(2);
1228template <
int dim,
int spacedim>
1229std::unique_ptr<Mapping<dim, spacedim>>
1232 return std::make_unique<MappingCartesian<dim, spacedim>>(*this);
1238#include "mapping_cartesian.inst"
std::vector< Point< dim > > quadrature_points
Tensor< 1, dim > cell_extents
virtual std::size_t memory_consumption() const override
void fill_mapping_data_for_generic_points(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const ArrayView< const Point< dim > > &unit_points, const UpdateFlags update_flags, ::internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &output_data) const
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
void maybe_update_volume_elements(const InternalData &data) const
virtual std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBase > get_face_data(const UpdateFlags flags, const hp::QCollection< dim - 1 > &quadrature) const override
virtual UpdateFlags requires_update_flags(const UpdateFlags update_flags) const override
virtual std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBase > get_subface_data(const UpdateFlags flags, const Quadrature< dim - 1 > &quadrature) const override
void update_cell_extents(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const CellSimilarity::Similarity cell_similarity, const InternalData &data) const
void maybe_update_jacobians(const InternalData &data, const CellSimilarity::Similarity cell_similarity, internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &output_data) const
void maybe_update_subface_quadrature_points(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const unsigned int sub_no, const InternalData &data, std::vector< Point< dim > > &quadrature_points) const
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 void fill_fe_immersed_surface_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const NonMatching::ImmersedSurfaceQuadrature< dim > &quadrature, const typename Mapping< dim, spacedim >::InternalDataBase &internal_data, ::internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &output_data) const override
void maybe_update_face_quadrature_points(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const InternalData &data, std::vector< Point< dim > > &quadrature_points) const
virtual bool is_compatible_with(const ReferenceCell &reference_cell) const override
void maybe_update_cell_quadrature_points(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const InternalData &data, std::vector< Point< dim > > &quadrature_points) const
virtual bool preserves_vertex_locations() const override
virtual Point< spacedim > transform_unit_to_real_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< dim > &p) const override
virtual std::unique_ptr< Mapping< dim, spacedim > > clone() const override
virtual Point< dim > transform_real_to_unit_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< spacedim > &p) const override
void transform_quadrature_points(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const InternalData &data, const typename QProjector< dim >::DataSetDescriptor &offset, std::vector< Point< dim > > &quadrature_points) const
void maybe_update_jacobian_derivatives(const InternalData &data, const CellSimilarity::Similarity cell_similarity, internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &output_data) const
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
void maybe_update_normal_vectors(const unsigned int face_no, const InternalData &data, std::vector< Tensor< 1, dim > > &normal_vectors) const
virtual std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBase > get_data(const UpdateFlags, const Quadrature< dim > &quadrature) const override
void maybe_update_inverse_jacobians(const InternalData &data, const CellSimilarity::Similarity cell_similarity, internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &output_data) 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::FEValuesImplementation::MappingRelatedData< dim, spacedim > &output_data) const override
Abstract base class for mapping classes.
const Tensor< 1, spacedim > & normal_vector(const unsigned int i) const
static DataSetDescriptor cell()
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)
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)
double weight(const unsigned int i) 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_3rd_derivatives
@ 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_default
No update.
@ update_jacobian_pushed_forward_3rd_derivatives
@ update_boundary_forms
Outer normal vector, not normalized.
@ update_jacobian_2nd_derivatives
static ::ExceptionBase & ExcCellNotCartesian()
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
#define AssertIndexRange(index, range)
#define DeclExceptionMsg(Exception, defaulttext)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcMessage(std::string arg1)
@ mapping_covariant_gradient
@ mapping_contravariant_hessian
@ mapping_covariant_hessian
@ mapping_contravariant_gradient
bool is_cartesian(const CellType &cell)
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
std::string to_string(const number value, const unsigned int digits=numbers::invalid_unsigned_int)
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)