Reference documentation for deal.II version 9.3.3
\(\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<std::vector<Tensor<1, spacedim>>> aux;
520
524 mutable std::vector<types::global_dof_index> local_dof_indices;
525
529 mutable std::vector<double> local_dof_values;
530 };
531
532private:
533 // documentation can be found in Mapping::get_data()
534 virtual std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
535 get_data(const UpdateFlags, const Quadrature<dim> &quadrature) const override;
536
537 using Mapping<dim, spacedim>::get_face_data;
538
539 // documentation can be found in Mapping::get_face_data()
540 virtual std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
541 get_face_data(const UpdateFlags flags,
542 const hp::QCollection<dim - 1> &quadrature) const override;
543
544 // documentation can be found in Mapping::get_subface_data()
545 virtual std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
546 get_subface_data(const UpdateFlags flags,
547 const Quadrature<dim - 1> &quadrature) const override;
548
549 // documentation can be found in Mapping::fill_fe_values()
551 fill_fe_values(
553 const CellSimilarity::Similarity cell_similarity,
554 const Quadrature<dim> & quadrature,
555 const typename Mapping<dim, spacedim>::InternalDataBase & internal_data,
557 &output_data) const override;
558
559 using Mapping<dim, spacedim>::fill_fe_face_values;
560
561 // documentation can be found in Mapping::fill_fe_face_values()
562 virtual void
563 fill_fe_face_values(
565 const unsigned int face_no,
566 const hp::QCollection<dim - 1> & quadrature,
567 const typename Mapping<dim, spacedim>::InternalDataBase & internal_data,
569 &output_data) const override;
570
571 // documentation can be found in Mapping::fill_fe_subface_values()
572 virtual void
573 fill_fe_subface_values(
575 const unsigned int face_no,
576 const unsigned int subface_no,
577 const Quadrature<dim - 1> & quadrature,
578 const typename Mapping<dim, spacedim>::InternalDataBase & internal_data,
580 &output_data) const override;
581
590 const bool uses_level_dofs;
591
595 std::vector<SmartPointer<const VectorType,
598
605
606private:
623 do_transform_unit_to_real_cell(const InternalData &mdata) const;
624
625
641 do_transform_real_to_unit_cell(
643 const Point<spacedim> & p,
644 const Point<dim> & initial_p_unit,
645 InternalData & mdata) const;
646
650 void
651 update_internal_dofs(
654 &data) const;
655
659 virtual void
660 compute_shapes_virtual(
661 const std::vector<Point<dim>> &unit_points,
663 &data) const;
664
665 /*
666 * Which components to use for the mapping.
667 */
669
679 std::vector<unsigned int> fe_to_real;
680
686
690 mutable std::mutex fe_values_mutex;
691
692 void
693 compute_data(const UpdateFlags update_flags,
694 const Quadrature<dim> &q,
695 const unsigned int n_original_q_points,
696 InternalData & data) const;
697
698 void
699 compute_face_data(const UpdateFlags update_flags,
700 const Quadrature<dim> &q,
701 const unsigned int n_original_q_points,
702 InternalData & data) const;
703
704
705 // Declare other MappingFEField classes friends.
706 template <int, int, class, class>
707 friend class MappingFEField;
708};
709
712/* -------------- declaration of explicit specializations ------------- */
713
714#ifndef DOXYGEN
715
716#endif // DOXYGEN
717
719
720#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:304
Definition: vector.h:110
#define DEAL_II_DEPRECATED
Definition: config.h:162
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:402
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:403
UpdateFlags
#define DeclException0(Exception0)
Definition: exceptions.h:470
MappingKind
Definition: mapping.h:65
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< BarycentricPolynomial< dim > > &polys)
void transform(const InputIterator &begin_in, const InputIterator &end_in, OutputIterator out, const Predicate &predicate, const unsigned int grainsize)
Definition: parallel.h:213