Reference documentation for deal.II version 9.6.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
mapping_q.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2001 - 2024 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15#ifndef dealii_mapping_q_h
16#define dealii_mapping_q_h
17
18
19#include <deal.II/base/config.h>
20
24#include <deal.II/base/table.h>
26
27#include <deal.II/fe/mapping.h>
28
30
32
33#include <array>
34#include <cmath>
35
37
38#ifndef DOXYGEN
39template <int, int>
40class MappingQCache;
41#endif
42
108template <int dim, int spacedim = dim>
109class MappingQ : public Mapping<dim, spacedim>
110{
111public:
117 MappingQ(const unsigned int polynomial_degree);
118
125 MappingQ(const unsigned int polynomial_degree,
126 const bool use_mapping_q_on_all_cells);
127
131 MappingQ(const MappingQ<dim, spacedim> &mapping);
132
133 // for documentation, see the Mapping base class
134 virtual std::unique_ptr<Mapping<dim, spacedim>>
135 clone() const override;
136
141 unsigned int
142 get_degree() const;
143
148 virtual bool
150
151 // for documentation, see the Mapping base class
154 &cell) const override;
155
156 virtual bool
157 is_compatible_with(const ReferenceCell &reference_cell) const override;
158
164 // for documentation, see the Mapping base class
165 virtual Point<spacedim>
168 const Point<dim> &p) const override;
169
170 // for documentation, see the Mapping base class
171 virtual Point<dim>
174 const Point<spacedim> &p) const override;
175
176 // for documentation, see the Mapping base class
177 virtual void
180 const ArrayView<const Point<spacedim>> &real_points,
181 const ArrayView<Point<dim>> &unit_points) const override;
182
192 // for documentation, see the Mapping base class
193 virtual void
194 transform(const ArrayView<const Tensor<1, dim>> &input,
195 const MappingKind kind,
197 const ArrayView<Tensor<1, spacedim>> &output) const override;
198
199 // for documentation, see the Mapping base class
200 virtual void
202 const MappingKind kind,
204 const ArrayView<Tensor<2, spacedim>> &output) const override;
205
206 // for documentation, see the Mapping base class
207 virtual void
208 transform(const ArrayView<const Tensor<2, dim>> &input,
209 const MappingKind kind,
211 const ArrayView<Tensor<2, spacedim>> &output) const override;
212
213 // for documentation, see the Mapping base class
214 virtual void
216 const MappingKind kind,
218 const ArrayView<Tensor<3, spacedim>> &output) const override;
219
220 // for documentation, see the Mapping base class
221 virtual void
222 transform(const ArrayView<const Tensor<3, dim>> &input,
223 const MappingKind kind,
225 const ArrayView<Tensor<3, spacedim>> &output) const override;
226
248 void
251 const ArrayView<const Point<dim>> &unit_points,
252 const UpdateFlags update_flags,
254 &output_data) const;
255
278 void
281 const unsigned int face_number,
282 const Quadrature<dim - 1> &face_quadrature,
283 const typename Mapping<dim, spacedim>::InternalDataBase &internal_data,
285 &output_data) const;
286
303 class InternalData : public Mapping<dim, spacedim>::InternalDataBase
304 {
305 public:
310 InternalData(const unsigned int polynomial_degree);
311
312 // Documentation see Mapping::InternalDataBase.
313 virtual void
314 reinit(const UpdateFlags update_flags,
315 const Quadrature<dim> &quadrature) override;
316
322 void
323 initialize_face(const UpdateFlags update_flags,
324 const Quadrature<dim> &quadrature,
325 const unsigned int n_original_q_points);
326
330 virtual std::size_t
331 memory_consumption() const override;
332
338 std::vector<Point<dim>> quadrature_points;
339
353 std::array<std::vector<Tensor<1, dim>>,
356
361 const unsigned int polynomial_degree;
362
372 const unsigned int n_shape_functions;
373
374 /*
375 * The default line support points. Is used in when the shape function
376 * values are computed.
377 *
378 * The number of quadrature points depends on the degree of this
379 * class, and it matches the number of degrees of freedom of an
380 * FE_Q<1>(this->degree).
381 */
383
399 VectorizedArray<double,
401 (dim <= 2 ? 2 : 4))>;
402
409
415
420
424 mutable std::vector<AlignedVector<Tensor<1, spacedim>>> aux;
425
430 mutable std::vector<Point<spacedim>> mapping_support_points;
431
437
443
451 };
452
453protected:
454 // documentation can be found in Mapping::requires_update_flags()
455 virtual UpdateFlags
456 requires_update_flags(const UpdateFlags update_flags) const override;
457
458 // documentation can be found in Mapping::get_data()
459 virtual std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
460 get_data(const UpdateFlags, const Quadrature<dim> &quadrature) const override;
461
462 using Mapping<dim, spacedim>::get_face_data;
463
464 // documentation can be found in Mapping::get_face_data()
465 virtual std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
466 get_face_data(const UpdateFlags flags,
467 const hp::QCollection<dim - 1> &quadrature) const override;
468
469 // documentation can be found in Mapping::get_subface_data()
470 virtual std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
471 get_subface_data(const UpdateFlags flags,
472 const Quadrature<dim - 1> &quadrature) const override;
473
474 // documentation can be found in Mapping::fill_fe_values()
478 const CellSimilarity::Similarity cell_similarity,
479 const Quadrature<dim> &quadrature,
480 const typename Mapping<dim, spacedim>::InternalDataBase &internal_data,
482 &output_data) const override;
483
484 using Mapping<dim, spacedim>::fill_fe_face_values;
485
486 // documentation can be found in Mapping::fill_fe_face_values()
487 virtual void
490 const unsigned int face_no,
491 const hp::QCollection<dim - 1> &quadrature,
492 const typename Mapping<dim, spacedim>::InternalDataBase &internal_data,
494 &output_data) const override;
495
496 // documentation can be found in Mapping::fill_fe_subface_values()
497 virtual void
500 const unsigned int face_no,
501 const unsigned int subface_no,
502 const Quadrature<dim - 1> &quadrature,
503 const typename Mapping<dim, spacedim>::InternalDataBase &internal_data,
505 &output_data) const override;
506
507 // documentation can be found in Mapping::fill_fe_immersed_surface_values()
508 virtual void
512 const typename Mapping<dim, spacedim>::InternalDataBase &internal_data,
514 &output_data) const override;
515
524 const unsigned int polynomial_degree;
525
526 /*
527 * The default line support points. These are used when computing the
528 * location in real space of the support points on lines and quads, which
529 * are needed by the Manifold<dim,spacedim> class.
530 *
531 * The number of points depends on the degree of this class, and it matches
532 * the number of degrees of freedom of an FE_Q<1>(this->degree).
533 */
534 const std::vector<Point<1>> line_support_points;
535
536 /*
537 * The one-dimensional polynomials defined as Lagrange polynomials from the
538 * line support points. These are used for point evaluations and match the
539 * polynomial space of an FE_Q<1>(this->degree).
540 */
541 const std::vector<Polynomials::Polynomial<double>> polynomials_1d;
542
543 /*
544 * The numbering from the lexicographic to the hierarchical ordering used
545 * when expanding the tensor product with the mapping support points (which
546 * come in hierarchical numbers).
547 */
548 const std::vector<unsigned int> renumber_lexicographic_to_hierarchic;
549
550 /*
551 * The support points in reference coordinates. These are used for
552 * constructing approximations of the output of
553 * compute_mapping_support_points() when evaluating the mapping on the fly,
554 * rather than going through the FEValues interface provided by
555 * InternalData.
556 *
557 * The number of points depends on the degree of this class, and it matches
558 * the number of degrees of freedom of an FE_Q<dim>(this->degree).
559 */
560 const std::vector<Point<dim>> unit_cell_support_points;
561
581 const std::vector<Table<2, double>>
583
597
627 virtual std::vector<Point<spacedim>>
629 const typename Triangulation<dim, spacedim>::cell_iterator &cell) const;
630
638 const Point<spacedim> &p,
639 const Point<dim> &initial_p_unit) const;
640
654 virtual void
657 std::vector<Point<spacedim>> &a) const;
658
673 virtual void
676 std::vector<Point<spacedim>> &a) const;
677
678 // Make MappingQCache a friend since it needs to call the
679 // compute_mapping_support_points() function.
680 template <int, int>
681 friend class MappingQCache;
682};
683
684
685
691template <int dim, int spacedim = dim>
693
697/*----------------------------------------------------------------------*/
698
699#ifndef DOXYGEN
700
701template <int dim, int spacedim>
702inline bool
704{
705 return true;
706}
707
708#endif // DOXYGEN
709
710/* -------------- declaration of explicit specializations ------------- */
711
712
714
715#endif
QGaussLobatto< 1 > line_support_points
Definition mapping_q.h:382
Triangulation< dim, spacedim >::cell_iterator cell_of_current_support_points
Definition mapping_q.h:436
virtual std::size_t memory_consumption() const override
Definition mapping_q.cc:63
std::vector< Point< spacedim > > mapping_support_points
Definition mapping_q.h:430
const unsigned int polynomial_degree
Definition mapping_q.h:361
std::array< std::vector< Tensor< 1, dim > >, GeometryInfo< dim >::faces_per_cell *(dim - 1)> unit_tangentials
Definition mapping_q.h:355
internal::MatrixFreeFunctions::ShapeInfo< double > shape_info
Definition mapping_q.h:408
virtual void reinit(const UpdateFlags update_flags, const Quadrature< dim > &quadrature) override
Definition mapping_q.cc:81
internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > * output_data
Definition mapping_q.h:450
std::vector< AlignedVector< Tensor< 1, spacedim > > > aux
Definition mapping_q.h:424
void initialize_face(const UpdateFlags update_flags, const Quadrature< dim > &quadrature, const unsigned int n_original_q_points)
Definition mapping_q.cc:159
InternalData(const unsigned int polynomial_degree)
Definition mapping_q.cc:50
AlignedVector< double > volume_elements
Definition mapping_q.h:442
std::vector< Point< dim > > quadrature_points
Definition mapping_q.h:338
const unsigned int n_shape_functions
Definition mapping_q.h:372
AlignedVector< VectorizedArrayType > scratch
Definition mapping_q.h:414
const std::vector< unsigned int > renumber_lexicographic_to_hierarchic
Definition mapping_q.h:548
const Table< 2, double > support_point_weights_cell
Definition mapping_q.h:596
virtual std::vector< Point< spacedim > > compute_mapping_support_points(const typename Triangulation< dim, spacedim >::cell_iterator &cell) const
virtual std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBase > get_data(const UpdateFlags, const Quadrature< dim > &quadrature) const override
Definition mapping_q.cc:781
void fill_mapping_data_for_face_quadrature(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_number, const Quadrature< dim - 1 > &face_quadrature, const typename Mapping< dim, spacedim >::InternalDataBase &internal_data, internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &output_data) const
virtual BoundingBox< spacedim > get_bounding_box(const typename Triangulation< dim, spacedim >::cell_iterator &cell) const override
virtual std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBase > get_subface_data(const UpdateFlags flags, const Quadrature< dim - 1 > &quadrature) const override
Definition mapping_q.cc:815
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 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 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
Definition mapping_q.cc:834
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
const unsigned int polynomial_degree
Definition mapping_q.h:524
virtual bool preserves_vertex_locations() const override
virtual void transform_points_real_to_unit_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const ArrayView< const Point< spacedim > > &real_points, const ArrayView< Point< dim > > &unit_points) const override
Definition mapping_q.cc:633
virtual std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBase > get_face_data(const UpdateFlags flags, const hp::QCollection< dim - 1 > &quadrature) const override
Definition mapping_q.cc:794
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
Definition mapping_q.cc:328
const std::vector< Table< 2, double > > support_point_weights_perimeter_to_interior
Definition mapping_q.h:582
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
const std::vector< Point< 1 > > line_support_points
Definition mapping_q.h:534
virtual Point< spacedim > transform_unit_to_real_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< dim > &p) const override
Definition mapping_q.cc:287
const std::vector< Polynomials::Polynomial< double > > polynomials_1d
Definition mapping_q.h:541
virtual std::unique_ptr< Mapping< dim, spacedim > > clone() const override
Definition mapping_q.cc:269
const std::vector< Point< dim > > unit_cell_support_points
Definition mapping_q.h:560
virtual Point< dim > transform_real_to_unit_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< spacedim > &p) const override
Definition mapping_q.cc:513
MappingQ(const unsigned int polynomial_degree)
Definition mapping_q.cc:217
virtual void add_line_support_points(const typename Triangulation< dim, spacedim >::cell_iterator &cell, std::vector< Point< spacedim > > &a) const
virtual void add_quad_support_points(const typename Triangulation< dim, spacedim >::cell_iterator &cell, std::vector< Point< spacedim > > &a) const
virtual UpdateFlags requires_update_flags(const UpdateFlags update_flags) const override
Definition mapping_q.cc:725
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
virtual bool is_compatible_with(const ReferenceCell &reference_cell) const override
unsigned int get_degree() const
Definition mapping_q.cc:278
Abstract base class for mapping classes.
Definition mapping.h:318
Definition point.h:111
#define DEAL_II_DEPRECATED
Definition config.h:207
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:503
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:504
UpdateFlags
MappingKind
Definition mapping.h:79
::VectorizedArray< Number, width > min(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)