Reference documentation for deal.II version 9.2.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\}}\)
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
internal::EvaluatorTensorProduct< evaluate_evenodd, dim, n_rows, n_columns, Number, Number2 > Struct Template Reference

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

Public Member Functions

 EvaluatorTensorProduct ()
 
 EvaluatorTensorProduct (const AlignedVector< Number2 > &shape_values)
 
 EvaluatorTensorProduct (const AlignedVector< Number2 > &shape_values, const AlignedVector< Number2 > &shape_gradients, const AlignedVector< Number2 > &shape_hessians, const unsigned int dummy1=0, const unsigned int dummy2=0)
 
template<int direction, bool contract_over_rows, bool add>
void values (const Number in[], Number out[]) const
 
template<int direction, bool contract_over_rows, bool add>
void gradients (const Number in[], Number out[]) const
 
template<int direction, bool contract_over_rows, bool add>
void hessians (const Number in[], Number out[]) const
 
template<int direction, bool contract_over_rows, bool add>
void values_one_line (const Number in[], Number out[]) const
 
template<int direction, bool contract_over_rows, bool add>
void gradients_one_line (const Number in[], Number out[]) const
 
template<int direction, bool contract_over_rows, bool add>
void hessians_one_line (const Number in[], Number out[]) const
 

Static Public Member Functions

template<int direction, bool contract_over_rows, bool add, int type, bool one_line = false>
static void apply (const Number2 *DEAL_II_RESTRICT shape_data, const Number *in, Number *out)
 

Public Attributes

const Number2 * shape_values
 
const Number2 * shape_gradients
 
const Number2 * shape_hessians
 

Static Public Attributes

static constexpr unsigned int n_rows_of_product
 
static constexpr unsigned int n_columns_of_product
 

Detailed Description

template<int dim, int n_rows, int n_columns, typename Number, typename Number2>
struct internal::EvaluatorTensorProduct< evaluate_evenodd, dim, n_rows, n_columns, Number, Number2 >

Internal evaluator for 1d-3d shape function using the tensor product form of the basis functions.

This class implements a different approach to the symmetric case for values, gradients, and Hessians also treated with the above functions: It is possible to reduce the cost per dimension from N^2 to N^2/2, where N is the number of 1D dofs (there are only N^2/2 different entries in the shape matrix, so this is plausible). The approach is based on the idea of applying the operator on the even and odd part of the input vectors separately, given that the shape functions evaluated on quadrature points are symmetric. This method is presented e.g. in the book "Implementing Spectral Methods for Partial Differential Equations" by David A. Kopriva, Springer, 2009, section 3.5.3 (Even-Odd-Decomposition). Even though the experiments in the book say that the method is not efficient for N<20, it is more efficient in the context where the loop bounds are compile-time constants (templates).

Template Parameters
dimSpace dimension in which this class is applied
n_rowsNumber of rows in the transformation matrix, which corresponds to the number of 1d shape functions in the usual tensor contraction setting
n_columnsNumber of columns in the transformation matrix, which corresponds to the number of 1d shape functions in the usual tensor contraction setting
NumberAbstract number type for input and output arrays
Number2Abstract number type for coefficient arrays (defaults to same type as the input/output arrays); must implement operator* with Number and produce Number as an output to be a valid type

Definition at line 1527 of file tensor_product_kernels.h.

Constructor & Destructor Documentation

◆ EvaluatorTensorProduct() [1/3]

template<int dim, int n_rows, int n_columns, typename Number , typename Number2 >
internal::EvaluatorTensorProduct< evaluate_evenodd, dim, n_rows, n_columns, Number, Number2 >::EvaluatorTensorProduct ( )
inline

Empty constructor. Does nothing. Be careful when using 'values' and related methods because they need to be filled with the other constructor passing in at least an array for the values.

Definition at line 1544 of file tensor_product_kernels.h.

◆ EvaluatorTensorProduct() [2/3]

template<int dim, int n_rows, int n_columns, typename Number , typename Number2 >
internal::EvaluatorTensorProduct< evaluate_evenodd, dim, n_rows, n_columns, Number, Number2 >::EvaluatorTensorProduct ( const AlignedVector< Number2 > &  shape_values)
inline

Constructor, taking the data from ShapeInfo (using the even-odd variants stored there)

Definition at line 1554 of file tensor_product_kernels.h.

◆ EvaluatorTensorProduct() [3/3]

template<int dim, int n_rows, int n_columns, typename Number , typename Number2 >
internal::EvaluatorTensorProduct< evaluate_evenodd, dim, n_rows, n_columns, Number, Number2 >::EvaluatorTensorProduct ( const AlignedVector< Number2 > &  shape_values,
const AlignedVector< Number2 > &  shape_gradients,
const AlignedVector< Number2 > &  shape_hessians,
const unsigned int  dummy1 = 0,
const unsigned int  dummy2 = 0 
)
inline

Constructor, taking the data from ShapeInfo (using the even-odd variants stored there)

Definition at line 1566 of file tensor_product_kernels.h.

Member Function Documentation

◆ values()

template<int dim, int n_rows, int n_columns, typename Number , typename Number2 >
template<int direction, bool contract_over_rows, bool add>
void internal::EvaluatorTensorProduct< evaluate_evenodd, dim, n_rows, n_columns, Number, Number2 >::values ( const Number  in[],
Number  out[] 
) const
inline

Definition at line 1589 of file tensor_product_kernels.h.

◆ gradients()

template<int dim, int n_rows, int n_columns, typename Number , typename Number2 >
template<int direction, bool contract_over_rows, bool add>
void internal::EvaluatorTensorProduct< evaluate_evenodd, dim, n_rows, n_columns, Number, Number2 >::gradients ( const Number  in[],
Number  out[] 
) const
inline

Definition at line 1597 of file tensor_product_kernels.h.

◆ hessians()

template<int dim, int n_rows, int n_columns, typename Number , typename Number2 >
template<int direction, bool contract_over_rows, bool add>
void internal::EvaluatorTensorProduct< evaluate_evenodd, dim, n_rows, n_columns, Number, Number2 >::hessians ( const Number  in[],
Number  out[] 
) const
inline

Definition at line 1605 of file tensor_product_kernels.h.

◆ values_one_line()

template<int dim, int n_rows, int n_columns, typename Number , typename Number2 >
template<int direction, bool contract_over_rows, bool add>
void internal::EvaluatorTensorProduct< evaluate_evenodd, dim, n_rows, n_columns, Number, Number2 >::values_one_line ( const Number  in[],
Number  out[] 
) const
inline

Definition at line 1613 of file tensor_product_kernels.h.

◆ gradients_one_line()

template<int dim, int n_rows, int n_columns, typename Number , typename Number2 >
template<int direction, bool contract_over_rows, bool add>
void internal::EvaluatorTensorProduct< evaluate_evenodd, dim, n_rows, n_columns, Number, Number2 >::gradients_one_line ( const Number  in[],
Number  out[] 
) const
inline

Definition at line 1621 of file tensor_product_kernels.h.

◆ hessians_one_line()

template<int dim, int n_rows, int n_columns, typename Number , typename Number2 >
template<int direction, bool contract_over_rows, bool add>
void internal::EvaluatorTensorProduct< evaluate_evenodd, dim, n_rows, n_columns, Number, Number2 >::hessians_one_line ( const Number  in[],
Number  out[] 
) const
inline

Definition at line 1631 of file tensor_product_kernels.h.

◆ apply()

template<int dim, int n_rows, int n_columns, typename Number , typename Number2 >
template<int direction, bool contract_over_rows, bool add, int type, bool one_line>
void internal::EvaluatorTensorProduct< evaluate_evenodd, dim, n_rows, n_columns, Number, Number2 >::apply ( const Number2 *DEAL_II_RESTRICT  shape_data,
const Number *  in,
Number *  out 
)
inlinestatic

This function applies the tensor product kernel, corresponding to a multiplication of 1D stripes, along the given direction of the tensor data in the input array. This function allows the in and out arrays to alias for the case n_rows == n_columns, i.e., it is safe to perform the contraction in place where in and out point to the same address. For the case n_rows != n_columns, the output is only correct if one_line is set to true.

Template Parameters
directionDirection that is evaluated
contract_over_rowsIf true, the tensor contraction sums over the rows in the given shape_data array, otherwise it sums over the columns
addIf true, the result is added to the output vector, else the computed values overwrite the content in the output
typeDetermines whether to use the symmetries appearing in shape values (type=0), shape gradients (type=1) or second derivatives (type=2, similar to type 0 but without two additional zero entries)
one_lineIf true, the kernel is only applied along a single 1D stripe within a dim-dimensional tensor, not the full n_rows^dim points as in the false case.
Parameters
shape_dataTransformation matrix with n_rows rows and n_columns columns, stored in row-major format
inPointer to the start of the input data vector
outPointer to the start of the output data vector

Definition at line 1700 of file tensor_product_kernels.h.

Member Data Documentation

◆ n_rows_of_product

template<int dim, int n_rows, int n_columns, typename Number , typename Number2 >
constexpr unsigned int internal::EvaluatorTensorProduct< evaluate_evenodd, dim, n_rows, n_columns, Number, Number2 >::n_rows_of_product
static
Initial value:
=
Utilities::pow(n_rows, dim)

Definition at line 1534 of file tensor_product_kernels.h.

◆ n_columns_of_product

template<int dim, int n_rows, int n_columns, typename Number , typename Number2 >
constexpr unsigned int internal::EvaluatorTensorProduct< evaluate_evenodd, dim, n_rows, n_columns, Number, Number2 >::n_columns_of_product
static
Initial value:
=
Utilities::pow(n_columns, dim)

Definition at line 1536 of file tensor_product_kernels.h.

◆ shape_values

template<int dim, int n_rows, int n_columns, typename Number , typename Number2 >
const Number2* internal::EvaluatorTensorProduct< evaluate_evenodd, dim, n_rows, n_columns, Number, Number2 >::shape_values

Definition at line 1677 of file tensor_product_kernels.h.

◆ shape_gradients

template<int dim, int n_rows, int n_columns, typename Number , typename Number2 >
const Number2* internal::EvaluatorTensorProduct< evaluate_evenodd, dim, n_rows, n_columns, Number, Number2 >::shape_gradients

Definition at line 1678 of file tensor_product_kernels.h.

◆ shape_hessians

template<int dim, int n_rows, int n_columns, typename Number , typename Number2 >
const Number2* internal::EvaluatorTensorProduct< evaluate_evenodd, dim, n_rows, n_columns, Number, Number2 >::shape_hessians

Definition at line 1679 of file tensor_product_kernels.h.


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