Reference documentation for deal.II version Git b742d2cc8e 2020-07-09 13:14:12 -0400
\(\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\}}\)
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
MappingQCache< dim, spacedim > Class Template Reference

#include <deal.II/fe/mapping_q_cache.h>

Inheritance diagram for MappingQCache< dim, spacedim >:
[legend]

Public Member Functions

 MappingQCache (const unsigned int polynomial_degree)
 
 MappingQCache (const MappingQCache< dim, spacedim > &mapping)
 
 ~MappingQCache ()
 
virtual std::unique_ptr< Mapping< dim, spacedim > > clone () const override
 
virtual bool preserves_vertex_locations () const override
 
void initialize (const Triangulation< dim, spacedim > &triangulation, const MappingQGeneric< dim, spacedim > &mapping)
 
void initialize (const Triangulation< dim, spacedim > &triangulation, const std::function< std::vector< Point< spacedim >>(const typename Triangulation< dim, spacedim >::cell_iterator &)> &compute_points_on_cell)
 
std::size_t memory_consumption () const
 
- Public Member Functions inherited from MappingQGeneric< dim, spacedim >
 MappingQGeneric (const unsigned int polynomial_degree)
 
 MappingQGeneric (const MappingQGeneric< dim, spacedim > &mapping)
 
unsigned int get_degree () const
 
virtual Point< spacedim > transform_unit_to_real_cell (const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< dim > &p) const override
 
virtual Point< dim > transform_real_to_unit_cell (const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< spacedim > &p) 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 void transform (const ArrayView< const DerivativeForm< 1, dim, spacedim >> &input, const MappingKind kind, const typename Mapping< dim, spacedim >::InternalDataBase &internal, const ArrayView< Tensor< 2, spacedim >> &output) const override
 
virtual void transform (const ArrayView< const Tensor< 2, dim >> &input, const MappingKind kind, const typename Mapping< dim, spacedim >::InternalDataBase &internal, const ArrayView< Tensor< 2, spacedim >> &output) const override
 
virtual void transform (const ArrayView< const DerivativeForm< 2, dim, spacedim >> &input, const MappingKind kind, const typename Mapping< dim, spacedim >::InternalDataBase &internal, const ArrayView< Tensor< 3, spacedim >> &output) const override
 
virtual void transform (const ArrayView< const Tensor< 3, dim >> &input, const MappingKind kind, const typename Mapping< dim, spacedim >::InternalDataBase &internal, const ArrayView< Tensor< 3, spacedim >> &output) const override
 
virtual UpdateFlags requires_update_flags (const UpdateFlags update_flags) const override
 
virtual std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBaseget_data (const UpdateFlags, const Quadrature< dim > &quadrature) const override
 
virtual std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBaseget_face_data (const UpdateFlags flags, const Quadrature< dim - 1 > &quadrature) const override
 
virtual std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBaseget_subface_data (const UpdateFlags flags, const Quadrature< dim - 1 > &quadrature) 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
 
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
 
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
 
- Public Member Functions inherited from Mapping< dim, spacedim >
virtual ~Mapping () override=default
 
virtual std::array< Point< spacedim >, GeometryInfo< dim >::vertices_per_cell > get_vertices (const typename Triangulation< dim, spacedim >::cell_iterator &cell) const
 
virtual Point< spacedim > get_center (const typename Triangulation< dim, spacedim >::cell_iterator &cell, const bool map_center_of_reference_cell=true) const
 
virtual BoundingBox< spacedim > get_bounding_box (const typename Triangulation< dim, spacedim >::cell_iterator &cell) const
 
Point< dim - 1 > project_real_point_to_unit_point_on_face (const typename Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const Point< spacedim > &p) const
 
- Public Member Functions inherited from Subscriptor
 Subscriptor ()
 
 Subscriptor (const Subscriptor &)
 
 Subscriptor (Subscriptor &&) noexcept
 
virtual ~Subscriptor ()
 
Subscriptoroperator= (const Subscriptor &)
 
Subscriptoroperator= (Subscriptor &&) noexcept
 
void subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const
 
void unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const
 
unsigned int n_subscriptions () const
 
template<typename StreamType >
void list_subscribers (StreamType &stream) const
 
void list_subscribers () const
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Protected Member Functions

virtual std::vector< Point< spacedim > > compute_mapping_support_points (const typename Triangulation< dim, spacedim >::cell_iterator &cell) const override
 
- Protected Member Functions inherited from MappingQGeneric< dim, spacedim >
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
 
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
 
template<>
Point< 1 > transform_real_to_unit_cell_internal (const Triangulation< 1, 1 >::cell_iterator &cell, const Point< 1 > &p, const Point< 1 > &initial_p_unit) const
 
template<>
Point< 2 > transform_real_to_unit_cell_internal (const Triangulation< 2, 2 >::cell_iterator &cell, const Point< 2 > &p, const Point< 2 > &initial_p_unit) const
 
template<>
Point< 3 > transform_real_to_unit_cell_internal (const Triangulation< 3, 3 >::cell_iterator &cell, const Point< 3 > &p, const Point< 3 > &initial_p_unit) const
 
template<>
Point< 1 > transform_real_to_unit_cell_internal (const Triangulation< 1, 2 >::cell_iterator &cell, const Point< 2 > &p, const Point< 1 > &initial_p_unit) const
 
template<>
Point< 2 > transform_real_to_unit_cell_internal (const Triangulation< 2, 3 >::cell_iterator &cell, const Point< 3 > &p, const Point< 2 > &initial_p_unit) const
 
template<>
Point< 1 > transform_real_to_unit_cell_internal (const Triangulation< 1, 3 >::cell_iterator &, const Point< 3 > &, const Point< 1 > &) const
 
template<>
void add_quad_support_points (const Triangulation< 3, 3 >::cell_iterator &cell, std::vector< Point< 3 >> &a) const
 
template<>
void add_quad_support_points (const Triangulation< 2, 3 >::cell_iterator &cell, std::vector< Point< 3 >> &a) const
 
Interface with FEValues

Private Attributes

std::shared_ptr< std::vector< std::vector< std::vector< Point< spacedim > > > > > support_point_cache
 
boost::signals2::connection clear_signal
 

Additional Inherited Members

- Static Public Member Functions inherited from Mapping< dim, spacedim >
static ::ExceptionBaseExcInvalidData ()
 
static ::ExceptionBaseExcTransformationFailed ()
 
static ::ExceptionBaseExcDistortedMappedCell (Point< spacedim > arg1, double arg2, int arg3)
 
- Static Public Member Functions inherited from Subscriptor
static ::ExceptionBaseExcInUse (int arg1, std::string arg2, std::string arg3)
 
static ::ExceptionBaseExcNoSubscriber (std::string arg1, std::string arg2)
 
- Protected Attributes inherited from MappingQGeneric< dim, spacedim >
const unsigned int polynomial_degree
 
QGaussLobatto< 1 > line_support_points
 
std::vector< Table< 2, double > > support_point_weights_perimeter_to_interior
 
Table< 2, doublesupport_point_weights_cell
 

Detailed Description

template<int dim, int spacedim = dim>
class MappingQCache< dim, spacedim >

This class implements a caching strategy for objects of the MappingQ family in terms of the MappingQGeneric::compute_mapping_support_points() function, which is used in all operations of MappingQGeneric. The information of the mapping is pre-computed by the MappingQCache::initialize() function.

The use of this class is discussed extensively in step-65.

Definition at line 44 of file mapping_q_cache.h.

Constructor & Destructor Documentation

◆ MappingQCache() [1/2]

template<int dim, int spacedim>
MappingQCache< dim, spacedim >::MappingQCache ( const unsigned int  polynomial_degree)
explicit

Constructor. polynomial_degree denotes the polynomial degree of the polynomials that are used to map cells from the reference to the real cell.

Definition at line 26 of file mapping_q_cache.cc.

◆ MappingQCache() [2/2]

template<int dim, int spacedim>
MappingQCache< dim, spacedim >::MappingQCache ( const MappingQCache< dim, spacedim > &  mapping)
explicit

Copy constructor.

Definition at line 34 of file mapping_q_cache.cc.

◆ ~MappingQCache()

template<int dim, int spacedim>
MappingQCache< dim, spacedim >::~MappingQCache ( )

Destructor.

Definition at line 43 of file mapping_q_cache.cc.

Member Function Documentation

◆ clone()

template<int dim, int spacedim>
std::unique_ptr< Mapping< dim, spacedim > > MappingQCache< dim, spacedim >::clone ( ) const
overridevirtual

clone() functionality. For documentation, see Mapping::clone().

Reimplemented from MappingQGeneric< dim, spacedim >.

Definition at line 57 of file mapping_q_cache.cc.

◆ preserves_vertex_locations()

template<int dim, int spacedim>
bool MappingQCache< dim, spacedim >::preserves_vertex_locations ( ) const
overridevirtual

Returns false because the preservation of vertex locations depends on the mapping handed to the reinit() function.

Reimplemented from MappingQGeneric< dim, spacedim >.

Definition at line 66 of file mapping_q_cache.cc.

◆ initialize() [1/2]

template<int dim, int spacedim>
void MappingQCache< dim, spacedim >::initialize ( const Triangulation< dim, spacedim > &  triangulation,
const MappingQGeneric< dim, spacedim > &  mapping 
)

Initialize the data cache by computing the mapping support points for all cells (on all levels) of the given triangulation. Note that the cache is invalidated upon the signal Triangulation::Signals::any_change of the underlying triangulation.

Definition at line 75 of file mapping_q_cache.cc.

◆ initialize() [2/2]

template<int dim, int spacedim>
void MappingQCache< dim, spacedim >::initialize ( const Triangulation< dim, spacedim > &  triangulation,
const std::function< std::vector< Point< spacedim >>(const typename Triangulation< dim, spacedim >::cell_iterator &)> &  compute_points_on_cell 
)

Initialize the data cache by letting the function given as an argument provide the mapping support points for all cells (on all levels) of the given triangulation. The function must return a vector of Point<spacedim> whose length is the same as the size of the polynomial space, \((p+1)^\text{dim}\), where \(p\) is the polynomial degree of the mapping, and it must be in the order the mapping or FE_Q sort their points, i.e., all \(2^\text{dim}\) vertex points first, then the points on the lines, quads, and hexes according to the usual hierarchical numbering. No attempt is made to validate these points internally, except for the number of given points.

Note
If multiple threads are enabled, this function will run in parallel, invoking the function passed in several times. Thus, in case MultithreadInfo::n_threads()>1, the user code must make sure that the function, typically a lambda, does not write into data shared with other threads.
The cache is invalidated upon the signal Triangulation::Signals::any_change of the underlying triangulation.

Definition at line 91 of file mapping_q_cache.cc.

◆ memory_consumption()

template<int dim, int spacedim>
std::size_t MappingQCache< dim, spacedim >::memory_consumption ( ) const

Return the memory consumption (in bytes) of the cache.

Definition at line 130 of file mapping_q_cache.cc.

◆ compute_mapping_support_points()

template<int dim, int spacedim>
std::vector< Point< spacedim > > MappingQCache< dim, spacedim >::compute_mapping_support_points ( const typename Triangulation< dim, spacedim >::cell_iterator &  cell) const
overrideprotectedvirtual

This is the main function overridden from the base class MappingQGeneric.

Reimplemented from MappingQGeneric< dim, spacedim >.

Definition at line 143 of file mapping_q_cache.cc.

Member Data Documentation

◆ support_point_cache

template<int dim, int spacedim = dim>
std::shared_ptr<std::vector<std::vector<std::vector<Point<spacedim> > > > > MappingQCache< dim, spacedim >::support_point_cache
private

The point cache filled upon calling initialize(). It is made a shared pointer to allow several instances (created via clone()) to share this cache.

Definition at line 136 of file mapping_q_cache.h.

◆ clear_signal

template<int dim, int spacedim = dim>
boost::signals2::connection MappingQCache< dim, spacedim >::clear_signal
private

The connection to Triangulation::signals::any that must be reset once this class goes out of scope.

Definition at line 142 of file mapping_q_cache.h.


The documentation for this class was generated from the following files: