Reference documentation for deal.II version Git 5ba5df0 2015-09-03 22:21:05 -0500
Classes | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Attributes | List of all members
MappingQ1< dim, spacedim > Class Template Reference

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

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

Classes

class  InternalData
 

Public Member Functions

 MappingQ1 ()
 
virtual Mapping< dim, spacedim > * clone () const
 
virtual bool preserves_vertex_locations () const
 
template<int dim_>
Point< dim_ > transform_real_to_unit_cell_internal_codim1 (const typename Triangulation< dim_, dim_+1 >::cell_iterator &cell, const Point< dim_+1 > &p, const Point< dim_ > &initial_p_unit, typename MappingQ1< dim, spacedim >::InternalData &mdata) const
 
Mapping points between reference and real cells
virtual Point< spacedim > transform_unit_to_real_cell (const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< dim > &p) const
 
virtual Point< dim > transform_real_to_unit_cell (const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< spacedim > &p) const
 
Functions to transform tensors from reference to real coordinates
virtual void transform (const VectorSlice< const std::vector< Tensor< 1, dim > > > input, const MappingType type, const typename Mapping< dim, spacedim >::InternalDataBase &internal, VectorSlice< std::vector< Tensor< 1, spacedim > > > output) const
 
virtual void transform (const VectorSlice< const std::vector< DerivativeForm< 1, dim, spacedim > > > input, const MappingType type, const typename Mapping< dim, spacedim >::InternalDataBase &internal, VectorSlice< std::vector< Tensor< 2, spacedim > > > output) const
 
virtual void transform (const VectorSlice< const std::vector< Tensor< 2, dim > > > input, const MappingType type, const typename Mapping< dim, spacedim >::InternalDataBase &internal, VectorSlice< std::vector< Tensor< 2, spacedim > > > output) const
 
virtual void transform (const VectorSlice< const std::vector< DerivativeForm< 2, dim, spacedim > > > input, const MappingType type, const typename Mapping< dim, spacedim >::InternalDataBase &internal, VectorSlice< std::vector< Tensor< 3, spacedim > > > output) const
 
virtual void transform (const VectorSlice< const std::vector< Tensor< 3, dim > > > input, const MappingType type, const typename Mapping< dim, spacedim >::InternalDataBase &internal, VectorSlice< std::vector< Tensor< 3, spacedim > > > output) const
 
- Public Member Functions inherited from Mapping< dim, spacedim >
virtual ~Mapping ()
 
virtual std_cxx11::array< Point< spacedim >, GeometryInfo< dim >::vertices_per_cell > get_vertices (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
 
 DeclException0 (ExcInvalidData)
 
 DeclExceptionMsg (ExcTransformationFailed,"Computing the mapping between a real space point and a point in reference ""space failed, typically because the given point lies outside the cell ""where the inverse mapping is not unique.")
 
 DeclException3 (ExcDistortedMappedCell, Point< spacedim >, double, int,<< "The image of the mapping applied to cell with center ["<< arg1<< "] is distorted. The cell geometry or the "<< "mapping are invalid, giving a non-positive volume "<< "fraction of "<< arg2<< " in quadrature point "<< arg3<< ".")
 
- Public Member Functions inherited from Subscriptor
 Subscriptor ()
 
 Subscriptor (const Subscriptor &)
 
virtual ~Subscriptor ()
 
Subscriptoroperator= (const Subscriptor &)
 
void subscribe (const char *identifier=0) const
 
void unsubscribe (const char *identifier=0) const
 
unsigned int n_subscriptions () const
 
void list_subscribers () const
 
 DeclException3 (ExcInUse, int, char *, std::string &,<< "Object of class "<< arg2<< " is still used by "<< arg1<< " other objects."<< "\n\n"<< "(Additional information: "<< arg3<< ")\n\n"<< "See the entry in the Frequently Asked Questions of "<< "deal.II (linked to from http://www.dealii.org/) for "<< "a lot more information on what this error means and "<< "how to fix programs in which it happens.")
 
 DeclException2 (ExcNoSubscriber, char *, char *,<< "No subscriber with identifier <"<< arg2<< "> subscribes to this object of class "<< arg1<< ". Consequently, it cannot be unsubscribed.")
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Protected Types

typedef QProjector< dim >::DataSetDescriptor DataSetDescriptor
 

Protected Member Functions

template<int dim_>
Point< dim_ > transform_real_to_unit_cell_internal_codim1 (const typename Triangulation< dim_, dim_+1 >::cell_iterator &cell, const Point< dim_+1 > &p, const Point< dim_ > &initial_p_unit, InternalData &mdata) const
 
Point< dim > transform_real_to_unit_cell_initial_guess (const std::vector< Point< spacedim > > &vertex, const Point< spacedim > &p) const
 
void compute_shapes (const std::vector< Point< dim > > &unit_points, InternalData &data) const
 
virtual void compute_shapes_virtual (const std::vector< Point< dim > > &unit_points, InternalData &data) const
 
Point< spacedim > transform_unit_to_real_cell_internal (const InternalData &mdata) const
 
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, InternalData &mdata) const
 
virtual void compute_mapping_support_points (const typename Triangulation< dim, spacedim >::cell_iterator &cell, std::vector< Point< spacedim > > &a) 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, InternalData &mdata) 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, InternalData &mdata) const
 
template<>
Point< 1 > transform_real_to_unit_cell_internal (const Triangulation< 1, 3 >::cell_iterator &, const Point< 3 > &, const Point< 1 > &, InternalData &) const
 
Interface with FEValues
virtual UpdateFlags requires_update_flags (const UpdateFlags update_flags) const
 
virtual InternalDataget_data (const UpdateFlags, const Quadrature< dim > &quadrature) const
 
virtual Mapping< dim, spacedim >::InternalDataBaseget_face_data (const UpdateFlags flags, const Quadrature< dim-1 > &quadrature) const
 
virtual Mapping< dim, spacedim >::InternalDataBaseget_subface_data (const UpdateFlags flags, const Quadrature< dim-1 > &quadrature) const
 
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
 
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
 
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
 
Interface with FEValues

Static Protected Attributes

static const unsigned int n_shape_functions = GeometryInfo<dim>::vertices_per_cell
 

Detailed Description

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

Mapping of the reference to cell to a general quadrilateral/hexahedra by \(d\)-linear shape functions.

This function maps the reference (unit) cell to a general grid cell with straight lines in \(d\) dimensions. (Note, however, that in 3D the faces of a general, trilinearly mapped cell may be curved, even if the edges are not). This is the standard mapping used for polyhedral domains. It is also the mapping used throughout deal.II for many functions that two variants, one that allows to pass a mapping argument explicitly and one that simply falls back to the MappingQ1 class declared here.

The shape functions for this mapping are the same as for the finite element FE_Q of order 1. Therefore, coupling these two yields an isoparametric element.

Author
Guido Kanschat, 2000, 2001; Ralf Hartmann, 2000, 2001, 2005

Definition at line 54 of file mapping_q1.h.

Member Typedef Documentation

template<int dim, int spacedim = dim>
typedef QProjector<dim>::DataSetDescriptor MappingQ1< dim, spacedim >::DataSetDescriptor
protected

Declare a convenience typedef for the class that describes offsets into quadrature formulas projected onto faces and subfaces.

Definition at line 462 of file mapping_q1.h.

Constructor & Destructor Documentation

template<int dim, int spacedim>
MappingQ1< dim, spacedim >::MappingQ1 ( )

Default constructor.

Definition at line 197 of file mapping_q1.cc.

Member Function Documentation

template<int dim, int spacedim>
Mapping< dim, spacedim > * MappingQ1< dim, spacedim >::clone ( ) const
virtual

Return a pointer to a copy of the present object. The caller of this copy then assumes ownership of it.

The function is declared abstract virtual in this base class, and derived classes will have to implement it.

This function is mainly used by the hp::MappingCollection class.

Implements Mapping< dim, spacedim >.

Reimplemented in MappingQ< dim, spacedim >, MappingQEulerian< dim, VECTOR, spacedim >, MappingQ1Eulerian< dim, VECTOR, spacedim >, and MappingC1< dim, spacedim >.

Definition at line 2861 of file mapping_q1.cc.

template<int dim, int spacedim = dim>
virtual bool MappingQ1< dim, spacedim >::preserves_vertex_locations ( ) const
virtual

Always returns true because MappingQ1 preserves vertex locations.

Implements Mapping< dim, spacedim >.

Reimplemented in MappingQEulerian< dim, VECTOR, spacedim >, and MappingQ1Eulerian< dim, VECTOR, spacedim >.

template<int dim, int spacedim>
Point< spacedim > MappingQ1< dim, spacedim >::transform_unit_to_real_cell ( const typename Triangulation< dim, spacedim >::cell_iterator &  cell,
const Point< dim > &  p 
) const
virtual

Maps the point p on the unit cell to the corresponding point on the real cell cell.

Parameters
cellIterator to the cell that will be used to define the mapping.
pLocation of a point on the reference cell.
Returns
The location of the reference point mapped to real space using the mapping defined by the class derived from the current one that implements the mapping, and the coordinates of the cell identified by the first argument.

Implements Mapping< dim, spacedim >.

Reimplemented in MappingQ< dim, spacedim >.

Definition at line 2182 of file mapping_q1.cc.

template<int dim, int spacedim>
Point< dim > MappingQ1< dim, spacedim >::transform_real_to_unit_cell ( const typename Triangulation< dim, spacedim >::cell_iterator &  cell,
const Point< spacedim > &  p 
) const
virtual

Maps the point p on the real cell to the corresponding point on the unit cell, and return its coordinates. This function provides the inverse of the mapping provided by transform_unit_to_real_cell().

In the codimension one case, this function returns the normal projection of the real point p on the curve or surface identified by the cell.

Note
Polynomial mappings from the reference (unit) cell coordinates to the coordinate system of a real cell are not always invertible if the point for which the inverse mapping is to be computed lies outside the cell's boundaries. In such cases, the current function may fail to compute a point on the reference cell whose image under the mapping equals the given point p. If this is the case then this function throws an exception of type Mapping::ExcTransformationFailed . Whether the given point p lies outside the cell can therefore be determined by checking whether the return reference coordinates lie inside or outside the reference cell (e.g., using GeometryInfo::is_inside_unit_cell()) or whether the exception mentioned above has been thrown.
Parameters
cellIterator to the cell that will be used to define the mapping.
pLocation of a point on the given cell.
Returns
The reference cell location of the point that when mapped to real space equals the coordinates given by the second argument. This mapping uses the mapping defined by the class derived from the current one that implements the mapping, and the coordinates of the cell identified by the first argument.

Implements Mapping< dim, spacedim >.

Reimplemented in MappingQ< dim, spacedim >.

Definition at line 2372 of file mapping_q1.cc.

template<int dim, int spacedim>
void MappingQ1< dim, spacedim >::transform ( const VectorSlice< const std::vector< Tensor< 1, dim > > >  input,
const MappingType  type,
const typename Mapping< dim, spacedim >::InternalDataBase internal,
VectorSlice< std::vector< Tensor< 1, spacedim > > >  output 
) const
virtual

Transform a field of vectors or 1-differential forms according to the selected MappingType.

Note
Normally, this function is called by a finite element, filling FEValues objects. For this finite element, there should be an alias MappingType like mapping_bdm, mapping_nedelec, etc. This alias should be preferred to using the types below.

The mapping types currently implemented by derived classes are:

  • mapping_contravariant: maps a vector field on the reference cell is to the physical cell through the Jacobian:

    \[ \mathbf u(\mathbf x) = J(\hat{\mathbf x})\hat{\mathbf u}(\hat{\mathbf x}). \]

    In physics, this is usually referred to as the contravariant transformation. Mathematically, it is the push forward of a vector field.

  • mapping_covariant: maps a field of one-forms on the reference cell to a field of one-forms on the physical cell. (Theoretically this would refer to a DerivativeForm<1,dim,1> but we canonically identify this type with a Tensor<1,dim>). Mathematically, it is the pull back of the differential form

    \[ \mathbf u(\mathbf x) = J(\hat{\mathbf x})(J(\hat{\mathbf x})^{T} J(\hat{\mathbf x}))^{-1}\hat{\mathbf u}(\hat{\mathbf x}). \]

    Gradients of scalar differentiable functions are transformed this way.

    In the case when dim=spacedim the previous formula reduces to

    \[ \mathbf u(\mathbf x) = J(\hat{\mathbf x})^{-T}\hat{\mathbf u}(\hat{\mathbf x}) \]

    because we assume that the mapping \(\mathbf F_K\) is always invertible, and consequently its Jacobian \(J\) is an invertible matrix.

  • mapping_piola: A field of dim-1-forms on the reference cell is also represented by a vector field, but again transforms differently, namely by the Piola transform

    \[ \mathbf u(\mathbf x) = \frac{1}{\text{det}\;J(\mathbf x)} J(\mathbf x) \hat{\mathbf u}(\mathbf x). \]

Parameters
[in]inputAn array (or part of an array) of input objects that should be mapped.
[in]typeThe kind of mapping to be applied.
[in]internalA pointer to an object of type Mapping::InternalDataBase that contains information previously stored by the mapping. The object pointed to was created by the get_data(), get_face_data(), or get_subface_data() function, and will have been updated as part of a call to fill_fe_values(), fill_fe_face_values(), or fill_fe_subface_values() for the current cell, before calling the current function. In other words, this object also represents with respect to which cell the transformation should be applied to.
[out]outputAn array (or part of an array) into which the transformed objects should be placed.

Implements Mapping< dim, spacedim >.

Reimplemented in MappingQ< dim, spacedim >.

Definition at line 2058 of file mapping_q1.cc.

template<int dim, int spacedim>
void MappingQ1< dim, spacedim >::transform ( const VectorSlice< const std::vector< DerivativeForm< 1, dim, spacedim > > >  input,
const MappingType  type,
const typename Mapping< dim, spacedim >::InternalDataBase internal,
VectorSlice< std::vector< Tensor< 2, spacedim > > >  output 
) const
virtual

Transform a field of differential forms from the reference cell to the physical cell. It is useful to think of \(\mathbf{T} = \nabla \mathbf u\) and \(\hat{\mathbf T} = \hat \nabla \hat{\mathbf u}\), with \(\mathbf u\) a vector field. The mapping types currently implemented by derived classes are:

  • mapping_covariant: maps a field of forms on the reference cell to a field of forms on the physical cell. Mathematically, it is the pull back of the differential form

    \[ \mathbf T(\mathbf x) = \hat{\mathbf T}(\hat{\mathbf x}) J(\hat{\mathbf x})(J(\hat{\mathbf x})^{T} J(\hat{\mathbf x}))^{-1}. \]

    Jacobians of spacedim-vector valued differentiable functions are transformed this way.

    In the case when dim=spacedim the previous formula reduces to

    \[ \mathbf T(\mathbf x) = \hat{\mathbf u}(\hat{\mathbf x}) J(\hat{\mathbf x})^{-1}. \]

Note
It would have been more reasonable to make this transform a template function with the rank in DerivativeForm<1, dim, rank>. Unfortunately C++ does not allow templatized virtual functions. This is why we identify DerivativeForm<1, dim, 1> with a Tensor<1,dim> when using mapping_covariant() in the function transform() above this one.
Parameters
[in]inputAn array (or part of an array) of input objects that should be mapped.
[in]typeThe kind of mapping to be applied.
[in]internalA pointer to an object of type Mapping::InternalDataBase that contains information previously stored by the mapping. The object pointed to was created by the get_data(), get_face_data(), or get_subface_data() function, and will have been updated as part of a call to fill_fe_values(), fill_fe_face_values(), or fill_fe_subface_values() for the current cell, before calling the current function. In other words, this object also represents with respect to which cell the transformation should be applied to.
[out]outputAn array (or part of an array) into which the transformed objects should be placed.

Implements Mapping< dim, spacedim >.

Reimplemented in MappingQ< dim, spacedim >.

Definition at line 2071 of file mapping_q1.cc.

template<int dim, int spacedim>
void MappingQ1< dim, spacedim >::transform ( const VectorSlice< const std::vector< Tensor< 2, dim > > >  input,
const MappingType  type,
const typename Mapping< dim, spacedim >::InternalDataBase internal,
VectorSlice< std::vector< Tensor< 2, spacedim > > >  output 
) const
virtual

Transform a tensor field from the reference cell to the physical cell. These tensors are usually the Jacobians in the reference cell of vector fields that have been pulled back from the physical cell. The mapping types currently implemented by derived classes are:

  • mapping_contravariant_gradient: it assumes \(\mathbf u(\mathbf x) = J \hat{\mathbf u}\) so that

    \[ \mathbf T(\mathbf x) = J(\hat{\mathbf x}) \hat{\mathbf T}(\hat{\mathbf x}) J(\hat{\mathbf x})^{-1}. \]

  • mapping_covariant_gradient: it assumes \(\mathbf u(\mathbf x) = J^{-T} \hat{\mathbf u}\) so that

    \[ \mathbf T(\mathbf x) = J(\hat{\mathbf x})^{-T} \hat{\mathbf T}(\hat{\mathbf x}) J(\hat{\mathbf x})^{-1}. \]

  • mapping_piola_gradient: it assumes \(\mathbf u(\mathbf x) = \frac{1}{\text{det}\;J(\mathbf x)} J(\mathbf x) \hat{\mathbf u}(\mathbf x)\) so that

    \[ \mathbf T(\mathbf x) = \frac{1}{\text{det}\;J(\mathbf x)} J(\hat{\mathbf x}) \hat{\mathbf T}(\hat{\mathbf x}) J(\hat{\mathbf x})^{-1}. \]

Todo:
The formulas for mapping_covariant_gradient, mapping_contravariant_gradient and mapping_piola_gradient are only true as stated for linear mappings. If, for example, the mapping is bilinear (or has a higher order polynomial degree) then there is a missing term associated with the derivative of \(J\).
Parameters
[in]inputAn array (or part of an array) of input objects that should be mapped.
[in]typeThe kind of mapping to be applied.
[in]internalA pointer to an object of type Mapping::InternalDataBase that contains information previously stored by the mapping. The object pointed to was created by the get_data(), get_face_data(), or get_subface_data() function, and will have been updated as part of a call to fill_fe_values(), fill_fe_face_values(), or fill_fe_subface_values() for the current cell, before calling the current function. In other words, this object also represents with respect to which cell the transformation should be applied to.
[out]outputAn array (or part of an array) into which the transformed objects should be placed.

Implements Mapping< dim, spacedim >.

Reimplemented in MappingQ< dim, spacedim >.

Definition at line 2084 of file mapping_q1.cc.

template<int dim, int spacedim>
void MappingQ1< dim, spacedim >::transform ( const VectorSlice< const std::vector< DerivativeForm< 2, dim, spacedim > > >  input,
const MappingType  type,
const typename Mapping< dim, spacedim >::InternalDataBase internal,
VectorSlice< std::vector< Tensor< 3, spacedim > > >  output 
) const
virtual

Transform a tensor field from the reference cell to the physical cell. This tensors are most of times the hessians in the reference cell of vector fields that have been pulled back from the physical cell.

The mapping types currently implemented by derived classes are:

  • mapping_covariant_gradient: maps a field of forms on the reference cell to a field of forms on the physical cell. Mathematically, it is the pull back of the differential form

    \[ \mathbf T_{ijk}(\mathbf x) = \hat{\mathbf T}_{iJK}(\hat{\mathbf x}) J_{jJ}^{\dagger} J_{kK}^{\dagger}\]

    ,

    where

    \[ J^{\dagger} = J(\hat{\mathbf x})(J(\hat{\mathbf x})^{T} J(\hat{\mathbf x}))^{-1}. \]

    Hessians of spacedim-vector valued differentiable functions are transformed this way (After subtraction of the product of the derivative with the Jacobian gradient).

    In the case when dim=spacedim the previous formula reduces to

    \[J^{\dagger} = J^{-1}\]

    Parameters
    [in]inputAn array (or part of an array) of input objects that should be mapped.
    [in]typeThe kind of mapping to be applied.
    [in]internalA pointer to an object of type Mapping::InternalDataBase that contains information previously stored by the mapping. The object pointed to was created by the get_data(), get_face_data(), or get_subface_data() function, and will have been updated as part of a call to fill_fe_values(), fill_fe_face_values(), or fill_fe_subface_values() for the current cell, before calling the current function. In other words, this object also represents with respect to which cell the transformation should be applied to.
    [out]outputAn array (or part of an array) into which the transformed objects should be placed.

Implements Mapping< dim, spacedim >.

Reimplemented in MappingQ< dim, spacedim >.

Definition at line 2110 of file mapping_q1.cc.

template<int dim, int spacedim>
void MappingQ1< dim, spacedim >::transform ( const VectorSlice< const std::vector< Tensor< 3, dim > > >  input,
const MappingType  type,
const typename Mapping< dim, spacedim >::InternalDataBase internal,
VectorSlice< std::vector< Tensor< 3, spacedim > > >  output 
) const
virtual

Transform a field of 3-differential forms from the reference cell to the physical cell. It is useful to think of \(\mathbf{T}_{ijk} = D^2_{jk} \mathbf u_i\) and \(\mathbf{\hat T}_{IJK} = \hat D^2_{JK} \mathbf{\hat u}_I\), with \(\mathbf u_i\) a vector field.

The mapping types currently implemented by derived classes are:

  • mapping_contravariant_hessian: it assumes \(\mathbf u_i(\mathbf x) = J_{iI} \hat{\mathbf u}_I\) so that

    \[ \mathbf T_{ijk}(\mathbf x) = J_{iI}(\hat{\mathbf x}) \hat{\mathbf T}_{IJK}(\hat{\mathbf x}) J_{jJ}(\hat{\mathbf x})^{-1} J_{kK}(\hat{\mathbf x})^{-1}. \]

  • mapping_covariant_hessian: it assumes \(\mathbf u_i(\mathbf x) = J_{iI}^{-T} \hat{\mathbf u}_I\) so that

    \[ \mathbf T_{ijk}(\mathbf x) = J_iI(\hat{\mathbf x})^{-1} \hat{\mathbf T}_{IJK}(\hat{\mathbf x}) J_{jJ}(\hat{\mathbf x})^{-1} J_{kK}(\hat{\mathbf x})^{-1}. \]

  • mapping_piola_hessian: it assumes \(\mathbf u_i(\mathbf x) = \frac{1}{\text{det}\;J(\mathbf x)} J_{iI}(\mathbf x) \hat{\mathbf u}(\mathbf x)\) so that

    \[ \mathbf T_{ijk}(\mathbf x) = \frac{1}{\text{det}\;J(\mathbf x)} J_{iI}(\hat{\mathbf x}) \hat{\mathbf T}_{IJK}(\hat{\mathbf x}) J_{jJ}(\hat{\mathbf x})^{-1} J_{kK}(\hat{\mathbf x})^{-1}. \]

Parameters
[in]inputAn array (or part of an array) of input objects that should be mapped.
[in]typeThe kind of mapping to be applied.
[in]internalA pointer to an object of type Mapping::InternalDataBase that contains information previously stored by the mapping. The object pointed to was created by the get_data(), get_face_data(), or get_subface_data() function, and will have been updated as part of a call to fill_fe_values(), fill_fe_face_values(), or fill_fe_subface_values() for the current cell, before calling the current function. In other words, this object also represents with respect to which cell the transformation should be applied to.
[out]outputAn array (or part of an array) into which the transformed objects should be placed.

Implements Mapping< dim, spacedim >.

Reimplemented in MappingQ< dim, spacedim >.

Definition at line 2159 of file mapping_q1.cc.

template<int dim, int spacedim>
UpdateFlags MappingQ1< dim, spacedim >::requires_update_flags ( const UpdateFlags  update_flags) const
protectedvirtual

Given a set of update flags, compute which other quantities also need to be computed in order to satisfy the request by the given flags. Then return the combination of the original set of flags and those just computed.

As an example, if update_flags contains update_JxW_values (i.e., the product of the determinant of the Jacobian and the weights provided by the quadrature formula), a mapping may require the computation of the full Jacobian matrix in order to compute its determinant. They would then return not just update_JxW_values, but also update_jacobians. (This is not how it is actually done internally in the derived classes that compute the JxW values – they set update_contravariant_transformation instead, from which the determinant can also be computed – but this does not take away from the instructiveness of the example.)

An extensive discussion of the interaction between this function and FEValues can be found in the How Mapping, FiniteElement, and FEValues work together documentation module.

See also
UpdateFlags

Implements Mapping< dim, spacedim >.

Definition at line 685 of file mapping_q1.cc.

template<int dim, int spacedim>
MappingQ1< dim, spacedim >::InternalData * MappingQ1< dim, spacedim >::get_data ( const UpdateFlags  update_flags,
const Quadrature< dim > &  quadrature 
) const
protectedvirtual

Create and return a pointer to an object into which mappings can store data that only needs to be computed once but that can then be used whenever the mapping is applied to a concrete cell (e.g., in the various transform() functions, as well as in the fill_fe_values(), fill_fe_face_values() and fill_fe_subface_values() that form the interface of mappings with the FEValues class).

Derived classes will return pointers to objects of a type derived from Mapping::InternalDataBase (see there for more information) and may pre-compute some information already (in accordance with what will be asked of the mapping in the future, as specified by the update flags) and for the given quadrature object. Subsequent calls to transform() or fill_fe_values() and friends will then receive back the object created here (with the same set of update flags and for the same quadrature object). Derived classes can therefore pre-compute some information in their get_data() function and store it in the internal data object.

The mapping classes do not keep track of the objects created by this function. Ownership will therefore rest with the caller.

An extensive discussion of the interaction between this function and FEValues can be found in the How Mapping, FiniteElement, and FEValues work together documentation module.

Parameters
update_flagsA set of flags that define what is expected of the mapping class in future calls to transform() or the fill_fe_values() group of functions. This set of flags may contain flags that mappings do not know how to deal with (e.g., for information that is in fact computed by the finite element classes, such as UpdateFlags::update_values). Derived classes will need to store these flags, or at least that subset of flags that will require the mapping to perform any actions in fill_fe_values(), in InternalDataBase::update_each.
quadratureThe quadrature object for which mapping information will have to be computed. This includes the locations and weights of quadrature points.
Returns
A pointer to a newly created object of type InternalDataBase (or a derived class). Ownership of this object passes to the calling function.
Note
C++ allows that virtual functions in derived classes may return pointers to objects not of type InternalDataBase but in fact pointers to objects of classes derived from InternalDataBase. (This feature is called "covariant return types".) This is useful in some contexts where the calling is within the derived class and will immediately make use of the returned object, knowing its real (derived) type.

Implements Mapping< dim, spacedim >.

Reimplemented in MappingQ< dim, spacedim >.

Definition at line 745 of file mapping_q1.cc.

template<int dim, int spacedim>
Mapping< dim, spacedim >::InternalDataBase * MappingQ1< dim, spacedim >::get_face_data ( const UpdateFlags  update_flags,
const Quadrature< dim-1 > &  quadrature 
) const
protectedvirtual

Like get_data(), but in preparation for later calls to transform() or fill_fe_face_values() that will need information about mappings from the reference face to a face of a concrete cell.

Parameters
update_flagsA set of flags that define what is expected of the mapping class in future calls to transform() or the fill_fe_values() group of functions. This set of flags may contain flags that mappings do not know how to deal with (e.g., for information that is in fact computed by the finite element classes, such as UpdateFlags::update_values). Derived classes will need to store these flags, or at least that subset of flags that will require the mapping to perform any actions in fill_fe_values(), in InternalDataBase::update_each.
quadratureThe quadrature object for which mapping information will have to be computed. This includes the locations and weights of quadrature points.
Returns
A pointer to a newly created object of type InternalDataBase (or a derived class). Ownership of this object passes to the calling function.
Note
C++ allows that virtual functions in derived classes may return pointers to objects not of type InternalDataBase but in fact pointers to objects of classes derived from InternalDataBase. (This feature is called "covariant return types".) This is useful in some contexts where the calling is within the derived class and will immediately make use of the returned object, knowing its real (derived) type.

Implements Mapping< dim, spacedim >.

Reimplemented in MappingQ< dim, spacedim >.

Definition at line 759 of file mapping_q1.cc.

template<int dim, int spacedim>
Mapping< dim, spacedim >::InternalDataBase * MappingQ1< dim, spacedim >::get_subface_data ( const UpdateFlags  update_flags,
const Quadrature< dim-1 > &  quadrature 
) const
protectedvirtual

Like get_data() and get_face_data(), but in preparation for later calls to transform() or fill_fe_subface_values() that will need information about mappings from the reference face to a child of a face (i.e., subface) of a concrete cell.

Parameters
update_flagsA set of flags that define what is expected of the mapping class in future calls to transform() or the fill_fe_values() group of functions. This set of flags may contain flags that mappings do not know how to deal with (e.g., for information that is in fact computed by the finite element classes, such as UpdateFlags::update_values). Derived classes will need to store these flags, or at least that subset of flags that will require the mapping to perform any actions in fill_fe_values(), in InternalDataBase::update_each.
quadratureThe quadrature object for which mapping information will have to be computed. This includes the locations and weights of quadrature points.
Returns
A pointer to a newly created object of type InternalDataBase (or a derived class). Ownership of this object passes to the calling function.
Note
C++ allows that virtual functions in derived classes may return pointers to objects not of type InternalDataBase but in fact pointers to objects of classes derived from InternalDataBase. (This feature is called "covariant return types".) This is useful in some contexts where the calling is within the derived class and will immediately make use of the returned object, knowing its real (derived) type.

Implements Mapping< dim, spacedim >.

Reimplemented in MappingQ< dim, spacedim >.

Definition at line 776 of file mapping_q1.cc.

template<int dim, int spacedim = dim>
CellSimilarity::Similarity MappingQ1< dim, spacedim >::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
protectedvirtual

Compute information about the mapping from the reference cell to the real cell indicated by the first argument to this function. Derived classes will have to implement this function based on the kind of mapping they represent. It is called by FEValues::reinit().

Conceptually, this function's represents the application of the mapping \(\mathbf x=\mathbf F_K(\hat {\mathbf x})\) from reference coordinates \(\mathbf\in [0,1]^d\) to real space coordinates \(\mathbf x\) for a given cell \(K\). Its purpose is to compute the following kinds of data:

  • Data that results from the application of the mapping itself, e.g., computing the location \(\mathbf x_q = \mathbf F_K(\hat{\mathbf x}_q)\) of quadrature points on the real cell, and that is directly useful to users of FEValues, for example during assembly.
  • Data that is necessary for finite element implementations to compute their shape functions on the real cell. To this end, the FEValues::reinit() function calls FiniteElement::fill_fe_values() after the current function, and the output of this function serves as input to FiniteElement::fill_fe_values(). Examples of information that needs to be computed here for use by the finite element classes is the Jacobian of the mapping, \(\hat\nabla \mathbf F_K(\hat{\mathbf x})\) or its inverse, for example to transform the gradients of shape functions on the reference cell to the gradients of shape functions on the real cell.

The information computed by this function is used to fill the various member variables of the output argument of this function. Which of the member variables of that structure should be filled is determined by the update flags stored in the Mapping::InternalDataBase object passed to this function.

An extensive discussion of the interaction between this function and FEValues can be found in the How Mapping, FiniteElement, and FEValues work together documentation module.

Parameters
[in]cellThe cell of the triangulation for which this function is to compute a mapping from the reference cell to.
[in]cell_similarityWhether or not the cell given as first argument is simply a translation, rotation, etc of the cell for which this function was called the most recent time. This information is computed simply by matching the vertices (as stored by the Triangulation) between the previous and the current cell. The value passed here may be modified by implementations of this function and should then be returned (see the discussion of the return value of this function).
[in]quadratureA reference to the quadrature formula in use for the current evaluation. This quadrature object is the same as the one used when creating the internal_data object. The object is used both to map the location of quadrature points, as well as to compute the JxW values for each quadrature point (which involves the quadrature weights).
[in]internal_dataA reference to an object previously created by get_data() and that may be used to store information the mapping can compute once on the reference cell. See the documentation of the Mapping::InternalDataBase class for an extensive description of the purpose of these objects.
[out]output_dataA reference to an object whose member variables should be computed. Not all of the members of this argument need to be filled; which ones need to be filled is determined by the update flags stored inside the internal_data object.
Returns
An updated value of the cell_similarity argument to this function. The returned value will be used for the corresponding argument when FEValues::reinit() calls FiniteElement::fill_fe_values(). In most cases, derived classes will simply want to return the value passed for cell_similarity. However, implementations of this function may downgrade the level of cell similarity. This is, for example, the case for classes that take not only into account the locations of the vertices of a cell (as reported by the Triangulation), but also other information specific to the mapping. The purpose is that FEValues::reinit() can compute whether a cell is similar to the previous one only based on the cell's vertices, whereas the mapping may also consider displacement fields (e.g., in the MappingQ1Eulerian and MappingFEField classes). In such cases, the mapping may conclude that the previously computed cell similarity is too optimistic, and invalidate it for subsequent use in FiniteElement::fill_fe_values() by returning a less optimistic cell similarity value.
Note
FEValues ensures that this function is always called with the same pair of internal_data and objects. In other words, if an implementation of this function knows that it has written a piece of data into the output argument in a previous call, then there is no need to copy it there again in a later call if the implementation knows that this is the same value.

Implements Mapping< dim, spacedim >.

Definition at line 1284 of file mapping_q1.cc.

template<int dim, int spacedim = dim>
void MappingQ1< dim, spacedim >::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
protectedvirtual

This function is the equivalent to Mapping::fill_fe_values(), but for faces of cells. See there for an extensive discussion of its purpose. It is called by FEFaceValues::reinit().

Parameters
[in]cellThe cell of the triangulation for which this function is to compute a mapping from the reference cell to.
[in]face_noThe number of the face of the given cell for which information is requested.
[in]quadratureA reference to the quadrature formula in use for the current evaluation. This quadrature object is the same as the one used when creating the internal_data object. The object is used both to map the location of quadrature points, as well as to compute the JxW values for each quadrature point (which involves the quadrature weights).
[in]internal_dataA reference to an object previously created by get_data() and that may be used to store information the mapping can compute once on the reference cell. See the documentation of the Mapping::InternalDataBase class for an extensive description of the purpose of these objects.
[out]output_dataA reference to an object whose member variables should be computed. Not all of the members of this argument need to be filled; which ones need to be filled is determined by the update flags stored inside the internal_data object.

Implements Mapping< dim, spacedim >.

Definition at line 1669 of file mapping_q1.cc.

template<int dim, int spacedim = dim>
void MappingQ1< dim, spacedim >::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
protectedvirtual

This function is the equivalent to Mapping::fill_fe_values(), but for subfaces (i.e., children of faces) of cells. See there for an extensive discussion of its purpose. It is called by FESubfaceValues::reinit().

Parameters
[in]cellThe cell of the triangulation for which this function is to compute a mapping from the reference cell to.
[in]face_noThe number of the face of the given cell for which information is requested.
[in]subface_noThe number of the child of a face of the given cell for which information is requested.
[in]quadratureA reference to the quadrature formula in use for the current evaluation. This quadrature object is the same as the one used when creating the internal_data object. The object is used both to map the location of quadrature points, as well as to compute the JxW values for each quadrature point (which involves the quadrature weights).
[in]internal_dataA reference to an object previously created by get_data() and that may be used to store information the mapping can compute once on the reference cell. See the documentation of the Mapping::InternalDataBase class for an extensive description of the purpose of these objects.
[out]output_dataA reference to an object whose member variables should be computed. Not all of the members of this argument need to be filled; which ones need to be filled is determined by the update flags stored inside the internal_data object.

Implements Mapping< dim, spacedim >.

Definition at line 1713 of file mapping_q1.cc.

template<int dim, int spacedim>
Point< dim > MappingQ1< dim, spacedim >::transform_real_to_unit_cell_initial_guess ( const std::vector< Point< spacedim > > &  vertex,
const Point< spacedim > &  p 
) const
protected

Compute an initial guess to pass to the Newton method in transform_real_to_unit_cell. For the initial guess we proceed in the following way:

  • find the least square dim-dimensional plane approximating the cell vertices, i.e. we find and affine map A x_hat + b from the reference cell to the real space.
  • Solve the equation A x_hat + b = p for x_hat
  • This x_hat is the initial solution used for the Newton Method.
Note
if dim<spacedim we first project p onto the plane.
if dim==1 (for any spacedim) the initial guess is the exact solution and no Newton iteration is needed. Some details about how we compute the least square plane. We look for a spacedim x (dim + 1) matrix X such that X * M = Y where M is a (dim+1) x n_vertices matrix and Y a spacedim x n_vertices. And: The i-th column of M is unit_vertex[i] and the last row all 1's. The i-th column of Y is real_vertex[i]. If we split X=[A|b], the least square approx is A x_hat+b Classically X = Y * (M^t (M M^t)^{-1}) Let K = M^t * (M M^t)^{-1} = [KA Kb] this can be precomputed, and that is exactly what we do. Finally A = Y*KA and b = Y*Kb.

Definition at line 2325 of file mapping_q1.cc.

template<int dim, int spacedim>
void MappingQ1< dim, spacedim >::compute_shapes ( const std::vector< Point< dim > > &  unit_points,
InternalData data 
) const
protected

Compute shape values and/or derivatives.

Calls either the compute_shapes_virtual of this class or that of the derived class, depending on whether data.is_mapping_q1_data equals true or false.

Definition at line 204 of file mapping_q1.cc.

template<int dim, int spacedim>
void MappingQ1< dim, spacedim >::compute_shapes_virtual ( const std::vector< Point< dim > > &  unit_points,
InternalData data 
) const
protectedvirtual

Compute shape values and/or derivatives.

Definition at line 673 of file mapping_q1.cc.

template<int dim, int spacedim>
Point< spacedim > MappingQ1< dim, spacedim >::transform_unit_to_real_cell_internal ( const InternalData mdata) const
protected

Transforms a point p on the unit cell to the point p_real on the real cell cell and returns p_real.

This function is called by transform_unit_to_real_cell and multiple times (through the Newton iteration) by transform_real_to_unit_cell_internal.

Takes a reference to an InternalData that must already include the shape values at point p and the mapping support points of the cell.

This InternalData argument avoids multiple computations of the shape values at point p and especially multiple computations of the mapping support points.

Definition at line 2215 of file mapping_q1.cc.

template<int dim, int spacedim>
Point< dim > MappingQ1< dim, spacedim >::transform_real_to_unit_cell_internal ( const typename Triangulation< dim, spacedim >::cell_iterator &  cell,
const Point< spacedim > &  p,
const Point< dim > &  initial_p_unit,
InternalData mdata 
) const
protected

Transforms the point p on the real cell to the corresponding point on the unit cell cell by a Newton iteration.

Takes a reference to an InternalData that is assumed to be previously created by the get_data function with UpdateFlags including update_transformation_values and update_transformation_gradients and a one point Quadrature that includes the given initial guess for the transformation initial_p_unit. Hence this function assumes that mdata already includes the transformation shape values and gradients computed at initial_p_unit.

mdata will be changed by this function.

Definition at line 2505 of file mapping_q1.cc.

template<int dim, int spacedim>
void MappingQ1< dim, spacedim >::compute_mapping_support_points ( const typename Triangulation< dim, spacedim >::cell_iterator &  cell,
std::vector< Point< spacedim > > &  a 
) const
protectedvirtual

Computes the support points of the mapping. For MappingQ1 these are the vertices. However, other classes may override this function. In particular, the MappingQ1Eulerian class does exactly this by not computing the support points from the geometry of the current cell but instead evaluating an externally given displacement field in addition to the geometry of the cell.

Reimplemented in MappingQ< dim, spacedim >, and MappingQEulerian< dim, VECTOR, spacedim >.

Definition at line 1267 of file mapping_q1.cc.

Member Data Documentation

template<int dim, int spacedim = dim>
DEAL_II_NAMESPACE_OPEN const unsigned int MappingQ1< dim, spacedim >::n_shape_functions = GeometryInfo<dim>::vertices_per_cell
staticprotected

Number of shape functions. Is simply the number of vertices per cell for the Q1 mapping.

Definition at line 535 of file mapping_q1.h.


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