Reference documentation for deal.II version GIT relicensing-35-gbe64a602e6 2024-03-01 21:20:01+00:00
\(\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 - 2023 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
320 void
321 initialize(const UpdateFlags update_flags,
322 const Quadrature<dim> &quadrature,
323 const unsigned int n_original_q_points);
324
330 void
331 initialize_face(const UpdateFlags update_flags,
332 const Quadrature<dim> &quadrature,
333 const unsigned int n_original_q_points);
334
338 virtual std::size_t
339 memory_consumption() const override;
340
346 std::vector<Point<dim>> quadrature_points;
347
361 std::array<std::vector<Tensor<1, dim>>,
364
369 const unsigned int polynomial_degree;
370
380 const unsigned int n_shape_functions;
381
382 /*
383 * The default line support points. Is used in when the shape function
384 * values are computed.
385 *
386 * The number of quadrature points depends on the degree of this
387 * class, and it matches the number of degrees of freedom of an
388 * FE_Q<1>(this->degree).
389 */
391
407 VectorizedArray<double,
408 std::min<std::size_t>(VectorizedArray<double>::size(),
409 (dim <= 2 ? 2 : 4))>;
410
417
423
428
432 mutable std::vector<AlignedVector<Tensor<1, spacedim>>> aux;
433
438 mutable std::vector<Point<spacedim>> mapping_support_points;
439
445
451
459 };
460
461protected:
462 // documentation can be found in Mapping::requires_update_flags()
463 virtual UpdateFlags
464 requires_update_flags(const UpdateFlags update_flags) const override;
465
466 // documentation can be found in Mapping::get_data()
467 virtual std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
468 get_data(const UpdateFlags, const Quadrature<dim> &quadrature) const override;
469
470 using Mapping<dim, spacedim>::get_face_data;
471
472 // documentation can be found in Mapping::get_face_data()
473 virtual std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
474 get_face_data(const UpdateFlags flags,
475 const hp::QCollection<dim - 1> &quadrature) const override;
476
477 // documentation can be found in Mapping::get_subface_data()
478 virtual std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
479 get_subface_data(const UpdateFlags flags,
480 const Quadrature<dim - 1> &quadrature) const override;
481
482 // documentation can be found in Mapping::fill_fe_values()
486 const CellSimilarity::Similarity cell_similarity,
487 const Quadrature<dim> &quadrature,
488 const typename Mapping<dim, spacedim>::InternalDataBase &internal_data,
490 &output_data) const override;
491
492 using Mapping<dim, spacedim>::fill_fe_face_values;
493
494 // documentation can be found in Mapping::fill_fe_face_values()
495 virtual void
498 const unsigned int face_no,
499 const hp::QCollection<dim - 1> &quadrature,
500 const typename Mapping<dim, spacedim>::InternalDataBase &internal_data,
502 &output_data) const override;
503
504 // documentation can be found in Mapping::fill_fe_subface_values()
505 virtual void
508 const unsigned int face_no,
509 const unsigned int subface_no,
510 const Quadrature<dim - 1> &quadrature,
511 const typename Mapping<dim, spacedim>::InternalDataBase &internal_data,
513 &output_data) const override;
514
515 // documentation can be found in Mapping::fill_fe_immersed_surface_values()
516 virtual void
520 const typename Mapping<dim, spacedim>::InternalDataBase &internal_data,
522 &output_data) const override;
523
532 const unsigned int polynomial_degree;
533
534 /*
535 * The default line support points. These are used when computing the
536 * location in real space of the support points on lines and quads, which
537 * are needed by the Manifold<dim,spacedim> class.
538 *
539 * The number of points depends on the degree of this class, and it matches
540 * the number of degrees of freedom of an FE_Q<1>(this->degree).
541 */
542 const std::vector<Point<1>> line_support_points;
543
544 /*
545 * The one-dimensional polynomials defined as Lagrange polynomials from the
546 * line support points. These are used for point evaluations and match the
547 * polynomial space of an FE_Q<1>(this->degree).
548 */
549 const std::vector<Polynomials::Polynomial<double>> polynomials_1d;
550
551 /*
552 * The numbering from the lexicographic to the hierarchical ordering used
553 * when expanding the tensor product with the mapping support points (which
554 * come in hierarchical numbers).
555 */
556 const std::vector<unsigned int> renumber_lexicographic_to_hierarchic;
557
558 /*
559 * The support points in reference coordinates. These are used for
560 * constructing approximations of the output of
561 * compute_mapping_support_points() when evaluating the mapping on the fly,
562 * rather than going through the FEValues interface provided by
563 * InternalData.
564 *
565 * The number of points depends on the degree of this class, and it matches
566 * the number of degrees of freedom of an FE_Q<dim>(this->degree).
567 */
568 const std::vector<Point<dim>> unit_cell_support_points;
569
589 const std::vector<Table<2, double>>
591
605
635 virtual std::vector<Point<spacedim>>
637 const typename Triangulation<dim, spacedim>::cell_iterator &cell) const;
638
646 const Point<spacedim> &p,
647 const Point<dim> &initial_p_unit) const;
648
662 virtual void
665 std::vector<Point<spacedim>> &a) const;
666
681 virtual void
684 std::vector<Point<spacedim>> &a) const;
685
686 // Make MappingQCache a friend since it needs to call the
687 // compute_mapping_support_points() function.
688 template <int, int>
689 friend class MappingQCache;
690};
691
692
693
699template <int dim, int spacedim = dim>
701
705/*----------------------------------------------------------------------*/
706
707#ifndef DOXYGEN
708
709template <int dim, int spacedim>
710inline bool
712{
713 return true;
714}
715
716#endif // DOXYGEN
717
718/* -------------- declaration of explicit specializations ------------- */
719
720
722
723#endif
QGaussLobatto< 1 > line_support_points
Definition mapping_q.h:390
Triangulation< dim, spacedim >::cell_iterator cell_of_current_support_points
Definition mapping_q.h:444
virtual std::size_t memory_consumption() const override
Definition mapping_q.cc:63
std::vector< Point< spacedim > > mapping_support_points
Definition mapping_q.h:438
const unsigned int polynomial_degree
Definition mapping_q.h:369
std::array< std::vector< Tensor< 1, dim > >, GeometryInfo< dim >::faces_per_cell *(dim - 1)> unit_tangentials
Definition mapping_q.h:363
internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > * output_data
Definition mapping_q.h:458
std::vector< AlignedVector< Tensor< 1, spacedim > > > aux
Definition mapping_q.h:432
void initialize_face(const UpdateFlags update_flags, const Quadrature< dim > &quadrature, const unsigned int n_original_q_points)
Definition mapping_q.cc:161
AlignedVector< double > volume_elements
Definition mapping_q.h:450
void initialize(const UpdateFlags update_flags, const Quadrature< dim > &quadrature, const unsigned int n_original_q_points)
Definition mapping_q.cc:81
std::vector< Point< dim > > quadrature_points
Definition mapping_q.h:346
const unsigned int n_shape_functions
Definition mapping_q.h:380
internal::MatrixFreeFunctions::ShapeInfo< VectorizedArrayType > shape_info
Definition mapping_q.h:416
AlignedVector< VectorizedArrayType > scratch
Definition mapping_q.h:422
const std::vector< unsigned int > renumber_lexicographic_to_hierarchic
Definition mapping_q.h:556
const Table< 2, double > support_point_weights_cell
Definition mapping_q.h:604
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:730
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:766
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:785
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:532
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:592
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:745
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:323
const std::vector< Table< 2, double > > support_point_weights_perimeter_to_interior
Definition mapping_q.h:590
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:542
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:289
const std::vector< Polynomials::Polynomial< double > > polynomials_1d
Definition mapping_q.h:549
virtual std::unique_ptr< Mapping< dim, spacedim > > clone() const override
Definition mapping_q.cc:271
const std::vector< Point< dim > > unit_cell_support_points
Definition mapping_q.h:568
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:472
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:674
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:280
Abstract base class for mapping classes.
Definition mapping.h:316
Definition point.h:111
#define DEAL_II_DEPRECATED
Definition config.h:207
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:502
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:503
UpdateFlags
MappingKind
Definition mapping.h:77