#include <ImplicitOperators_fwd.hpp>
This class represents implicit operators that fill given matrix M and right hand side rhs with appropriate coefficients approximating differential operators with shape functions from given shape storage ss.
shape_storage_type | Any shape storage class satisfying the Shape storage concept. |
matrix_type | Usually and Eigen sparse matrix. |
rhs_type | Usually an Eigen VectorXd . |
Usage example:
Definition at line 40 of file ImplicitOperators_fwd.hpp.
Public Member Functions | |
ImplicitOperators () | |
Default constructor sets offset to 0 and pointers to nullptr . More... | |
ImplicitOperators (const shape_storage_t &ss) | |
Set only shape storage, the rest as default constructor. More... | |
ImplicitOperators (const shape_storage_t &ss, matrix_t &M, rhs_t &rhs, int row_offset=0, int col_offset=0) | |
Set shape storage and problem matrix and rhs. More... | |
void | setProblem (matrix_t &M, rhs_t &rhs, int row_offset=0, int col_offset=0) |
Sets current matrix and right hand side. More... | |
void | setRowOffset (int row_offset) |
Sets row offset for given matrix, treating it as is the first row had index row_offset . More... | |
void | setColOffset (int col_offset) |
Sets col offset for given matrix, treating it as is the first column had index col_offset . More... | |
bool | hasShapes () const |
Returns true if operators have a non-null pointer to storage. More... | |
bool | hasMatrix () const |
Returns true if operators have a non-null pointer to problem matrix. More... | |
bool | hasRhs () const |
Returns true if operators have a non-null pointer to problem right hand side. More... | |
ValueOp | value (int node, int row) |
Sets implicit equation that value of a field is equal to some other value. More... | |
ValueOp | value (int node) |
Same as value with row equal to current node. More... | |
BasicOp< Lap< dim > > | lap (int node, int row) |
Sets implicit equation that Laplacian of a field \( u\) at node -th point is equal to some value. More... | |
BasicOp< Lap< dim > > | lap (int node) |
Same as lap with row equal to current node. More... | |
GradOp | grad (int node, const vector_t &v, int row) |
Sets implicit equation that gradient of a field \( u\) at node -th point along v is equal to some value. More... | |
GradOp | grad (int node, const vector_t &v) |
Same as grad with row equal to current node. More... | |
GradOp | neumann (int node, const vector_t &unit_normal, int row) |
Sets neumann boundary conditions in node node . More... | |
GradOp | neumann (int node, const vector_t &n) |
Same as neumann with row equal to current node. More... | |
BasicOp< Der1s< dim > > | der1 (int node, int var, int row) |
Sets implicit equation that derivative of a field \( u\) at node -th point with respect to var is equal to some value. More... | |
BasicOp< Der1s< dim > > | der1 (int node, int var) |
Same as der1 with row equal to current node. More... | |
BasicOp< Der2s< dim > > | der2 (int node, int varmin, int varmax, int row) |
Sets implicit equation that second derivative of a field \( u\) at node -th point with respect to varmin and varmax is equal to some value. More... | |
BasicOp< Der2s< dim > > | der2 (int node, int varmin, int varmax) |
Same as der2 with row equal to current node. More... | |
template<typename op_family_t > | |
BasicOp< op_family_t > | apply (int node, typename op_family_t::operator_t o, int row) |
Add the weights for operator o to the appropriate elements in the matrix. More... | |
template<typename op_family_t > | |
BasicOp< op_family_t > | apply (int node, typename op_family_t::operator_t o) |
Same as apply with row equal to current node. More... | |
template<typename op_family_t > | |
BasicOp< op_family_t > | apply (int node) |
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 matrix_type | matrix_t |
Matrix type. More... | |
typedef rhs_type | rhs_t |
Right hand side type. More... | |
typedef shape_storage_t::vector_t | vector_t |
Vector type. More... | |
typedef matrix_t::Scalar | scalar_t |
Scalar type of matrix elements. More... | |
Classes | |
class | BasicOp |
Class representing Basic operators i.e. Der1, Der2, Lap or user defined custom operators. More... | |
class | GradOp |
Class representing the directional derivative (gradient) operation. More... | |
class | OpBase |
Base class for all elementary implicit operations. More... | |
class | RowOp |
Class representing an operation on a specific row of the matrix. More... | |
class | ValueOp |
Class representing the "evaluate" operation, i.e. the zero-th derivative. More... | |
Friends | |
template<typename S , typename M , typename R > | |
std::ostream & | operator<< (std::ostream &os, const ImplicitOperators< S, M, R > &op) |
Output basic info about given operators. More... | |
Private Member Functions | |
void | addToM (int i, int j, scalar_t v) |
Add v to M(i, j) . More... | |
void | addToRhs (int i, scalar_t v) |
Adds v to rhs[i] . More... | |
Private Attributes | |
const shape_storage_t * | ss |
Shape storage, but name is shortened for readability. More... | |
matrix_t * | M |
Pointer to problem matrix. More... | |
rhs_t * | rhs |
Pointer to right hand side. More... | |
int | row_offset |
Row offset to be used when accessing matrix or rhs coefficients. More... | |
int | col_offset |
Column offset to be used when accessing matrix coefficients. More... | |
anonymous enum |
Store dimension of the domain.
Enumerator | |
---|---|
dim | Dimensionality of the function domain. |
Definition at line 50 of file ImplicitOperators_fwd.hpp.
|
inline |
Default constructor sets offset to 0
and pointers to nullptr
.
Definition at line 225 of file ImplicitOperators_fwd.hpp.
|
inlineexplicit |
Set only shape storage, the rest as default constructor.
Definition at line 227 of file ImplicitOperators_fwd.hpp.
mm::ImplicitOperators< shape_storage_type, matrix_type, rhs_type >::ImplicitOperators | ( | const shape_storage_t & | ss, |
matrix_t & | M, | ||
rhs_t & | rhs, | ||
int | row_offset = 0 , |
||
int | col_offset = 0 |
||
) |
Set shape storage and problem matrix and rhs.
ss | Class storing all computed shapes. |
M | Problem matrix. Must have at least ss->size() rows and cols. |
rhs | Problem right hand side. Must have at least ss->size() rows. |
row_offset | Instead of counting rows from 0, count them from row row_offset . |
col_offset | Instead of counting columns from 0, count them from row col_offset . |
M
and rhs
have values only added to them and should be zero initialized by the user. Since this is a common mistake, a warning is printed if this is not the case when in debug mode.This class is usually constructed directly from shape storage using the implicitOperators()
member function.
Definition at line 15 of file ImplicitOperators.hpp.
|
private |
Add v
to M(i, j)
.
Assertion | fails if v is none or i or j are out of range. |
Definition at line 41 of file ImplicitOperators.hpp.
|
private |
Adds v
to rhs[i]
.
Assertion | fails if v is none or i is out of range. |
Definition at line 54 of file ImplicitOperators.hpp.
|
inline |
Overload for default-constructible operator.
Definition at line 439 of file ImplicitOperators_fwd.hpp.
|
inline |
Same as apply with row equal to current node.
Definition at line 433 of file ImplicitOperators_fwd.hpp.
|
inline |
Add the weights for operator o
to the appropriate elements in the matrix.
node | |
o | Operator family |
row | Write in this matrix row. |
Definition at line 427 of file ImplicitOperators_fwd.hpp.
|
inline |
Same as der1 with row equal to current node.
Definition at line 386 of file ImplicitOperators_fwd.hpp.
|
inline |
Sets implicit equation that derivative of a field \( u\) at node
-th point with respect to var
is equal to some value.
The code alpha*op.der1(node, 0) = v
fills the node
-th row of matrix M
so that node
-th row of the equation \( M u = v \) is a good approximation of the equation
\[ \alpha \dpar{u}{x}(p) = v(p), \]
where \(p\) is the node
-th point and \(x\) is the 0
-th variable.
node | Index of a node from 0 to N for which to write the equation for. This means only node -th row of the matrix is changed. User must make sure that the matrix is large enough. |
var | Variable with respect to which to derive. |
row | Write equation in this specific row. Row with index node is chosen by default. |
Definition at line 382 of file ImplicitOperators_fwd.hpp.
|
inline |
Same as der2 with row equal to current node.
Definition at line 413 of file ImplicitOperators_fwd.hpp.
|
inline |
Sets implicit equation that second derivative of a field \( u\) at node
-th point with respect to varmin
and varmax
is equal to some value.
The code alpha*op.der2(node, 0, 1) = v
fills the node
-th row of matrix M
so that node
-th row of the equation \( M u = v \) is a good approximation of the equation
\[ \alpha \dpar{^2u}{x\partial y}(p) = v(p), \]
where \(p\) is the node
-th point and \(x\) and \(y\) are the 0
-th and the 1
-st variables.
node | Index of a node from 0 to N for which to write the equation for. This means only node -th row of the matrix is changed. User must make sure that the matrix is large enough. |
varmin | Smaller of the two variables with respect to which to derive. |
varmax | Grater of the two variables with respect to which to derive. |
row | Write equation in this specific row. Row with index node is chosen by default. |
Definition at line 409 of file ImplicitOperators_fwd.hpp.
|
inline |
Same as grad with row equal to current node.
Definition at line 337 of file ImplicitOperators_fwd.hpp.
|
inline |
Sets implicit equation that gradient of a field \( u\) at node
-th point along v
is equal to some value.
The code alpha*op.grad(node, v) = r
fills the node
-th row of matrix M
so that node
-th row of the equation \( M u = r \) is a good approximation of the equation
\[ \alpha \vec{v} \cdot (\nabla u)(p) = r(p), \]
where \(p\) is the node
-th point and \(\vec{v}\) is the vector v
. Alternatively, this can be viewed as setting the directional derivative along v
to be equal to r
.
node | Index of a node from 0 to N for which to write the equation for. This means only node -th row of the matrix is changed. User must make sure that the matrix is large enough. |
v | Vector to multiply the gradient with. |
row | Write equation in this specific row. Row with index node is chosen by default. |
Example:
Definition at line 335 of file ImplicitOperators_fwd.hpp.
|
inline |
Returns true
if operators have a non-null pointer to problem matrix.
Definition at line 268 of file ImplicitOperators_fwd.hpp.
|
inline |
Returns true
if operators have a non-null pointer to problem right hand side.
Definition at line 270 of file ImplicitOperators_fwd.hpp.
|
inline |
Returns true
if operators have a non-null pointer to storage.
Definition at line 266 of file ImplicitOperators_fwd.hpp.
|
inline |
Same as lap with row equal to current node.
Definition at line 311 of file ImplicitOperators_fwd.hpp.
|
inline |
Sets implicit equation that Laplacian of a field \( u\) at node
-th point is equal to some value.
The code alpha*op.lap(node) = v
fills the node
-th row of matrix M
so that node
-th row of the equation \( M u = v \) is a good approximation of the equation
\[ \alpha \nabla^2 u(p) = v(p), \]
where \(p\) is the node
-th point.
node | Index of a node from 0 to N for which to write the equation for. This means only the node -th row of the matrix is changed. User must make sure that the matrix is large enough. |
row | Write equation in this specific row. Row with index node is chosen by default. |
Example:
Definition at line 309 of file ImplicitOperators_fwd.hpp.
|
inline |
Same as neumann with row equal to current node.
Definition at line 361 of file ImplicitOperators_fwd.hpp.
|
inline |
Sets neumann boundary conditions in node node
.
The code alpha*op.neumann(node, normal) = v
fills the node
-th row of matrix M
so that node
-th row of the equation \( M u = v \) is a good approximation of the equation
\[ \alpha \dpar{u}{\vec{n}}(p) = v(p), \]
where \(p\) is the node
-th point and \(\vec{n}\) is the unit_normal
.
This is the same as using grad(), but has additional semantic meaning of setting the boundary conditions.
Definition at line 355 of file ImplicitOperators_fwd.hpp.
|
inline |
Sets col offset for given matrix, treating it as is the first column had index col_offset
.
Definition at line 260 of file ImplicitOperators_fwd.hpp.
|
inline |
Sets current matrix and right hand side.
Definition at line 248 of file ImplicitOperators_fwd.hpp.
|
inline |
Sets row offset for given matrix, treating it as is the first row had index row_offset
.
Definition at line 255 of file ImplicitOperators_fwd.hpp.
|
inline |
Same as value with row equal to current node.
Definition at line 289 of file ImplicitOperators_fwd.hpp.
|
inline |
Sets implicit equation that value of a field is equal to some other value.
The code alpha*op.value(node) = v
fills the node
-th row of matrix M
so that node
-th row of the equation \( M u = v \) is a good approximation of the equation
\[ \alpha u(p) = v(p), \]
where \(p\) is the node
-th point.
node | Index of a node from 0 to N for which to write the equation for. This means only the node -th row of the matrix is changed. User must make sure that the matrix is large enough. |
row | Write equation in this specific row. Row with index node is chosen by default. |
Definition at line 287 of file ImplicitOperators_fwd.hpp.
|
friend |
Output basic info about given operators.
Definition at line 65 of file ImplicitOperators.hpp.
|
private |
Column offset to be used when accessing matrix coefficients.
Definition at line 58 of file ImplicitOperators_fwd.hpp.
|
private |
Pointer to problem matrix.
Definition at line 55 of file ImplicitOperators_fwd.hpp.
|
private |
Pointer to right hand side.
Definition at line 56 of file ImplicitOperators_fwd.hpp.
|
private |
Row offset to be used when accessing matrix or rhs coefficients.
Definition at line 57 of file ImplicitOperators_fwd.hpp.
|
private |
Shape storage, but name is shortened for readability.
Definition at line 54 of file ImplicitOperators_fwd.hpp.