Reference documentation for deal.II version 9.4.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\}}\)
mapping_fe_field.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (C) 2001 - 2021 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_fe_field_h
17#define dealii_mapping_fe_field_h
18
19
20#include <deal.II/base/config.h>
21
24
26
27#include <deal.II/fe/fe.h>
29#include <deal.II/fe/mapping.h>
30
31#include <deal.II/lac/vector.h>
32
33#include <array>
34
35
37
38
41
45template <int dim,
46 int spacedim = dim,
47 typename VectorType = Vector<double>,
48 typename DoFHandlerType = void>
50
51#ifndef DOXYGEN
52// prevent doxygen from complaining about potential recursive class relations
53template <int dim, int spacedim, typename VectorType, typename DoFHandlerType>
54class MappingFEField : public MappingFEField<dim, spacedim, VectorType, void>
55{
56public:
58 MappingFEField(const DoFHandlerType &euler_dof_handler,
59 const VectorType & euler_vector,
60 const ComponentMask & mask = ComponentMask())
61 : MappingFEField<dim, spacedim, VectorType, void>(euler_dof_handler,
62 euler_vector,
63 mask)
64 {}
65
67 MappingFEField(const DoFHandlerType & euler_dof_handler,
68 const std::vector<VectorType> &euler_vector,
69 const ComponentMask & mask = ComponentMask())
70 : MappingFEField<dim, spacedim, VectorType, void>(euler_dof_handler,
71 euler_vector,
72 mask)
73 {}
74
76 MappingFEField(const DoFHandlerType & euler_dof_handler,
77 const MGLevelObject<VectorType> &euler_vector,
78 const ComponentMask & mask = ComponentMask())
79 : MappingFEField<dim, spacedim, VectorType, void>(euler_dof_handler,
80 euler_vector,
81 mask)
82 {}
83
87 : MappingFEField<dim, spacedim, VectorType, void>(mapping)
88 {}
89};
90#endif // DOXYGEN
91
127template <int dim, int spacedim, typename VectorType>
128class MappingFEField<dim, spacedim, VectorType, void>
129 : public Mapping<dim, spacedim>
130{
131public:
164 MappingFEField(const DoFHandler<dim, spacedim> &euler_dof_handler,
165 const VectorType & euler_vector,
166 const ComponentMask & mask = ComponentMask());
167
177 MappingFEField(const DoFHandler<dim, spacedim> &euler_dof_handler,
178 const std::vector<VectorType> & euler_vector,
179 const ComponentMask & mask = ComponentMask());
180
188 MappingFEField(const DoFHandler<dim, spacedim> &euler_dof_handler,
189 const MGLevelObject<VectorType> &euler_vector,
190 const ComponentMask & mask = ComponentMask());
191
197
202 virtual std::unique_ptr<Mapping<dim, spacedim>>
203 clone() const override;
204
210 virtual bool
211 preserves_vertex_locations() const override;
212
213 virtual bool
214 is_compatible_with(const ReferenceCell &reference_cell) const override;
215
223 virtual boost::container::small_vector<Point<spacedim>,
225 get_vertices(const typename Triangulation<dim, spacedim>::cell_iterator &cell)
226 const override;
227
233 // for documentation, see the Mapping base class
234 virtual Point<spacedim>
235 transform_unit_to_real_cell(
237 const Point<dim> &p) const override;
238
239 // for documentation, see the Mapping base class
240 virtual Point<dim>
243 const Point<spacedim> &p) const override;
244
254 // for documentation, see the Mapping base class
255 virtual void
256 transform(const ArrayView<const Tensor<1, dim>> & input,
257 const MappingKind kind,
259 const ArrayView<Tensor<1, spacedim>> &output) const override;
260
261 // for documentation, see the Mapping base class
262 virtual void
264 const MappingKind kind,
266 const ArrayView<Tensor<2, spacedim>> &output) const override;
267
268 // for documentation, see the Mapping base class
269 virtual void
270 transform(const ArrayView<const Tensor<2, dim>> & input,
271 const MappingKind kind,
273 const ArrayView<Tensor<2, spacedim>> &output) const override;
274
275 // for documentation, see the Mapping base class
276 virtual void
278 const MappingKind kind,
280 const ArrayView<Tensor<3, spacedim>> &output) const override;
281
282 // for documentation, see the Mapping base class
283 virtual void
284 transform(const ArrayView<const Tensor<3, dim>> & input,
285 const MappingKind kind,
287 const ArrayView<Tensor<3, spacedim>> &output) const override;
288
297 unsigned int
298 get_degree() const;
299
305 get_component_mask() const;
306
310 DeclException0(ExcInactiveCell);
311
312private:
318 // documentation can be found in Mapping::requires_update_flags()
319 virtual UpdateFlags
320 requires_update_flags(const UpdateFlags update_flags) const override;
321
322public:
334 class InternalData : public Mapping<dim, spacedim>::InternalDataBase
335 {
336 public:
340 InternalData(const FiniteElement<dim, spacedim> &fe,
341 const ComponentMask & mask);
342
347 const double &
348 shape(const unsigned int qpoint, const unsigned int shape_nr) const;
349
353 double &
354 shape(const unsigned int qpoint, const unsigned int shape_nr);
355
359 const Tensor<1, dim> &
360 derivative(const unsigned int qpoint, const unsigned int shape_nr) const;
361
366 derivative(const unsigned int qpoint, const unsigned int shape_nr);
367
371 const Tensor<2, dim> &
372 second_derivative(const unsigned int qpoint,
373 const unsigned int shape_nr) const;
374
379 second_derivative(const unsigned int qpoint, const unsigned int shape_nr);
380
384 const Tensor<3, dim> &
385 third_derivative(const unsigned int qpoint,
386 const unsigned int shape_nr) const;
387
392 third_derivative(const unsigned int qpoint, const unsigned int shape_nr);
393
397 const Tensor<4, dim> &
398 fourth_derivative(const unsigned int qpoint,
399 const unsigned int shape_nr) const;
400
405 fourth_derivative(const unsigned int qpoint, const unsigned int shape_nr);
406
410 virtual std::size_t
411 memory_consumption() const override;
412
418 std::vector<double> shape_values;
419
425 std::vector<Tensor<1, dim>> shape_derivatives;
426
433 std::vector<Tensor<2, dim>> shape_second_derivatives;
434
441 std::vector<Tensor<3, dim>> shape_third_derivatives;
442
449 std::vector<Tensor<4, dim>> shape_fourth_derivatives;
450
464 std::array<std::vector<Tensor<1, dim>>,
466 unit_tangentials;
467
474 unsigned int n_shape_functions;
475
489
499 mutable std::vector<DerivativeForm<1, dim, spacedim>> covariant;
500
508 mutable std::vector<DerivativeForm<1, dim, spacedim>> contravariant;
509
514 mutable std::vector<double> volume_elements;
515
519 mutable std::vector<double> quadrature_weights;
520
524 mutable std::vector<std::vector<Tensor<1, spacedim>>> aux;
525
529 mutable std::vector<types::global_dof_index> local_dof_indices;
530
534 mutable std::vector<double> local_dof_values;
535 };
536
537protected:
538 // documentation can be found in Mapping::get_data()
539 virtual std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
540 get_data(const UpdateFlags, const Quadrature<dim> &quadrature) const override;
541
542 using Mapping<dim, spacedim>::get_face_data;
543
544 // documentation can be found in Mapping::get_face_data()
545 virtual std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
546 get_face_data(const UpdateFlags flags,
547 const hp::QCollection<dim - 1> &quadrature) const override;
548
549 // documentation can be found in Mapping::get_subface_data()
550 virtual std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
551 get_subface_data(const UpdateFlags flags,
552 const Quadrature<dim - 1> &quadrature) const override;
553
554 // documentation can be found in Mapping::fill_fe_values()
556 fill_fe_values(
558 const CellSimilarity::Similarity cell_similarity,
559 const Quadrature<dim> & quadrature,
560 const typename Mapping<dim, spacedim>::InternalDataBase & internal_data,
562 &output_data) const override;
563
564 using Mapping<dim, spacedim>::fill_fe_face_values;
565
566 // documentation can be found in Mapping::fill_fe_face_values()
567 virtual void
568 fill_fe_face_values(
570 const unsigned int face_no,
571 const hp::QCollection<dim - 1> & quadrature,
572 const typename Mapping<dim, spacedim>::InternalDataBase & internal_data,
574 &output_data) const override;
575
576 // documentation can be found in Mapping::fill_fe_subface_values()
577 virtual void
578 fill_fe_subface_values(
580 const unsigned int face_no,
581 const unsigned int subface_no,
582 const Quadrature<dim - 1> & quadrature,
583 const typename Mapping<dim, spacedim>::InternalDataBase & internal_data,
585 &output_data) const override;
586
596
601 const bool uses_level_dofs;
602
606 std::vector<SmartPointer<const VectorType,
609
616
617private:
634 do_transform_unit_to_real_cell(const InternalData &mdata) const;
635
636
652 do_transform_real_to_unit_cell(
654 const Point<spacedim> & p,
655 const Point<dim> & initial_p_unit,
656 InternalData & mdata) const;
657
661 void
662 update_internal_dofs(
665 &data) const;
666
670 virtual void
671 compute_shapes_virtual(
672 const std::vector<Point<dim>> &unit_points,
674 &data) const;
675
676 /*
677 * Which components to use for the mapping.
678 */
680
690 std::vector<unsigned int> fe_to_real;
691
697
701 mutable std::mutex fe_values_mutex;
702
703 void
704 compute_data(const UpdateFlags update_flags,
705 const Quadrature<dim> &q,
706 const unsigned int n_original_q_points,
707 InternalData & data) const;
708
709 void
710 compute_face_data(const UpdateFlags update_flags,
711 const Quadrature<dim> &q,
712 const unsigned int n_original_q_points,
713 InternalData & data) const;
714
715
716 // Declare other MappingFEField classes friends.
717 template <int, int, class, class>
718 friend class MappingFEField;
719};
720
723/* -------------- declaration of explicit specializations ------------- */
724
725#ifndef DOXYGEN
726
727#endif // DOXYGEN
728
730
731#endif
std::vector< std::vector< Tensor< 1, spacedim > > > aux
std::vector< DerivativeForm< 1, dim, spacedim > > covariant
std::vector< DerivativeForm< 1, dim, spacedim > > contravariant
std::vector< SmartPointer< const VectorType, MappingFEField< dim, spacedim, VectorType, void > > > euler_vector
SmartPointer< const DoFHandler< dim, spacedim >, MappingFEField< dim, spacedim, VectorType, void > > euler_dof_handler
Abstract base class for mapping classes.
Definition: mapping.h:311
Definition: vector.h:109
#define DEAL_II_DEPRECATED
Definition: config.h:164
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:442
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:443
UpdateFlags
#define DeclException0(Exception0)
Definition: exceptions.h:464
MappingKind
Definition: mapping.h:72
void reference_cell(Triangulation< dim, spacedim > &tria, const ReferenceCell &reference_cell)
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
Point< 1 > transform_real_to_unit_cell(const std::array< Point< spacedim >, GeometryInfo< 1 >::vertices_per_cell > &vertices, const Point< spacedim > &p)
unsigned int get_degree(const std::vector< typename BarycentricPolynomials< dim >::PolyType > &polys)
void transform(const InputIterator &begin_in, const InputIterator &end_in, OutputIterator out, const Predicate &predicate, const unsigned int grainsize)
Definition: parallel.h:135