#include <ExplicitOperators_fwd.hpp>
A class for evaluating typical operators needed in spatial discretization.
This class represents scalar differential operators, discretely approximated with shape functions that are stored in given shape storage. These shape functions are used to construct approximations of common operators such as gradient, Laplacian and coordinate derivatives that can be applied to scalar fields at given points.
shape_storage_type | Storage class for shapes. Shape storage concept. |
Usage example:
Definition at line 35 of file ExplicitOperators_fwd.hpp.
Public Member Functions | |
ExplicitOperators () | |
Construct empty explicit operators. More... | |
ExplicitOperators (const shape_storage_t &ss) | |
Construct explicit operators over given shape storage. More... | |
void | setShapes (const shape_storage_t &shape_storage_) |
Sets a new shape storage from which this operators are generated. More... | |
bool | hasShapes () const |
Returns true if operators have a non-null pointer to storage and false otherwise. More... | |
template<typename scalar_field_t > | |
scalar_type< scalar_field_t >::type | lap (const scalar_field_t &u, int node) const |
Returns an approximation of Laplacian of field u in node -th node. More... | |
template<typename scalar_field_t > | |
Vec< typename scalar_type< scalar_field_t >::type, ExplicitOperators< shape_storage_type >::dim > | grad (const scalar_field_t &u, int node) const |
Returns an approximation of gradient of field u in node -th node. More... | |
template<typename scalar_field_t > | |
scalar_type< scalar_field_t >::type | neumann (const scalar_field_t &u, int node, const vector_t &normal, typename scalar_type< scalar_field_t >::type val) const |
Calculates a new field value a for u at node , such that the Neumann boundary condition du/dn(node) = val holds. More... | |
template<typename scalar_field_t > | |
scalar_type< scalar_field_t >::type | d1 (const scalar_field_t &u, int var, int node) const |
Returns an approximation of requested derivative of field u in node -th node. More... | |
template<typename scalar_field_t > | |
scalar_type< scalar_field_t >::type | d2 (const scalar_field_t &u, int varmin, int varmax, int node) const |
Returns an approximation of requested second derivative of field u in node -th node. More... | |
template<typename op_family_t , typename scalar_field_t > | |
scalar_type< scalar_field_t >::type | apply (const scalar_field_t &u, int node, typename op_family_t::operator_t o) const |
Returns an approximation of applying the requested operator to field u at node node . More... | |
template<typename op_family_t , typename scalar_field_t > | |
scalar_type< scalar_field_t >::type | apply (const scalar_field_t &u, int node) const |
Overload for default constructible operator. More... | |
Public Types | |
enum | { dim = shape_storage_t::dim } |
Store dimension of the domain. More... | |
typedef shape_storage_type | shape_storage_t |
Type of shape storage. More... | |
typedef shape_storage_t::vector_t | vector_t |
Vector type. More... | |
typedef shape_storage_t::scalar_t | scalar_t |
Scalar type. More... | |
Friends | |
template<typename S > | |
std::ostream & | operator<< (std::ostream &os, const ExplicitOperators< S > &op) |
Output basic information about given operators. More... | |
Private Attributes | |
const shape_storage_t * | ss |
Pointer to shape storage, but name is shortened for readability. More... | |
anonymous enum |
Store dimension of the domain.
Enumerator | |
---|---|
dim | Dimensionality of the function domain. |
Definition at line 41 of file ExplicitOperators_fwd.hpp.
|
inline |
Construct empty explicit operators.
Definition at line 49 of file ExplicitOperators_fwd.hpp.
|
inlineexplicit |
Construct explicit operators over given shape storage.
The pointer to given storage is stored as a non-owning pointer. It is the user's responsibility that given storage is valid throughout the use use of this class.
This class is usually constructed directly from shape storage using the explicitOperators()
member function.
Definition at line 58 of file ExplicitOperators_fwd.hpp.
|
inline |
Overload for default constructible operator.
Definition at line 186 of file ExplicitOperators_fwd.hpp.
scalar_type<scalar_field_t>::type mm::ExplicitOperators< shape_storage_type >::apply | ( | const scalar_field_t & | u, |
int | node, | ||
typename op_family_t::operator_t | o | ||
) | const |
Returns an approximation of applying the requested operator to field u
at node node
.
u | Field to which the operator is applied. |
node | Node at which the derived field is evaluated. |
o | The operator to apply. |
op_family_t
type. The first weights computed for family of type op_family_t
are used.Usage example:
|
inline |
Returns an approximation of requested derivative of field u
in node
-th node.
var
-th variable and approximation is taken from ss. Assertion | fails unless 0 <= var && var < dim holds. |
Definition at line 150 of file ExplicitOperators_fwd.hpp.
|
inline |
Returns an approximation of requested second derivative of field u
in node
-th node.
varmin
-th variable, \(x_w\) is the varmax
-th variable and approximation is taken from ss. Assertion | fails unless 0 <= varmin <= varmax < dim holds. |
Definition at line 163 of file ExplicitOperators_fwd.hpp.
Vec<typename scalar_type<scalar_field_t>::type, ExplicitOperators<shape_storage_type>::dim> mm::ExplicitOperators< shape_storage_type >::grad | ( | const scalar_field_t & | u, |
int | node | ||
) | const |
Returns an approximation of gradient of field u
in node
-th node.
dim = 3
: \( [ \dpar{ u}{ x}, \dpar{ u}{ y}, \dpar{ u}{ z} ]^T\), where derivatives are approximated using shape functions from ss.
|
inline |
Returns true
if operators have a non-null pointer to storage and false
otherwise.
Definition at line 69 of file ExplicitOperators_fwd.hpp.
|
inline |
Returns an approximation of Laplacian of field u
in node
-th node.
u
, e.g. when dim = 3
: \( \dpar{^2 u}{ x^2} + \dpar{^2 u}{ y^2} + \dpar{^2 u}{ z^2} \), where derivatives are approximated using shape functions from ss. Definition at line 81 of file ExplicitOperators_fwd.hpp.
scalar_type<scalar_field_t>::type mm::ExplicitOperators< shape_storage_type >::neumann | ( | const scalar_field_t & | u, |
int | node, | ||
const vector_t & | normal, | ||
typename scalar_type< scalar_field_t >::type | val | ||
) | const |
Calculates a new field value a
for u
at node
, such that the Neumann boundary condition du/dn(node) = val
holds.
Denote given index node
by \(i\) and val
by \(v\). The function returns such \(a\), that by setting \( u(i) = a\) we satisfy the condition \( \dpar{ u}{ \vec n}(i) = v\). This is done using the following formula:
\[ a = \frac{v - \sum\limits_{i=1}^{s} \sum\limits_{d=1}^{dim} n_d \chi_{\dpar{}{ x_d}}(i)\ u(i)} {\sum\limits_{d=1}^{dim} n_d \chi_{\dpar{}{ x_d}}(0)}, \]
where \(\chi_{\dpar{}{ x_d}}\) represents the formula for the shape function of first derivative wrt. \(d\).
The function is constructed in such a way to make explicit iteration with Neumann boundary conditions simple. To satisfy \(\dpar{u}{\vec n} = v\), we simply use
u | Scalar field to evaluate. |
node | Index of the node, whose value should be changed to satisfy the boundary condition. |
normal | Vector \(\vec{n}\) with the same dimensionality as the problem domain giving the direction of the derivation. Usually the unit normal vector. |
val | The value that \(\dpar{ u}{ \vec n}\) should be equal to. |
Assertion | fails if node 's first support node is not node . |
Assertion | fails if node 's value has negligible effect on the derivation, because no value could change the value of \(\dpar{ u}{ \vec n}\). |
|
inline |
Sets a new shape storage from which this operators are generated.
As in the constructor, the pointer to given storage is stored as a non-owning pointer. It is the user's responsibility that given storage is valid throughout the use use of this class.
shape_storage_ | New shape storage. |
Definition at line 66 of file ExplicitOperators_fwd.hpp.
|
friend |
Output basic information about given operators.
Definition at line 80 of file ExplicitOperators.hpp.
|
private |
Pointer to shape storage, but name is shortened for readability.
Definition at line 45 of file ExplicitOperators_fwd.hpp.