Reference documentation for deal.II version 9.5.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// Copyright (C) 2000 - 2023 by the deal.II authors
4//
5// This file is part of the deal.II library.
6//
7// The deal.II library is free software; you can use it, redistribute
8// it, and/or modify it under the terms of the GNU Lesser General
9// Public License as published by the Free Software Foundation; either
10// version 2.1 of the License, or (at your option) any later version.
11// The full text of the license can be found in the file LICENSE.md at
12// the top level directory of deal.II.
13//
14// ---------------------------------------------------------------------
15
16#ifndef dealii_mapping_q_h
17#define dealii_mapping_q_h
18
19
20#include <deal.II/base/config.h>
21
25#include <deal.II/base/table.h>
27
28#include <deal.II/fe/mapping.h>
29
31
34
35#include <array>
36#include <cmath>
37
39
40#ifndef DOXYGEN
41template <int, int>
42class MappingQCache;
43#endif
44
110template <int dim, int spacedim = dim>
111class MappingQ : public Mapping<dim, spacedim>
112{
113public:
119 MappingQ(const unsigned int polynomial_degree);
120
127 MappingQ(const unsigned int polynomial_degree,
128 const bool use_mapping_q_on_all_cells);
129
133 MappingQ(const MappingQ<dim, spacedim> &mapping);
134
135 // for documentation, see the Mapping base class
136 virtual std::unique_ptr<Mapping<dim, spacedim>>
137 clone() const override;
138
143 unsigned int
144 get_degree() const;
145
150 virtual bool
152
153 // for documentation, see the Mapping base class
156 &cell) const override;
157
158 virtual bool
159 is_compatible_with(const ReferenceCell &reference_cell) const override;
160
166 // for documentation, see the Mapping base class
167 virtual Point<spacedim>
170 const Point<dim> &p) const override;
171
172 // for documentation, see the Mapping base class
173 virtual Point<dim>
176 const Point<spacedim> &p) const override;
177
178 // for documentation, see the Mapping base class
179 virtual void
182 const ArrayView<const Point<spacedim>> & real_points,
183 const ArrayView<Point<dim>> &unit_points) const override;
184
194 // for documentation, see the Mapping base class
195 virtual void
196 transform(const ArrayView<const Tensor<1, dim>> & input,
197 const MappingKind kind,
199 const ArrayView<Tensor<1, spacedim>> &output) const override;
200
201 // for documentation, see the Mapping base class
202 virtual void
204 const MappingKind kind,
206 const ArrayView<Tensor<2, spacedim>> &output) const override;
207
208 // for documentation, see the Mapping base class
209 virtual void
210 transform(const ArrayView<const Tensor<2, dim>> & input,
211 const MappingKind kind,
213 const ArrayView<Tensor<2, spacedim>> &output) const override;
214
215 // for documentation, see the Mapping base class
216 virtual void
218 const MappingKind kind,
220 const ArrayView<Tensor<3, spacedim>> &output) const override;
221
222 // for documentation, see the Mapping base class
223 virtual void
224 transform(const ArrayView<const Tensor<3, dim>> & input,
225 const MappingKind kind,
227 const ArrayView<Tensor<3, spacedim>> &output) const override;
228
250 void
253 const ArrayView<const Point<dim>> & unit_points,
254 const UpdateFlags update_flags,
256 &output_data) const;
257
280 void
283 const unsigned int face_number,
284 const Quadrature<dim - 1> & face_quadrature,
285 const typename Mapping<dim, spacedim>::InternalDataBase & internal_data,
287 &output_data) const;
288
305 class InternalData : public Mapping<dim, spacedim>::InternalDataBase
306 {
307 public:
312 InternalData(const unsigned int polynomial_degree);
313
322 void
323 initialize(const UpdateFlags update_flags,
324 const Quadrature<dim> &quadrature,
325 const unsigned int n_original_q_points);
326
332 void
333 initialize_face(const UpdateFlags update_flags,
334 const Quadrature<dim> &quadrature,
335 const unsigned int n_original_q_points);
336
340 virtual std::size_t
341 memory_consumption() const override;
342
348 std::vector<Point<dim>> quadrature_points;
349
363 std::array<std::vector<Tensor<1, dim>>,
366
371 const unsigned int polynomial_degree;
372
382 const unsigned int n_shape_functions;
383
384 /*
385 * The default line support points. Is used in when the shape function
386 * values are computed.
387 *
388 * The number of quadrature points depends on the degree of this
389 * class, and it matches the number of degrees of freedom of an
390 * FE_Q<1>(this->degree).
391 */
393
409 VectorizedArray<double,
410 std::min<std::size_t>(VectorizedArray<double>::size(),
411 (dim <= 2 ? 2 : 4))>;
412
419
425
430
434 mutable std::vector<AlignedVector<Tensor<1, spacedim>>> aux;
435
440 mutable std::vector<Point<spacedim>> mapping_support_points;
441
447
453
461 };
462
463protected:
464 // documentation can be found in Mapping::requires_update_flags()
465 virtual UpdateFlags
466 requires_update_flags(const UpdateFlags update_flags) const override;
467
468 // documentation can be found in Mapping::get_data()
469 virtual std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
470 get_data(const UpdateFlags, const Quadrature<dim> &quadrature) const override;
471
472 using Mapping<dim, spacedim>::get_face_data;
473
474 // documentation can be found in Mapping::get_face_data()
475 virtual std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
476 get_face_data(const UpdateFlags flags,
477 const hp::QCollection<dim - 1> &quadrature) const override;
478
479 // documentation can be found in Mapping::get_subface_data()
480 virtual std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
481 get_subface_data(const UpdateFlags flags,
482 const Quadrature<dim - 1> &quadrature) const override;
483
484 // documentation can be found in Mapping::fill_fe_values()
488 const CellSimilarity::Similarity cell_similarity,
489 const Quadrature<dim> & quadrature,
490 const typename Mapping<dim, spacedim>::InternalDataBase & internal_data,
492 &output_data) const override;
493
494 using Mapping<dim, spacedim>::fill_fe_face_values;
495
496 // documentation can be found in Mapping::fill_fe_face_values()
497 virtual void
500 const unsigned int face_no,
501 const hp::QCollection<dim - 1> & quadrature,
502 const typename Mapping<dim, spacedim>::InternalDataBase & internal_data,
504 &output_data) const override;
505
506 // documentation can be found in Mapping::fill_fe_subface_values()
507 virtual void
510 const unsigned int face_no,
511 const unsigned int subface_no,
512 const Quadrature<dim - 1> & quadrature,
513 const typename Mapping<dim, spacedim>::InternalDataBase & internal_data,
515 &output_data) const override;
516
517 // documentation can be found in Mapping::fill_fe_immersed_surface_values()
518 virtual void
522 const typename Mapping<dim, spacedim>::InternalDataBase & internal_data,
524 &output_data) const override;
525
534 const unsigned int polynomial_degree;
535
536 /*
537 * The default line support points. These are used when computing the
538 * location in real space of the support points on lines and quads, which
539 * are needed by the Manifold<dim,spacedim> class.
540 *
541 * The number of points depends on the degree of this class, and it matches
542 * the number of degrees of freedom of an FE_Q<1>(this->degree).
543 */
544 const std::vector<Point<1>> line_support_points;
545
546 /*
547 * The one-dimensional polynomials defined as Lagrange polynomials from the
548 * line support points. These are used for point evaluations and match the
549 * polynomial space of an FE_Q<1>(this->degree).
550 */
551 const std::vector<Polynomials::Polynomial<double>> polynomials_1d;
552
553 /*
554 * The numbering from the lexicographic to the hierarchical ordering used
555 * when expanding the tensor product with the mapping support points (which
556 * come in hierarchical numbers).
557 */
558 const std::vector<unsigned int> renumber_lexicographic_to_hierarchic;
559
560 /*
561 * The support points in reference coordinates. These are used for
562 * constructing approximations of the output of
563 * compute_mapping_support_points() when evaluating the mapping on the fly,
564 * rather than going through the FEValues interface provided by
565 * InternalData.
566 *
567 * The number of points depends on the degree of this class, and it matches
568 * the number of degrees of freedom of an FE_Q<dim>(this->degree).
569 */
570 const std::vector<Point<dim>> unit_cell_support_points;
571
591 const std::vector<Table<2, double>>
593
607
637 virtual std::vector<Point<spacedim>>
639 const typename Triangulation<dim, spacedim>::cell_iterator &cell) const;
640
648 const Point<spacedim> & p,
649 const Point<dim> &initial_p_unit) const;
650
664 virtual void
667 std::vector<Point<spacedim>> & a) const;
668
683 virtual void
686 std::vector<Point<spacedim>> & a) const;
687
688 // Make MappingQCache a friend since it needs to call the
689 // compute_mapping_support_points() function.
690 template <int, int>
691 friend class MappingQCache;
692};
693
694
695
701template <int dim, int spacedim = dim>
703
707/*----------------------------------------------------------------------*/
708
709#ifndef DOXYGEN
710
711template <int dim, int spacedim>
712inline bool
714{
715 return true;
716}
717
718#endif // DOXYGEN
719
720/* -------------- declaration of explicit specializations ------------- */
721
722
724
725#endif
QGaussLobatto< 1 > line_support_points
Definition mapping_q.h:392
Triangulation< dim, spacedim >::cell_iterator cell_of_current_support_points
Definition mapping_q.h:446
virtual std::size_t memory_consumption() const override
Definition mapping_q.cc:64
std::vector< Point< spacedim > > mapping_support_points
Definition mapping_q.h:440
const unsigned int polynomial_degree
Definition mapping_q.h:371
std::array< std::vector< Tensor< 1, dim > >, GeometryInfo< dim >::faces_per_cell *(dim - 1)> unit_tangentials
Definition mapping_q.h:365
internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > * output_data
Definition mapping_q.h:460
std::vector< AlignedVector< Tensor< 1, spacedim > > > aux
Definition mapping_q.h:434
void initialize_face(const UpdateFlags update_flags, const Quadrature< dim > &quadrature, const unsigned int n_original_q_points)
Definition mapping_q.cc:162
AlignedVector< double > volume_elements
Definition mapping_q.h:452
void initialize(const UpdateFlags update_flags, const Quadrature< dim > &quadrature, const unsigned int n_original_q_points)
Definition mapping_q.cc:82
std::vector< Point< dim > > quadrature_points
Definition mapping_q.h:348
const unsigned int n_shape_functions
Definition mapping_q.h:382
internal::MatrixFreeFunctions::ShapeInfo< VectorizedArrayType > shape_info
Definition mapping_q.h:418
AlignedVector< VectorizedArrayType > scratch
Definition mapping_q.h:424
const std::vector< unsigned int > renumber_lexicographic_to_hierarchic
Definition mapping_q.h:558
const Table< 2, double > support_point_weights_cell
Definition mapping_q.h:606
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:731
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:767
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:786
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:534
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:593
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:746
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:324
const std::vector< Table< 2, double > > support_point_weights_perimeter_to_interior
Definition mapping_q.h:592
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:544
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:290
const std::vector< Polynomials::Polynomial< double > > polynomials_1d
Definition mapping_q.h:551
virtual std::unique_ptr< Mapping< dim, spacedim > > clone() const override
Definition mapping_q.cc:272
const std::vector< Point< dim > > unit_cell_support_points
Definition mapping_q.h:570
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:473
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:675
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:281
Abstract base class for mapping classes.
Definition mapping.h:317
Definition point.h:112
#define DEAL_II_DEPRECATED
Definition config.h:172
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:472
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:473
UpdateFlags
MappingKind
Definition mapping.h:78