Reference documentation for deal.II version 9.2.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_manifold.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2016 - 2020 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_manifold_h
17 #define dealii_mapping_manifold_h
18 
19 
20 #include <deal.II/base/config.h>
21 
25 
26 #include <deal.II/fe/mapping.h>
27 
28 #include <cmath>
29 
31 
32 template <int, int>
33 class MappingQ;
34 
35 
38 
39 
59 template <int dim, int spacedim = dim>
60 class MappingManifold : public Mapping<dim, spacedim>
61 {
62 public:
66  MappingManifold() = default;
67 
72 
73  // for documentation, see the Mapping base class
74  virtual std::unique_ptr<Mapping<dim, spacedim>>
75  clone() const override;
76 
81  virtual bool
82  preserves_vertex_locations() const override;
83 
89  // for documentation, see the Mapping base class
90  virtual Point<spacedim>
93  const Point<dim> &p) const override;
94 
95  // for documentation, see the Mapping base class
96  virtual Point<dim>
99  const Point<spacedim> &p) const override;
100 
110  // for documentation, see the Mapping base class
111  virtual void
112  transform(const ArrayView<const Tensor<1, dim>> & input,
113  const MappingKind kind,
114  const typename Mapping<dim, spacedim>::InternalDataBase &internal,
115  const ArrayView<Tensor<1, spacedim>> &output) const override;
116 
117  // for documentation, see the Mapping base class
118  virtual void
120  const MappingKind kind,
121  const typename Mapping<dim, spacedim>::InternalDataBase &internal,
122  const ArrayView<Tensor<2, spacedim>> &output) const override;
123 
124  // for documentation, see the Mapping base class
125  virtual void
126  transform(const ArrayView<const Tensor<2, dim>> & input,
127  const MappingKind kind,
128  const typename Mapping<dim, spacedim>::InternalDataBase &internal,
129  const ArrayView<Tensor<2, spacedim>> &output) const override;
130 
131  // for documentation, see the Mapping base class
132  virtual void
134  const MappingKind kind,
135  const typename Mapping<dim, spacedim>::InternalDataBase &internal,
136  const ArrayView<Tensor<3, spacedim>> &output) const override;
137 
138  // for documentation, see the Mapping base class
139  virtual void
140  transform(const ArrayView<const Tensor<3, dim>> & input,
141  const MappingKind kind,
142  const typename Mapping<dim, spacedim>::InternalDataBase &internal,
143  const ArrayView<Tensor<3, spacedim>> &output) const override;
144 
154 public:
166  class InternalData : public Mapping<dim, spacedim>::InternalDataBase
167  {
168  public:
172  InternalData() = default;
173 
182  void
183  initialize(const UpdateFlags update_flags,
184  const Quadrature<dim> &quadrature,
185  const unsigned int n_original_q_points);
186 
192  void
193  initialize_face(const UpdateFlags update_flags,
194  const Quadrature<dim> &quadrature,
195  const unsigned int n_original_q_points);
196 
197 
203  void
205 
209  void
211  const typename Triangulation<dim, spacedim>::cell_iterator &cell) const;
212 
216  virtual std::size_t
217  memory_consumption() const override;
218 
224  mutable std::vector<Point<spacedim>> vertices;
225 
232 
239 
240 
259  std::vector<std::vector<double>> cell_manifold_quadrature_weights;
260 
261 
276  mutable std::vector<double> vertex_weights;
277 
291  std::array<std::vector<Tensor<1, dim>>,
294 
304  mutable std::vector<DerivativeForm<1, dim, spacedim>> covariant;
305 
313  mutable std::vector<DerivativeForm<1, dim, spacedim>> contravariant;
314 
318  mutable std::vector<std::vector<Tensor<1, spacedim>>> aux;
319 
324  mutable std::vector<double> volume_elements;
325 
332  };
333 
334 
335  // documentation can be found in Mapping::requires_update_flags()
336  virtual UpdateFlags
337  requires_update_flags(const UpdateFlags update_flags) const override;
338 
339  // documentation can be found in Mapping::get_data()
340  virtual std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
341  get_data(const UpdateFlags, const Quadrature<dim> &quadrature) const override;
342 
343  // documentation can be found in Mapping::get_face_data()
344  virtual std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
345  get_face_data(const UpdateFlags flags,
346  const Quadrature<dim - 1> &quadrature) const override;
347 
348  // documentation can be found in Mapping::get_subface_data()
349  virtual std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
350  get_subface_data(const UpdateFlags flags,
351  const Quadrature<dim - 1> &quadrature) const override;
352 
353  // documentation can be found in Mapping::fill_fe_values()
356  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
357  const CellSimilarity::Similarity cell_similarity,
358  const Quadrature<dim> & quadrature,
359  const typename Mapping<dim, spacedim>::InternalDataBase & internal_data,
361  &output_data) const override;
362 
363  // documentation can be found in Mapping::fill_fe_face_values()
364  virtual void
366  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
367  const unsigned int face_no,
368  const Quadrature<dim - 1> & quadrature,
369  const typename Mapping<dim, spacedim>::InternalDataBase & internal_data,
371  &output_data) const override;
372 
373  // documentation can be found in Mapping::fill_fe_subface_values()
374  virtual void
376  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
377  const unsigned int face_no,
378  const unsigned int subface_no,
379  const Quadrature<dim - 1> & quadrature,
380  const typename Mapping<dim, spacedim>::InternalDataBase & internal_data,
382  &output_data) const override;
383 
387 };
388 
389 
390 
393 /*----------------------------------------------------------------------*/
394 
395 #ifndef DOXYGEN
396 
397 template <int dim, int spacedim>
398 inline void
400  const typename Triangulation<dim, spacedim>::cell_iterator &cell) const
401 {
403  for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
404  vertices[i] = cell->vertex(i);
405  this->cell = cell;
406 }
407 
408 
409 template <int dim, int spacedim>
410 inline void
413 {
414  cell_manifold_quadrature_weights.resize(
415  quad.size(), std::vector<double>(GeometryInfo<dim>::vertices_per_cell));
416  for (unsigned int q = 0; q < quad.size(); ++q)
417  {
418  for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
419  {
420  cell_manifold_quadrature_weights[q][i] =
422  }
423  }
424 }
425 
426 
427 
428 template <int dim, int spacedim>
429 inline bool
431 {
432  return true;
433 }
434 
435 #endif // DOXYGEN
436 
437 /* -------------- declaration of explicit specializations ------------- */
438 
439 
441 
442 #endif
array_view.h
MappingManifold::InternalData::compute_manifold_quadrature_weights
void compute_manifold_quadrature_weights(const Quadrature< dim > &quadrature)
MappingManifold::clone
virtual std::unique_ptr< Mapping< dim, spacedim > > clone() const override
Definition: mapping_manifold.cc:153
derivative_form.h
MappingQ
Definition: mapping_manifold.h:33
MappingManifold::InternalData::unit_tangentials
std::array< std::vector< Tensor< 1, dim > >, GeometryInfo< dim >::faces_per_cell *(dim - 1)> unit_tangentials
Definition: mapping_manifold.h:293
MappingKind
MappingKind
Definition: mapping.h:62
MappingManifold::InternalData::store_vertices
void store_vertices(const typename Triangulation< dim, spacedim >::cell_iterator &cell) const
internal::FEValuesImplementation::MappingRelatedData
Definition: fe_update_flags.h:418
MappingManifold
Definition: mapping_manifold.h:60
MappingManifold::InternalData::vertex_weights
std::vector< double > vertex_weights
Definition: mapping_manifold.h:276
ArrayView
Definition: array_view.h:77
GeometryInfo::d_linear_shape_function
static double d_linear_shape_function(const Point< dim > &xi, const unsigned int i)
GeometryInfo
Definition: geometry_info.h:1224
MappingManifold::InternalData::manifold
SmartPointer< const Manifold< dim, spacedim > > manifold
Definition: mapping_manifold.h:331
MappingManifold::get_subface_data
virtual std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBase > get_subface_data(const UpdateFlags flags, const Quadrature< dim - 1 > &quadrature) const override
Definition: mapping_manifold.cc:303
CellSimilarity::Similarity
Similarity
Definition: fe_update_flags.h:378
MappingManifold::InternalData::quad
Quadrature< dim > quad
Definition: mapping_manifold.h:238
MappingManifold::preserves_vertex_locations
virtual bool preserves_vertex_locations() const override
MappingManifold::InternalData::aux
std::vector< std::vector< Tensor< 1, spacedim > > > aux
Definition: mapping_manifold.h:318
MappingManifold::transform_unit_to_real_cell
virtual Point< spacedim > transform_unit_to_real_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< dim > &p) const override
Definition: mapping_manifold.cc:174
MappingManifold::get_face_data
virtual std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBase > get_face_data(const UpdateFlags flags, const Quadrature< dim - 1 > &quadrature) const override
Definition: mapping_manifold.cc:285
DerivativeForm< 1, dim, spacedim >
MappingManifold::InternalData::memory_consumption
virtual std::size_t memory_consumption() const override
Definition: mapping_manifold.cc:51
MappingManifold::InternalData::initialize_face
void initialize_face(const UpdateFlags update_flags, const Quadrature< dim > &quadrature, const unsigned int n_original_q_points)
Definition: mapping_manifold.cc:105
Quadrature::point
const Point< dim > & point(const unsigned int i) const
Mapping
Abstract base class for mapping classes.
Definition: mapping.h:302
MappingManifold::InternalData::covariant
std::vector< DerivativeForm< 1, dim, spacedim > > covariant
Definition: mapping_manifold.h:304
Tensor< 1, dim >
MappingManifold::InternalData::initialize
void initialize(const UpdateFlags update_flags, const Quadrature< dim > &quadrature, const unsigned int n_original_q_points)
Definition: mapping_manifold.cc:71
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
MappingManifold::InternalData::InternalData
InternalData()=default
MappingManifold::InternalData::vertices
std::vector< Point< spacedim > > vertices
Definition: mapping_manifold.h:224
MappingManifold::fill_fe_subface_values
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
Definition: mapping_manifold.cc:1239
MappingManifold::get_data
virtual std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBase > get_data(const UpdateFlags, const Quadrature< dim > &quadrature) const override
Definition: mapping_manifold.cc:270
MappingManifold::InternalData::volume_elements
std::vector< double > volume_elements
Definition: mapping_manifold.h:324
UpdateFlags
UpdateFlags
Definition: fe_update_flags.h:66
SmartPointer
Definition: smartpointer.h:68
MappingManifold::requires_update_flags
virtual UpdateFlags requires_update_flags(const UpdateFlags update_flags) const override
Definition: mapping_manifold.cc:208
mapping.h
Mapping::InternalDataBase
Definition: mapping.h:597
Point< spacedim >
quadrature.h
MappingManifold::MappingManifold
MappingManifold()=default
MappingManifold::fill_fe_values
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_manifold.cc:463
config.h
Quadrature::size
unsigned int size() const
MappingManifold::transform
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
Definition: mapping_manifold.cc:1274
MappingManifold::InternalData::cell_manifold_quadrature_weights
std::vector< std::vector< double > > cell_manifold_quadrature_weights
Definition: mapping_manifold.h:259
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
MappingManifold::InternalData::cell
Triangulation< dim, spacedim >::cell_iterator cell
Definition: mapping_manifold.h:231
Quadrature
Definition: quadrature.h:85
MappingManifold::InternalData
Definition: mapping_manifold.h:166
MappingManifold::InternalData::contravariant
std::vector< DerivativeForm< 1, dim, spacedim > > contravariant
Definition: mapping_manifold.h:313
TriaIterator
Definition: tria_iterator.h:578
MappingManifold::fill_fe_face_values
virtual void fill_fe_face_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const Quadrature< dim - 1 > &quadrature, const typename Mapping< dim, spacedim >::InternalDataBase &internal_data, ::internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &output_data) const override
Definition: mapping_manifold.cc:1207
MappingManifold::transform_real_to_unit_cell
virtual Point< dim > transform_real_to_unit_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< spacedim > &p) const override
Definition: mapping_manifold.cc:162