deal.II version GIT relicensing-6834-g5b78e6bcdf 2026-10-01 11:20:01+00:00
\(\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
Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
Portable::FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number > Class Template Reference

#include <deal.II/matrix_free/portable_fe_evaluation.h>

Detailed Description

template<int dim, int fe_degree, int n_q_points_1d = fe_degree + 1, int n_components_ = 1, typename Number = double>
class Portable::FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >

This class provides all the functions necessary to evaluate functions at quadrature points and cell integrations. In functionality, this class is similar to FEValues<dim>.

This class has five template arguments:

Template Parameters
dimDimension in which this class is to be used
fe_degreeDegree of the tensor product finite element with fe_degree+1 degrees of freedom per coordinate direction
n_q_points_1dNumber of points in the quadrature formular in 1d, defaults to fe_degree+1
n_componentsNumber of vector components when solving a system of PDEs. If the same operation is applied to several components of a PDE (e.g. a vector Laplace equation), they can be applied simultaneously with one call (and often more efficiently). Defaults to 1
NumberNumber format, double or float. Defaults to double.

Definition at line 66 of file portable_fe_evaluation.h.

Public Types

using value_type = std::conditional_t<(n_components_==1), Number, Tensor< 1, n_components_, Number > >
 
using gradient_type = std::conditional_t< n_components_==1, Tensor< 1, dim, Number >, std::conditional_t< n_components_==dim, Tensor< 2, dim, Number >, Tensor< 1, n_components_, Tensor< 1, dim, Number > > > >
 
using data_type = typename MatrixFree< dim, Number >::Data
 

Public Member Functions

 FEEvaluation (const data_type *data, const unsigned int dof_handler_index=0)
 
int get_current_cell_index ()
 
const data_type * get_matrix_free_data ()
 
void read_dof_values (const DeviceVector< Number > &src)
 
void distribute_local_to_global (DeviceVector< Number > &dst) const
 
void evaluate (const EvaluationFlags::EvaluationFlags evaluate_flag)
 
void integrate (const EvaluationFlags::EvaluationFlags integration_flag)
 
value_type get_value (const int q_point) const
 
value_type get_dof_value (const int dof_index) const
 
void submit_value (const value_type &val_in, const int q_point)
 
void submit_dof_value (const value_type &value, const int dof_index)
 
gradient_type get_gradient (const int q_point) const
 
void submit_gradient (const gradient_type &gradient, const int q_point)
 
SymmetricTensor< 2, dim, Number > get_symmetric_gradient (const int q_point) const
 
Number get_divergence (const int q_point) const
 
void submit_divergence (const Number &div_in, const int q_point)
 
void submit_symmetric_gradient (const SymmetricTensor< 2, dim, Number > &sym_grad, const int q_point)
 

Static Public Attributes

static constexpr unsigned int dimension = dim
 
static constexpr unsigned int n_components = n_components_
 
static constexpr unsigned int n_q_points
 
static constexpr unsigned int tensor_dofs_per_component
 
static constexpr unsigned int tensor_dofs_per_cell
 

Private Member Functions

unsigned int inv_jacobian_index (const int q_point) const
 
Number JxW_value (const int q_point) const
 

Private Attributes

const unsigned int dof_handler_index
 
const MatrixFree< dim, Number >::Data * data
 
const MatrixFree< dim, Number >::PrecomputedData * precomputed_data
 
SharedData< dim, Number > * shared_data
 
int cell_id
 
::internal::MatrixFreeFunctions::GeometryType cell_type
 
unsigned int mapping_data_offset
 
Number cell_determinant
 

Member Typedef Documentation

◆ value_type

template<int dim, int fe_degree, int n_q_points_1d = fe_degree + 1, int n_components_ = 1, typename Number = double>
using Portable::FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::value_type = std::conditional_t<(n_components_ == 1), Number, Tensor<1, n_components_, Number> >

An alias for the value type. This is Number for scalar problems and Tensor<1, n_components> for vector-valued problems.

Definition at line 73 of file portable_fe_evaluation.h.

◆ gradient_type

template<int dim, int fe_degree, int n_q_points_1d = fe_degree + 1, int n_components_ = 1, typename Number = double>
using Portable::FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::gradient_type = std::conditional_t< n_components_ == 1, Tensor<1, dim, Number>, std::conditional_t<n_components_ == dim, Tensor<2, dim, Number>, Tensor<1, n_components_, Tensor<1, dim, Number> >> >

An alias for the gradient type.

Definition at line 80 of file portable_fe_evaluation.h.

◆ data_type

template<int dim, int fe_degree, int n_q_points_1d = fe_degree + 1, int n_components_ = 1, typename Number = double>
using Portable::FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::data_type = typename MatrixFree<dim, Number>::Data

An alias to kernel specific information.

Definition at line 90 of file portable_fe_evaluation.h.

Constructor & Destructor Documentation

◆ FEEvaluation()

template<int dim, int fe_degree, int n_q_points_1d, int n_components_, typename Number >
FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::FEEvaluation ( const data_type *  data,
const unsigned int  dof_handler_index = 0 
)
explicit

Constructor. You will need to provide a pointer to the Portable::MatrixFree::Data object, which is typically provided to the functor inside the Portable::MatrixFree::cell_loop() and the index dof_handler_index of the DoFHandler if more than one was provided when the Portable::MatrixFree object was initialized.

Definition at line 346 of file portable_fe_evaluation.h.

Member Function Documentation

◆ get_current_cell_index()

template<int dim, int fe_degree, int n_q_points_1d, int n_components_, typename Number >
int FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::get_current_cell_index ( )

Return the index of the current cell.

Definition at line 383 of file portable_fe_evaluation.h.

◆ get_matrix_free_data()

template<int dim, int fe_degree, int n_q_points_1d, int n_components_, typename Number >
const FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::data_type * FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::get_matrix_free_data ( )

Return a pointer to the MatrixFree<dim, Number>::Data object on device that contains necessary constraint, dof index, and shape function information for evaluation used in the matrix-free kernels.

Definition at line 401 of file portable_fe_evaluation.h.

◆ read_dof_values()

template<int dim, int fe_degree, int n_q_points_1d, int n_components_, typename Number >
void FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::read_dof_values ( const DeviceVector< Number > &  src)

For the vector src, read out the values on the degrees of freedom of the current cell, and store them internally. Similar functionality as the function DoFAccessor::get_interpolated_dof_values when no constraints are present, but it also includes constraints from hanging nodes, so one can see it as a similar function to AffineConstraints::read_dof_values() as well.

Definition at line 415 of file portable_fe_evaluation.h.

◆ distribute_local_to_global()

template<int dim, int fe_degree, int n_q_points_1d, int n_components_, typename Number >
void FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::distribute_local_to_global ( DeviceVector< Number > &  dst) const

Take the value stored internally on dof values of the current cell and sum them into the vector dst. The function also applies constraints during the write operation. The functionality is hence similar to the function AffineConstraints::distribute_local_to_global.

Definition at line 450 of file portable_fe_evaluation.h.

◆ evaluate()

template<int dim, int fe_degree, int n_q_points_1d, int n_components, typename Number >
void FEEvaluation< dim, fe_degree, n_q_points_1d, n_components, Number >::evaluate ( const EvaluationFlags::EvaluationFlags  evaluate_flag)

Evaluate the function values and the gradients of the FE function given at the DoF values in the input vector at the quadrature points on the unit cell. The function argument evaluate_flag specifies which parts shall actually be computed. This function needs to be called before the functions get_value() or get_gradient() give useful information.

Definition at line 497 of file portable_fe_evaluation.h.

◆ integrate()

template<int dim, int fe_degree, int n_q_points_1d, int n_components_, typename Number >
void FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::integrate ( const EvaluationFlags::EvaluationFlags  integration_flag)

This function takes the values and/or gradients that are stored on quadrature points, tests them by all the basis functions/gradients on the cell and performs the cell integration as specified by the integration_flag argument.

Definition at line 545 of file portable_fe_evaluation.h.

◆ get_value()

template<int dim, int fe_degree, int n_q_points_1d, int n_components_, typename Number >
FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::value_type FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::get_value ( const int  q_point) const

Return the value of the finite element function at the quadrature point with index q_point after a call to evaluate() with EvaluationFlags::values set.

Definition at line 597 of file portable_fe_evaluation.h.

◆ get_dof_value()

template<int dim, int fe_degree, int n_q_points_1d, int n_components_, typename Number >
FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::value_type FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::get_dof_value ( const int  dof_index) const

Return the value stored for the local degree of freedom with index dof_index. This accesses the data loaded by read_dof_values().

Definition at line 626 of file portable_fe_evaluation.h.

◆ submit_value()

template<int dim, int fe_degree, int n_q_points_1d, int n_components_, typename Number >
void FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::submit_value ( const value_type &  val_in,
const int  q_point 
)

Submit the value val_in at quadrature point q_point for subsequent integration via integrate() with EvaluationFlags::values set.

Definition at line 651 of file portable_fe_evaluation.h.

◆ submit_dof_value()

template<int dim, int fe_degree, int n_q_points_1d, int n_components_, typename Number >
void FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::submit_dof_value ( const value_type &  value,
const int  dof_index 
)

Submit the value value for the local degree of freedom with index dof_index, to be written out by a subsequent call to distribute_local_to_global().

Definition at line 677 of file portable_fe_evaluation.h.

◆ get_gradient()

template<int dim, int fe_degree, int n_q_points_1d, int n_components_, typename Number >
FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::gradient_type FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::get_gradient ( const int  q_point) const

Return the gradient of the finite element function at the quadrature point with index q_point after a call to evaluate() with EvaluationFlags::gradients set.

Definition at line 704 of file portable_fe_evaluation.h.

◆ submit_gradient()

template<int dim, int fe_degree, int n_q_points_1d, int n_components_, typename Number >
void FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::submit_gradient ( const gradient_type &  gradient,
const int  q_point 
)

Submit the gradient gradient at quadrature point q_point for subsequent integration via integrate() with EvaluationFlags::gradients set.

Definition at line 764 of file portable_fe_evaluation.h.

◆ get_symmetric_gradient()

template<int dim, int fe_degree, int n_q_points_1d, int n_components_, typename Number >
SymmetricTensor< 2, dim, Number > FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::get_symmetric_gradient ( const int  q_point) const

Return the symmetric gradient of the finite element function at quadrature point q_point after a call to evaluate() with EvaluationFlags::gradients set. This function is only available when the number of components equals the dimension (n_components==dim).

Definition at line 826 of file portable_fe_evaluation.h.

◆ get_divergence()

template<int dim, int fe_degree, int n_q_points_1d, int n_components_, typename Number >
Number FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::get_divergence ( const int  q_point) const

Return the divergence of the vector-valued finite element function at quadrature point q_point after a call to evaluate() with EvaluationFlags::gradients set. This function is only available when the number of components equals the dimension (n_components==dim).

Definition at line 846 of file portable_fe_evaluation.h.

◆ submit_divergence()

template<int dim, int fe_degree, int n_q_points_1d, int n_components_, typename Number >
void FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::submit_divergence ( const Number &  div_in,
const int  q_point 
)

Write a contribution that is multiplied by the divergence of the test function to the field containing the gradients at quadrature point q_point for subsequent integration via integrate() with EvaluationFlags::gradients set. See submit_gradient() for further information. This function is only available when the number of components equals the dimension (n_components==dim).

Note
This operation writes the data to the same field as submit_gradient() and submit_symmetric_gradient(). As a consequence, only one of these functions can be used. In case several terms of this kind appear in a weak form, the contribution of a potential call to this function must be added into the diagonal of the rank-2 tensor contribution passed to submit_gradient().

Definition at line 874 of file portable_fe_evaluation.h.

◆ submit_symmetric_gradient()

template<int dim, int fe_degree, int n_q_points_1d, int n_components_, typename Number >
void FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::submit_symmetric_gradient ( const SymmetricTensor< 2, dim, Number > &  sym_grad,
const int  q_point 
)

Submit the symmetric gradient sym_grad at quadrature point q_point for subsequent integration via integrate() with EvaluationFlags::gradients set. This function is only available when the number of components equals the dimension (n_components_==dim).

Definition at line 903 of file portable_fe_evaluation.h.

◆ inv_jacobian_index()

template<int dim, int fe_degree, int n_q_points_1d = fe_degree + 1, int n_components_ = 1, typename Number = double>
unsigned int Portable::FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::inv_jacobian_index ( const int  q_point) const
inlineprivate

Return the index of the given quadrature point of the current cell in the compressed inv_jacobian storage.

Definition at line 317 of file portable_fe_evaluation.h.

◆ JxW_value()

template<int dim, int fe_degree, int n_q_points_1d = fe_degree + 1, int n_components_ = 1, typename Number = double>
Number Portable::FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::JxW_value ( const int  q_point) const
inlineprivate

Return the mapped quadrature weight (JxW) at the given quadrature point of the current cell.

Definition at line 330 of file portable_fe_evaluation.h.

Member Data Documentation

◆ dimension

template<int dim, int fe_degree, int n_q_points_1d = fe_degree + 1, int n_components_ = 1, typename Number = double>
constexpr unsigned int Portable::FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::dimension = dim
staticconstexpr

Dimension.

Definition at line 95 of file portable_fe_evaluation.h.

◆ n_components

template<int dim, int fe_degree, int n_q_points_1d = fe_degree + 1, int n_components_ = 1, typename Number = double>
constexpr unsigned int Portable::FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::n_components = n_components_
staticconstexpr

Number of components.

Definition at line 100 of file portable_fe_evaluation.h.

◆ n_q_points

template<int dim, int fe_degree, int n_q_points_1d = fe_degree + 1, int n_components_ = 1, typename Number = double>
constexpr unsigned int Portable::FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::n_q_points
staticconstexpr
Initial value:
=
Utilities::pow(n_q_points_1d, dim)
constexpr T pow(const T base, const int iexp)
Definition utilities.h:966

Number of quadrature points per cell.

Definition at line 105 of file portable_fe_evaluation.h.

◆ tensor_dofs_per_component

template<int dim, int fe_degree, int n_q_points_1d = fe_degree + 1, int n_components_ = 1, typename Number = double>
constexpr unsigned int Portable::FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::tensor_dofs_per_component
staticconstexpr
Initial value:
=
Utilities::pow(fe_degree + 1, dim)

Number of tensor degrees of freedom of a scalar component determined from the given template argument fe_degree.

Definition at line 112 of file portable_fe_evaluation.h.

◆ tensor_dofs_per_cell

template<int dim, int fe_degree, int n_q_points_1d = fe_degree + 1, int n_components_ = 1, typename Number = double>
constexpr unsigned int Portable::FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::tensor_dofs_per_cell
staticconstexpr
Initial value:
=
static constexpr unsigned int n_components
static constexpr unsigned int tensor_dofs_per_component

Number of tensor degrees of freedom of all component determined from the given template argument fe_degree. This is the total number of local DoFs in a cell.

Definition at line 120 of file portable_fe_evaluation.h.

◆ dof_handler_index

template<int dim, int fe_degree, int n_q_points_1d = fe_degree + 1, int n_components_ = 1, typename Number = double>
const unsigned int Portable::FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::dof_handler_index
private

Definition at line 285 of file portable_fe_evaluation.h.

◆ data

template<int dim, int fe_degree, int n_q_points_1d = fe_degree + 1, int n_components_ = 1, typename Number = double>
const MatrixFree<dim,Number>::Data* Portable::FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::data
private

Definition at line 286 of file portable_fe_evaluation.h.

◆ precomputed_data

template<int dim, int fe_degree, int n_q_points_1d = fe_degree + 1, int n_components_ = 1, typename Number = double>
const MatrixFree<dim,Number>::PrecomputedData* Portable::FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::precomputed_data
private

Definition at line 287 of file portable_fe_evaluation.h.

◆ shared_data

template<int dim, int fe_degree, int n_q_points_1d = fe_degree + 1, int n_components_ = 1, typename Number = double>
SharedData<dim, Number>* Portable::FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::shared_data
private

Definition at line 288 of file portable_fe_evaluation.h.

◆ cell_id

template<int dim, int fe_degree, int n_q_points_1d = fe_degree + 1, int n_components_ = 1, typename Number = double>
int Portable::FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::cell_id
private

Definition at line 289 of file portable_fe_evaluation.h.

◆ cell_type

template<int dim, int fe_degree, int n_q_points_1d = fe_degree + 1, int n_components_ = 1, typename Number = double>
::internal::MatrixFreeFunctions::GeometryType Portable::FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::cell_type
private

Geometry classification of the current cell, loaded once at construction so that the per-quadrature-point accessors do not read it from global memory repeatedly.

Definition at line 297 of file portable_fe_evaluation.h.

◆ mapping_data_offset

template<int dim, int fe_degree, int n_q_points_1d = fe_degree + 1, int n_components_ = 1, typename Number = double>
unsigned int Portable::FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::mapping_data_offset
private

Index of the first entry of the current cell in the compressed inv_jacobian and JxW storage, loaded once at construction.

Definition at line 303 of file portable_fe_evaluation.h.

◆ cell_determinant

template<int dim, int fe_degree, int n_q_points_1d = fe_degree + 1, int n_components_ = 1, typename Number = double>
Number Portable::FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_, Number >::cell_determinant
private

For Cartesian and affine cells, the (constant) Jacobian determinant of the current cell, loaded once at construction; JxW values are reconstructed as cell_determinant * q_weights(q_point).

Definition at line 310 of file portable_fe_evaluation.h.


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