Gyselalib++
 
Loading...
Searching...
No Matches
l_norm_tools.hpp File Reference

File Describing useful mathematical functions to compute Lnorms. More...

#include <ddc/ddc.hpp>
#include "quadrature.hpp"

Go to the source code of this file.

Functions

template<class... Tags>
KOKKOS_FUNCTION double norm_inf (ddc::Coordinate< Tags... > coord)
 Compute the infinity norm.
 
KOKKOS_INLINE_FUNCTION double norm_inf (double const coord)
 Compute the infinity norm.
 
template<class ExecSpace , class ElementType , class IdxRange >
double norm_inf (ExecSpace exec_space, ConstField< ElementType, IdxRange, typename ExecSpace::memory_space > function)
 Compute the infinity norm for a Field.
 
template<class ExecSpace , class ElementType , class IdxRange , class NDTag >
double norm_inf (ExecSpace exec_space, VectorConstField< ElementType, IdxRange, NDTag, typename ExecSpace::memory_space > function)
 Compute the infinity norm for a VectorField.
 
template<class ExecSpace , class ElementType , class IdxRange >
double error_norm_inf (ExecSpace exec_space, ConstField< ElementType, IdxRange, typename ExecSpace::memory_space > function, ConstField< ElementType, IdxRange, typename ExecSpace::memory_space > exact_function)
 Compute the infinity norm of the error between 2 Fields.
 
template<class ExecSpace , class ElementType , class IdxRange , class NDTag >
double error_norm_inf (ExecSpace exec_space, VectorConstField< ElementType, IdxRange, NDTag, typename ExecSpace::memory_space > function, VectorConstField< ElementType, IdxRange, NDTag, typename ExecSpace::memory_space > exact_function)
 Compute the infinity norm of the error between 2 VectorFields.
 
template<class IdxRangeQuad , class ExecSpace >
double norm_L1 (ExecSpace exec_space, Quadrature< IdxRangeQuad, IdxRangeQuad, typename ExecSpace::memory_space > quadrature, DField< IdxRangeQuad, typename ExecSpace::memory_space > function)
 Compute L1 norm of a function with a given quadrature.
 
template<class IdxRangeQuad , class ExecSpace >
double error_norm_L1 (ExecSpace exec_space, Quadrature< IdxRangeQuad, IdxRangeQuad, typename ExecSpace::memory_space > quadrature, DField< IdxRangeQuad, typename ExecSpace::memory_space > function, DField< IdxRangeQuad, typename ExecSpace::memory_space > exact_function)
 Compute the L1 norm of the error between 2 Fields.
 
template<class IdxRangeQuad , class ExecSpace >
double norm_L2 (ExecSpace exec_space, Quadrature< IdxRangeQuad, IdxRangeQuad, typename ExecSpace::memory_space > quadrature, DField< IdxRangeQuad, typename ExecSpace::memory_space > function)
 Compute L2 norm of a function with a given quadrature.
 
template<class IdxRangeQuad , class ExecSpace >
double error_norm_L2 (ExecSpace exec_space, Quadrature< IdxRangeQuad, IdxRangeQuad, typename ExecSpace::memory_space > quadrature, DField< IdxRangeQuad, typename ExecSpace::memory_space > function, DField< IdxRangeQuad, typename ExecSpace::memory_space > exact_function)
 Compute the L2 norm of the error between 2 Fields.
 

Detailed Description

File Describing useful mathematical functions to compute Lnorms.

Function Documentation

◆ norm_inf() [1/4]

template<class... Tags>
KOKKOS_FUNCTION double norm_inf ( ddc::Coordinate< Tags... >  coord)

Compute the infinity norm.

For a given vector \( x \) , compute \(|Vert x |Vert_{\infty} = \sup_n |x_n| \).

Parameters
[in]coordThe given vector.
Returns
A double containing the value of the infinty norm.

◆ norm_inf() [2/4]

KOKKOS_INLINE_FUNCTION double norm_inf ( double const  coord)

Compute the infinity norm.

In case of scalar, the infinity norm returns the scalar.

Parameters
[in]coordThe given double.
Returns
A double containing the value of the infinty norm.

◆ norm_inf() [3/4]

template<class ExecSpace , class ElementType , class IdxRange >
double norm_inf ( ExecSpace  exec_space,
ConstField< ElementType, IdxRange, typename ExecSpace::memory_space >  function 
)
inline

Compute the infinity norm for a Field.

Parameters
[in]exec_spaceThe space on which the function is executed (CPU/GPU).
[in]functionThe function whose norm is calcuated.
Returns
A double containing the value of the infinty norm.

◆ norm_inf() [4/4]

template<class ExecSpace , class ElementType , class IdxRange , class NDTag >
double norm_inf ( ExecSpace  exec_space,
VectorConstField< ElementType, IdxRange, NDTag, typename ExecSpace::memory_space >  function 
)
inline

Compute the infinity norm for a VectorField.

Parameters
[in]exec_spaceThe space on which the function is executed (CPU/GPU).
[in]functionThe function whose norm is calcuated.
Returns
A double containing the value of the infinty norm.

◆ error_norm_inf() [1/2]

template<class ExecSpace , class ElementType , class IdxRange >
double error_norm_inf ( ExecSpace  exec_space,
ConstField< ElementType, IdxRange, typename ExecSpace::memory_space >  function,
ConstField< ElementType, IdxRange, typename ExecSpace::memory_space >  exact_function 
)
inline

Compute the infinity norm of the error between 2 Fields.

Parameters
[in]exec_spaceThe space on which the function is executed (CPU/GPU).
[in]functionThe calculated function.
[in]exact_functionThe exact function with which the calculated function is compared.
Returns
A double containing the value of the infinty norm.

◆ error_norm_inf() [2/2]

template<class ExecSpace , class ElementType , class IdxRange , class NDTag >
double error_norm_inf ( ExecSpace  exec_space,
VectorConstField< ElementType, IdxRange, NDTag, typename ExecSpace::memory_space >  function,
VectorConstField< ElementType, IdxRange, NDTag, typename ExecSpace::memory_space >  exact_function 
)
inline

Compute the infinity norm of the error between 2 VectorFields.

Parameters
[in]exec_spaceThe space on which the function is executed (CPU/GPU).
[in]functionThe calculated function.
[in]exact_functionThe exact function with which the calculated function is compared.
Returns
A double containing the value of the infinty norm.

◆ norm_L1()

template<class IdxRangeQuad , class ExecSpace >
double norm_L1 ( ExecSpace  exec_space,
Quadrature< IdxRangeQuad, IdxRangeQuad, typename ExecSpace::memory_space >  quadrature,
DField< IdxRangeQuad, typename ExecSpace::memory_space >  function 
)

Compute L1 norm of a function with a given quadrature.

\( \int_{\Omega} |f(X)| dX \)

Parameters
[in]exec_spaceThe space on which the function is executed (CPU/GPU).
[in]quadratureThe quadrature used to compute the integral.
[in]functionA Field to the value of the function on the quadrature grid.
Returns
A double containing the L1 norm of the function.

◆ error_norm_L1()

template<class IdxRangeQuad , class ExecSpace >
double error_norm_L1 ( ExecSpace  exec_space,
Quadrature< IdxRangeQuad, IdxRangeQuad, typename ExecSpace::memory_space >  quadrature,
DField< IdxRangeQuad, typename ExecSpace::memory_space >  function,
DField< IdxRangeQuad, typename ExecSpace::memory_space >  exact_function 
)

Compute the L1 norm of the error between 2 Fields.

Parameters
[in]exec_spaceThe space on which the function is executed (CPU/GPU).
[in]quadratureThe quadrature used to compute the integral.
[in]functionThe calculated function.
[in]exact_functionThe exact function with which the calculated function is compared.
Returns
A double containing the value of the infinty norm.

◆ norm_L2()

template<class IdxRangeQuad , class ExecSpace >
double norm_L2 ( ExecSpace  exec_space,
Quadrature< IdxRangeQuad, IdxRangeQuad, typename ExecSpace::memory_space >  quadrature,
DField< IdxRangeQuad, typename ExecSpace::memory_space >  function 
)

Compute L2 norm of a function with a given quadrature.

\( \sqrt{\int_{\Omega} |f(X)|^2 dX} \)

Parameters
[in]exec_spaceThe space on which the function is executed (CPU/GPU).
[in]quadratureThe quadrature used to compute the integral.
[in]functionA Field to the value of the function on the quadrature grid.
Returns
A double containing the L2 norm of the function.

◆ error_norm_L2()

template<class IdxRangeQuad , class ExecSpace >
double error_norm_L2 ( ExecSpace  exec_space,
Quadrature< IdxRangeQuad, IdxRangeQuad, typename ExecSpace::memory_space >  quadrature,
DField< IdxRangeQuad, typename ExecSpace::memory_space >  function,
DField< IdxRangeQuad, typename ExecSpace::memory_space >  exact_function 
)

Compute the L2 norm of the error between 2 Fields.

Parameters
[in]exec_spaceThe space on which the function is executed (CPU/GPU).
[in]quadratureThe quadrature used to compute the integral.
[in]functionThe calculated function.
[in]exact_functionThe exact function with which the calculated function is compared.
Returns
A double containing the value of the infinty norm.