Reference documentation for deal.II version 8.5.1
mapping_manifold.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2016 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 at
12 // the top level of the deal.II distribution.
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 #include <deal.II/base/derivative_form.h>
22 #include <deal.II/base/table.h>
23 #include <deal.II/base/quadrature_lib.h>
24 #include <deal.II/base/qprojector.h>
25 #include <deal.II/grid/tria_iterator.h>
26 #include <deal.II/dofs/dof_accessor.h>
27 #include <deal.II/fe/mapping.h>
28 
29 #include <cmath>
30 
31 DEAL_II_NAMESPACE_OPEN
32 
33 template <int,int> 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 ();
67 
72 
73  // for documentation, see the Mapping base class
74  virtual
75  Mapping<dim,spacedim> *clone () const;
76 
81  virtual
82  bool preserves_vertex_locations () const;
83 
89  // for documentation, see the Mapping base class
90  virtual
93  const Point<dim> &p) const;
94 
95  // for documentation, see the Mapping base class
96  virtual
99  const Point<spacedim> &p) const;
100 
110  // for documentation, see the Mapping base class
111  virtual
112  void
113  transform (const ArrayView<const Tensor<1,dim> > &input,
114  const MappingType type,
115  const typename Mapping<dim,spacedim>::InternalDataBase &internal,
116  const ArrayView<Tensor<1,spacedim> > &output) const;
117 
118  // for documentation, see the Mapping base class
119  virtual
120  void
122  const MappingType type,
123  const typename Mapping<dim,spacedim>::InternalDataBase &internal,
124  const ArrayView<Tensor<2,spacedim> > &output) const;
125 
126  // for documentation, see the Mapping base class
127  virtual
128  void
129  transform (const ArrayView<const Tensor<2, dim> > &input,
130  const MappingType type,
131  const typename Mapping<dim,spacedim>::InternalDataBase &internal,
132  const ArrayView<Tensor<2,spacedim> > &output) const;
133 
134  // for documentation, see the Mapping base class
135  virtual
136  void
138  const MappingType type,
139  const typename Mapping<dim,spacedim>::InternalDataBase &internal,
140  const ArrayView<Tensor<3,spacedim> > &output) const;
141 
142  // for documentation, see the Mapping base class
143  virtual
144  void
145  transform (const ArrayView<const Tensor<3, dim> > &input,
146  const MappingType type,
147  const typename Mapping<dim,spacedim>::InternalDataBase &internal,
148  const ArrayView<Tensor<3,spacedim> > &output) const;
149 
159 public:
171  class InternalData : public Mapping<dim,spacedim>::InternalDataBase
172  {
173  public:
177  InternalData();
178 
187  void
188  initialize (const UpdateFlags update_flags,
189  const Quadrature<dim> &quadrature,
190  const unsigned int n_original_q_points);
191 
197  void
198  initialize_face (const UpdateFlags update_flags,
199  const Quadrature<dim> &quadrature,
200  const unsigned int n_original_q_points);
201 
202 
208  void
210 
214  void
216 
220  virtual std::size_t memory_consumption () const;
221 
227  mutable std::vector<Point<spacedim> > vertices;
228 
235 
242 
243 
262  std::vector<std::vector<double> > cell_manifold_quadrature_weights;
263 
264 
279  mutable std::vector<double> vertex_weights;
280 
294  std_cxx11::array<std::vector<Tensor<1,dim> >, GeometryInfo<dim>::faces_per_cell *(dim-1)> unit_tangentials;
295 
305  mutable std::vector<DerivativeForm<1,dim, spacedim > > covariant;
306 
314  mutable std::vector<DerivativeForm<1,dim,spacedim> > contravariant;
315 
319  mutable std::vector<std::vector<Tensor<1,spacedim> > > aux;
320 
325  mutable std::vector<double> volume_elements;
326 
333  };
334 
335 
336  // documentation can be found in Mapping::requires_update_flags()
337  virtual
339  requires_update_flags (const UpdateFlags update_flags) const;
340 
341  // documentation can be found in Mapping::get_data()
342  virtual
343  InternalData *
344  get_data (const UpdateFlags,
345  const Quadrature<dim> &quadrature) const;
346 
347  // documentation can be found in Mapping::get_face_data()
348  virtual
349  InternalData *
350  get_face_data (const UpdateFlags flags,
351  const Quadrature<dim-1>& quadrature) const;
352 
353  // documentation can be found in Mapping::get_subface_data()
354  virtual
355  InternalData *
356  get_subface_data (const UpdateFlags flags,
357  const Quadrature<dim-1>& quadrature) const;
358 
359  // documentation can be found in Mapping::fill_fe_values()
360  virtual
363  const CellSimilarity::Similarity cell_similarity,
364  const Quadrature<dim> &quadrature,
365  const typename Mapping<dim,spacedim>::InternalDataBase &internal_data,
367 
368  // documentation can be found in Mapping::fill_fe_face_values()
369  virtual void
371  const unsigned int face_no,
372  const Quadrature<dim-1> &quadrature,
373  const typename Mapping<dim,spacedim>::InternalDataBase &internal_data,
375 
376  // documentation can be found in Mapping::fill_fe_subface_values()
377  virtual void
379  const unsigned int face_no,
380  const unsigned int subface_no,
381  const Quadrature<dim-1> &quadrature,
382  const typename Mapping<dim,spacedim>::InternalDataBase &internal_data,
384 
388 };
389 
390 
391 
394 /*----------------------------------------------------------------------*/
395 
396 #ifndef DOXYGEN
397 
398 template<int dim, int spacedim>
399 inline
400 void
402 {
404  for (unsigned int i=0; i<GeometryInfo<dim>::vertices_per_cell; ++i)
405  vertices[i] = cell->vertex(i);
406  this->cell = cell;
407 }
408 
409 
410 template <int dim, int spacedim>
411 inline
412 void
414 {
415  cell_manifold_quadrature_weights.resize(quad.size(), std::vector<double>(GeometryInfo<dim>::vertices_per_cell));
416  for (unsigned int q=0; q<quad.size(); ++q)
417  {
418  for (unsigned int i=0; i<GeometryInfo<dim>::vertices_per_cell; ++i)
419  {
420  cell_manifold_quadrature_weights[q][i] = GeometryInfo<dim>::d_linear_shape_function(quad.point(q), i);
421  }
422  }
423 }
424 
425 
426 
427 template <int dim, int spacedim>
428 inline
429 bool
431 {
432  return true;
433 }
434 
435 #endif // DOXYGEN
436 
437 /* -------------- declaration of explicit specializations ------------- */
438 
439 
440 DEAL_II_NAMESPACE_CLOSE
441 
442 #endif
virtual std::size_t memory_consumption() const
virtual Mapping< dim, spacedim > * clone() const
virtual InternalData * get_subface_data(const UpdateFlags flags, const Quadrature< dim-1 > &quadrature) const
virtual Point< spacedim > transform_unit_to_real_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< dim > &p) const
MappingType
Definition: mapping.h:50
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::FEValues::MappingRelatedData< dim, spacedim > &output_data) const
const Point< dim > & point(const unsigned int i) const
virtual UpdateFlags requires_update_flags(const UpdateFlags update_flags) const
void store_vertices(const typename Triangulation< dim, spacedim >::cell_iterator &cell) const
Triangulation< dim, spacedim >::cell_iterator cell
std::vector< Point< spacedim > > vertices
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::FEValues::MappingRelatedData< dim, spacedim > &output_data) const
std::vector< std::vector< Tensor< 1, spacedim > > > aux
virtual InternalData * get_face_data(const UpdateFlags flags, const Quadrature< dim-1 > &quadrature) const
virtual void transform(const ArrayView< const Tensor< 1, dim > > &input, const MappingType type, const typename Mapping< dim, spacedim >::InternalDataBase &internal, const ArrayView< Tensor< 1, spacedim > > &output) const
UpdateFlags
Abstract base class for mapping classes.
Definition: dof_tools.h:46
virtual bool preserves_vertex_locations() const
void initialize(const UpdateFlags update_flags, const Quadrature< dim > &quadrature, const unsigned int n_original_q_points)
std::vector< DerivativeForm< 1, dim, spacedim > > covariant
std::vector< double > volume_elements
unsigned int size() const
std::vector< DerivativeForm< 1, dim, spacedim > > contravariant
std::vector< double > vertex_weights
std_cxx11::array< std::vector< Tensor< 1, dim > >, GeometryInfo< dim >::faces_per_cell *(dim-1)> unit_tangentials
virtual InternalData * get_data(const UpdateFlags, const Quadrature< dim > &quadrature) const
void compute_manifold_quadrature_weights(const Quadrature< dim > &quadrature)
SmartPointer< const Manifold< dim, spacedim > > manifold
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::FEValues::MappingRelatedData< dim, spacedim > &output_data) const
void initialize_face(const UpdateFlags update_flags, const Quadrature< dim > &quadrature, const unsigned int n_original_q_points)
virtual Point< dim > transform_real_to_unit_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< spacedim > &p) const
std::vector< std::vector< double > > cell_manifold_quadrature_weights
static double d_linear_shape_function(const Point< dim > &xi, const unsigned int i)