Reference documentation for deal.II version 9.6.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\}}\)
Loading...
Searching...
No Matches

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

Classes

struct  ShapeFunctionData
 

Public Types

using value_type = ::Tensor<2, spacedim>
 
using divergence_type = ::Tensor<1, spacedim>
 
using gradient_type = ::Tensor<3, spacedim>
 
template<typename Number >
using solution_value_type = typename ProductType<Number, value_type>::type
 
template<typename Number >
using solution_divergence_type
 
template<typename Number >
using solution_gradient_type
 

Public Member Functions

 Tensor ()
 
 Tensor (const Tensor< 2, dim, spacedim > &)=delete
 
 Tensor (Tensor< 2, dim, spacedim > &&)=default
 
 ~Tensor ()=default
 
 Tensor (const FEValuesBase< dim, spacedim > &fe_values_base, const unsigned int first_tensor_component)
 
Tensoroperator= (const Tensor< 2, dim, spacedim > &)=delete
 
Tensoroperator= (Tensor< 2, dim, spacedim > &&)=default
 
value_type value (const unsigned int shape_function, const unsigned int q_point) const
 
divergence_type divergence (const unsigned int shape_function, const unsigned int q_point) const
 
gradient_type gradient (const unsigned int shape_function, const unsigned int q_point) const
 
template<typename Number >
void get_function_values (const ReadVector< Number > &fe_function, std::vector< solution_value_type< Number > > &values) const
 
template<class InputVector >
void get_function_values_from_local_dof_values (const InputVector &dof_values, std::vector< solution_value_type< typename InputVector::value_type > > &values) const
 
template<typename Number >
void get_function_divergences (const ReadVector< Number > &fe_function, std::vector< solution_divergence_type< Number > > &divergences) const
 
template<class InputVector >
void get_function_divergences_from_local_dof_values (const InputVector &dof_values, std::vector< solution_divergence_type< typename InputVector::value_type > > &divergences) const
 
template<typename Number >
void get_function_gradients (const ReadVector< Number > &fe_function, std::vector< solution_gradient_type< Number > > &gradients) const
 
template<class InputVector >
void get_function_gradients_from_local_dof_values (const InputVector &dof_values, std::vector< solution_gradient_type< typename InputVector::value_type > > &gradients) const
 

Private Attributes

SmartPointer< const FEValuesBase< dim, spacedim > > fe_values
 
unsigned int first_tensor_component
 
std::vector< ShapeFunctionDatashape_function_data
 

Detailed Description

template<int dim, int spacedim>
class FEValuesViews::Tensor< 2, dim, spacedim >

A class representing a view to a set of dim*dim components forming a second-order tensor from a vector-valued finite element. Views are discussed in the Handling vector valued problems topic.

This class allows to query the value, gradient and divergence of (components of) shape functions and solutions representing tensors. The divergence of a tensor \(T_{ij},\, 0\le i,j<\text{dim}\) is defined as \(d_i = \sum_j \frac{\partial T_{ij}}{\partial x_j}, \, 0\le i<\text{dim}\), whereas its gradient is \(G_{ijk} = \frac{\partial T_{ij}}{\partial x_k}\).

You get an object of this type if you apply a FEValuesExtractors::Tensor to an FEValues, FEFaceValues or FESubfaceValues object.

Definition at line 1624 of file fe_values_views.h.

Member Typedef Documentation

◆ value_type

template<int dim, int spacedim>
using FEValuesViews::Tensor< 2, dim, spacedim >::value_type = ::Tensor<2, spacedim>

Data type for what you get when you apply an extractor of this kind to a vector-valued finite element.

Definition at line 1631 of file fe_values_views.h.

◆ divergence_type

template<int dim, int spacedim>
using FEValuesViews::Tensor< 2, dim, spacedim >::divergence_type = ::Tensor<1, spacedim>

Data type for taking the divergence of a tensor: a vector.

Definition at line 1636 of file fe_values_views.h.

◆ gradient_type

template<int dim, int spacedim>
using FEValuesViews::Tensor< 2, dim, spacedim >::gradient_type = ::Tensor<3, spacedim>

Data type for taking the gradient of a second order tensor: a third order tensor.

Definition at line 1642 of file fe_values_views.h.

◆ solution_value_type

template<int dim, int spacedim>
template<typename Number >
using FEValuesViews::Tensor< 2, dim, spacedim >::solution_value_type = typename ProductType<Number, value_type>::type

An alias for the data type of the product of a Number and the values of the view this class provides. This is the data type of vector components of a finite element field whose degrees of freedom are described by a vector with elements of type Number.

Definition at line 1651 of file fe_values_views.h.

◆ solution_divergence_type

template<int dim, int spacedim>
template<typename Number >
using FEValuesViews::Tensor< 2, dim, spacedim >::solution_divergence_type
Initial value:
typename internal::ProductTypeImpl< std::decay_t< T >, std::decay_t< U > >::type type

An alias for the data type of the product of a Number and the divergences of the view this class provides. This is the data type of vector components of a finite element field whose degrees of freedom are described by a vector with elements of type Number.

Definition at line 1660 of file fe_values_views.h.

◆ solution_gradient_type

template<int dim, int spacedim>
template<typename Number >
using FEValuesViews::Tensor< 2, dim, spacedim >::solution_gradient_type
Initial value:

An alias for the data type of the product of a Number and the gradient of the view this class provides. This is the data type of vector components of a finite element field whose degrees of freedom are described by a vector with elements of type Number.

Definition at line 1670 of file fe_values_views.h.

Constructor & Destructor Documentation

◆ Tensor() [1/4]

template<int dim, int spacedim>
FEValuesViews::Tensor< 2, dim, spacedim >::Tensor ( )

Default constructor. Creates an invalid object.

Definition at line 351 of file fe_values_views.cc.

◆ Tensor() [2/4]

template<int dim, int spacedim>
FEValuesViews::Tensor< 2, dim, spacedim >::Tensor ( const Tensor< 2, dim, spacedim > & )
delete

Copy constructor. This is not a lightweight object so we don't allow copying and generate a compile-time error if this function is called.

◆ Tensor() [3/4]

template<int dim, int spacedim>
FEValuesViews::Tensor< 2, dim, spacedim >::Tensor ( Tensor< 2, dim, spacedim > && )
default

Move constructor.

◆ ~Tensor()

template<int dim, int spacedim>
FEValuesViews::Tensor< 2, dim, spacedim >::~Tensor ( )
default

Destructor.

◆ Tensor() [4/4]

template<int dim, int spacedim>
FEValuesViews::Tensor< 2, dim, spacedim >::Tensor ( const FEValuesBase< dim, spacedim > & fe_values_base,
const unsigned int first_tensor_component )

Constructor for an object that represents (dim*dim) components of a FEValuesBase object (or of one of the classes derived from FEValuesBase), representing the unique components comprising a second-order tensor valued variable.

The second argument denotes the index of the first component of the selected symmetric second order tensor.

Definition at line 282 of file fe_values_views.cc.

Member Function Documentation

◆ operator=() [1/2]

template<int dim, int spacedim>
Tensor & FEValuesViews::Tensor< 2, dim, spacedim >::operator= ( const Tensor< 2, dim, spacedim > & )
delete

Copy operator. This is not a lightweight object so we don't allow copying and generate a compile-time error if this function is called.

◆ operator=() [2/2]

template<int dim, int spacedim>
Tensor & FEValuesViews::Tensor< 2, dim, spacedim >::operator= ( Tensor< 2, dim, spacedim > && )
default

Move assignment operator.

◆ value()

template<int dim, int spacedim>
value_type FEValuesViews::Tensor< 2, dim, spacedim >::value ( const unsigned int shape_function,
const unsigned int q_point ) const

Return the value of the vector components selected by this view, for the shape function and quadrature point selected by the arguments. Here, since the view represents a vector-valued part of the FEValues object with (dim*dim) components (the unique components of a second-order tensor), the return type is a tensor of rank 2.

Parameters
shape_functionNumber of the shape function to be evaluated. Note that this number runs from zero to dofs_per_cell, even in the case of an FEFaceValues or FESubfaceValues object.
q_pointNumber of the quadrature point at which function is to be evaluated.
Note
For this function to work properly, the underlying FEValues, FEFaceValues, or FESubfaceValues object on which you call it must have computed the information you are requesting. To do so, the update_values flag must be an element of the list of UpdateFlags that you passed to the constructor of this object. See The interplay of UpdateFlags, Mapping, and FiniteElement in FEValues for more information.

◆ divergence()

template<int dim, int spacedim>
divergence_type FEValuesViews::Tensor< 2, dim, spacedim >::divergence ( const unsigned int shape_function,
const unsigned int q_point ) const

Return the vector divergence of the vector components selected by this view, for the shape function and quadrature point selected by the arguments.

See the general discussion of this class for a definition of the divergence.

Note
The meaning of the arguments is as documented for the value() function.
For this function to work properly, the underlying FEValues, FEFaceValues, or FESubfaceValues object on which you call it must have computed the information you are requesting. To do so, the update_gradients flag must be an element of the list of UpdateFlags that you passed to the constructor of this object. See The interplay of UpdateFlags, Mapping, and FiniteElement in FEValues for more information.

◆ gradient()

template<int dim, int spacedim>
gradient_type FEValuesViews::Tensor< 2, dim, spacedim >::gradient ( const unsigned int shape_function,
const unsigned int q_point ) const

Return the gradient (3-rd order tensor) of the vector components selected by this view, for the shape function and quadrature point selected by the arguments.

See the general discussion of this class for a definition of the gradient.

Note
The meaning of the arguments is as documented for the value() function.
For this function to work properly, the underlying FEValues, FEFaceValues, or FESubfaceValues object on which you call it must have computed the information you are requesting. To do so, the update_gradients flag must be an element of the list of UpdateFlags that you passed to the constructor of this object. See The interplay of UpdateFlags, Mapping, and FiniteElement in FEValues for more information.

◆ get_function_values()

template<int dim, int spacedim>
template<typename Number >
void FEValuesViews::Tensor< 2, dim, spacedim >::get_function_values ( const ReadVector< Number > & fe_function,
std::vector< solution_value_type< Number > > & values ) const

Return the values of the selected vector components of the finite element function characterized by fe_function at the quadrature points of the cell, face or subface selected the last time the reinit function of the FEValues object was called.

This function is the equivalent of the FEValuesBase::get_function_values function but it only works on the selected vector components.

The data type stored by the output vector must be what you get when you multiply the values of shape functions (i.e., value_type) times the type used to store the values of the unknowns \(U_j\) of your finite element vector \(U\) (represented by the fe_function argument).

Note
For this function to work properly, the underlying FEValues, FEFaceValues, or FESubfaceValues object on which you call it must have computed the information you are requesting. To do so, the update_values flag must be an element of the list of UpdateFlags that you passed to the constructor of this object. See The interplay of UpdateFlags, Mapping, and FiniteElement in FEValues for more information.

Definition at line 1153 of file fe_values_views.cc.

◆ get_function_values_from_local_dof_values()

template<int dim, int spacedim>
template<class InputVector >
void FEValuesViews::Tensor< 2, dim, spacedim >::get_function_values_from_local_dof_values ( const InputVector & dof_values,
std::vector< solution_value_type< typename InputVector::value_type > > & values ) const

Same as above, but using a vector of local degree-of-freedom values. In other words, instead of extracting the nodal values of the degrees of freedom located on the current cell from a global vector associated with a DoFHandler object (as the function above does), this function instead takes these local nodal values through its first argument. A typical way to obtain such a vector is by calling code such as

cell->get_dof_values (dof_values, local_dof_values);

(See DoFCellAccessor::get_dof_values() for more information on this function.) The point of the current function is then that one could modify these local values first, for example by applying a limiter or by ensuring that all nodal values are positive, before evaluating the finite element field that corresponds to these local values on the current cell. Another application is where one wants to postprocess the solution on a cell into a different finite element space on every cell, without actually creating a corresponding DoFHandler – in that case, all one would compute is a local representation of that postprocessed function, characterized by its nodal values; this function then allows the evaluation of that representation at quadrature points.

Parameters
[in]dof_valuesA vector of local nodal values. This vector must have a length equal to number of DoFs on the current cell, and must be ordered in the same order as degrees of freedom are numbered on the reference cell.
[out]valuesA vector of values of the given finite element field, at the quadrature points on the current object.
Template Parameters
InputVectorThe InputVector type must allow creation of an ArrayView object from it; this is satisfied by the std::vector class, among others.

Definition at line 1179 of file fe_values_views.cc.

◆ get_function_divergences()

template<int dim, int spacedim>
template<typename Number >
void FEValuesViews::Tensor< 2, dim, spacedim >::get_function_divergences ( const ReadVector< Number > & fe_function,
std::vector< solution_divergence_type< Number > > & divergences ) const

Return the divergence of the selected vector components of the finite element function characterized by fe_function at the quadrature points of the cell, face or subface selected the last time the reinit function of the FEValues object was called.

There is no equivalent function such as FEValuesBase::get_function_divergences in the FEValues classes but the information can be obtained from FEValuesBase::get_function_gradients, of course.

See the general discussion of this class for a definition of the divergence.

The data type stored by the output vector must be what you get when you multiply the divergences of shape functions (i.e., divergence_type) times the type used to store the values of the unknowns \(U_j\) of your finite element vector \(U\) (represented by the fe_function argument).

Note
For this function to work properly, the underlying FEValues, FEFaceValues, or FESubfaceValues object on which you call it must have computed the information you are requesting. To do so, the update_gradients flag must be an element of the list of UpdateFlags that you passed to the constructor of this object. See The interplay of UpdateFlags, Mapping, and FiniteElement in FEValues for more information.

Definition at line 1203 of file fe_values_views.cc.

◆ get_function_divergences_from_local_dof_values()

template<int dim, int spacedim>
template<class InputVector >
void FEValuesViews::Tensor< 2, dim, spacedim >::get_function_divergences_from_local_dof_values ( const InputVector & dof_values,
std::vector< solution_divergence_type< typename InputVector::value_type > > & divergences ) const

This function relates to get_function_divergences() in the same way as get_function_values_from_local_dof_values() relates to get_function_values(). See the documentation of get_function_values_from_local_dof_values() for more information.

Definition at line 1232 of file fe_values_views.cc.

◆ get_function_gradients()

template<int dim, int spacedim>
template<typename Number >
void FEValuesViews::Tensor< 2, dim, spacedim >::get_function_gradients ( const ReadVector< Number > & fe_function,
std::vector< solution_gradient_type< Number > > & gradients ) const

Return the gradient of the selected vector components of the finite element function characterized by fe_function at the quadrature points of the cell, face or subface selected the last time the reinit function of the FEValues object was called.

See the general discussion of this class for a definition of the gradient.

The data type stored by the output vector must be what you get when you multiply the gradients of shape functions (i.e., gradient_type) times the type used to store the values of the unknowns \(U_j\) of your finite element vector \(U\) (represented by the fe_function argument).

Note
For this function to work properly, the underlying FEValues, FEFaceValues, or FESubfaceValues object on which you call it must have computed the information you are requesting. To do so, the update_gradients flag must be an element of the list of UpdateFlags that you passed to the constructor of this object. See The interplay of UpdateFlags, Mapping, and FiniteElement in FEValues for more information.

Definition at line 1256 of file fe_values_views.cc.

◆ get_function_gradients_from_local_dof_values()

template<int dim, int spacedim>
template<class InputVector >
void FEValuesViews::Tensor< 2, dim, spacedim >::get_function_gradients_from_local_dof_values ( const InputVector & dof_values,
std::vector< solution_gradient_type< typename InputVector::value_type > > & gradients ) const

This function relates to get_function_gradients() in the same way as get_function_values_from_local_dof_values() relates to get_function_values(). See the documentation of get_function_values_from_local_dof_values() for more information.

Definition at line 1285 of file fe_values_views.cc.

Member Data Documentation

◆ fe_values

template<int dim, int spacedim>
SmartPointer<const FEValuesBase<dim, spacedim> > FEValuesViews::Tensor< 2, dim, spacedim >::fe_values
private

A pointer to the FEValuesBase object we operate on.

Definition at line 1961 of file fe_values_views.h.

◆ first_tensor_component

template<int dim, int spacedim>
unsigned int FEValuesViews::Tensor< 2, dim, spacedim >::first_tensor_component
private

The first component of the vector this view represents of the FEValuesBase object.

Definition at line 1967 of file fe_values_views.h.

◆ shape_function_data

template<int dim, int spacedim>
std::vector<ShapeFunctionData> FEValuesViews::Tensor< 2, dim, spacedim >::shape_function_data
private

Store the data about shape functions.

Definition at line 1972 of file fe_values_views.h.


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