#include <ImplicitVectorOperators_fwd.hpp>
This class represents implicit vector 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.
They are intended for implicit solutions of vector PDEs. Component specific equations can also be set using eq.
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 . |
The matrix and rhs should be of size at least N*dim
, where N
is the number of nodes in the domain and dim
its dimensionality.
Usage example:
Definition at line 44 of file ImplicitVectorOperators_fwd.hpp.
Public Member Functions | |
ImplicitVectorOperators () | |
Default constructor sets offset to 0 and pointers to nullptr . More... | |
ImplicitVectorOperators (const shape_storage_t &ss) | |
Set only shape storage, the rest as default constructor. More... | |
ImplicitVectorOperators (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 and false otherwise. 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... | |
Equation | eq (int num) |
Choose one specific component of the vector equation to write to. More... | |
ValueOp | value (int node, int row) |
Sets implicit equation that value of a vector 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 vector field is equal to some other value. More... | |
BasicOp< Lap< dim > > | lap (int node) |
Same as lap 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... | |
GradOp | grad (int node, const domain_vector_t &v, int row) |
Sets implicit equation that gradient of a vector field along v is equal to some other value. More... | |
GradOp | grad (int node, const domain_vector_t &v) |
Same as grad with row equal to current node. More... | |
GradDivOp | graddiv (int node, int row) |
Sets implicit equation that gradient of divergence of a vector field is equal to some other value. More... | |
GradDivOp | graddiv (int node) |
Same as graddiv with row equal to current node. More... | |
GradOp | neumann (int node, const domain_vector_t &unit_normal, int row) |
Sets neumann boundary conditions in node node . More... | |
GradOp | neumann (int node, const domain_vector_t &n) |
Same as neumann with row equal to current node. More... | |
TractionOp | traction (int node, scalar_t lam, scalar_t mu, const domain_vector_t &unit_normal, int row) |
Sets traction boundary conditions in node node . More... | |
TractionOp | traction (int node, scalar_t lam, scalar_t mu, const domain_vector_t &n) |
Same as traction with row equal to current node. 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 | domain_vector_t |
Vector type for vectors in the domain, usually float or double. More... | |
typedef matrix_t::Scalar | scalar_t |
Scalar type of matrix elements. More... | |
typedef Eigen::Matrix< scalar_t, dim, 1 > | vector_t |
Vector type. More... | |
Classes | |
class | BasicOp |
Class representing basic operators. More... | |
class | Equation |
Represents one scalar component of a vector equation. More... | |
class | GradDivOp |
Class representing the gradient of the divergence operator, i.e. operator \(\nabla\nabla\cdot\). More... | |
class | GradOp |
Class representing the directional derivative (gradient) operation. More... | |
class | RowVecOp |
Class representing an operation on a specific set of rows of the matrix. More... | |
class | TractionOp |
Class representing the traction operator. Useful for setting boundary conditions. More... | |
class | ValueOp |
Class representing the "evaluate" operation, i.e. the zero-th derivative. More... | |
class | VecOpBase |
Base class for all elementary implicit vector operations. More... | |
Friends | |
template<typename S , typename M , typename R > | |
std::ostream & | operator<< (std::ostream &os, const ImplicitVectorOperators< S, M, R > &op) |
Output basic info about given operators. More... | |
Private Member Functions | |
void | addToM (int i, int j, scalar_t v) |
Adds v to M(i, j) , i.e. M(i, j) += v . More... | |
void | addToRhs (int i, const vector_t &v) |
Adds components of v to i , i+N , ..., i+(dim-1)*N -th rows of rhs . 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 domain. |
Definition at line 55 of file ImplicitVectorOperators_fwd.hpp.
|
inline |
Default constructor sets offset to 0
and pointers to nullptr
.
Definition at line 319 of file ImplicitVectorOperators_fwd.hpp.
|
inlineexplicit |
Set only shape storage, the rest as default constructor.
Definition at line 322 of file ImplicitVectorOperators_fwd.hpp.
mm::ImplicitVectorOperators< shape_storage_type, matrix_type, rhs_type >::ImplicitVectorOperators | ( | 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()*dim rows and cols. |
rhs | Problem right hand side. Must have at least ss->size()*dim 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 implicitVectorOperators()
member function.
Definition at line 16 of file ImplicitVectorOperators.hpp.
|
inlineprivate |
Adds v
to M(i, j)
, i.e. M(i, j) += v
.
Definition at line 68 of file ImplicitVectorOperators_fwd.hpp.
|
inlineprivate |
Adds components of v
to i
, i+N
, ..., i+(dim-1)*N
-th rows of rhs
.
Definition at line 74 of file ImplicitVectorOperators_fwd.hpp.
|
inline |
Overload for default-constructible operator.
Definition at line 445 of file ImplicitVectorOperators_fwd.hpp.
|
inline |
Same as apply with row equal to current node.
Definition at line 439 of file ImplicitVectorOperators_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 433 of file ImplicitVectorOperators_fwd.hpp.
|
inline |
Choose one specific component of the vector equation to write to.
Usage example:
sets equation \(\alpha \dpar{u}{x}(i) + \beta \dpar{v}{y}(i) = t_x(i)\) as the first scalar equation in the matrix.
Definition at line 374 of file ImplicitVectorOperators_fwd.hpp.
|
inline |
Same as grad with row equal to current node.
Definition at line 467 of file ImplicitVectorOperators_fwd.hpp.
|
inline |
Sets implicit equation that gradient of a vector field along v
is equal to some other value.
The code alpha*op.grad(node, v) = r
fills the node
-th, node+N
-th and node+2*N
-th row of matrix M
these rows of equation \( M u = r \) are a good approximation of the equation
\[ \alpha (\vec{v} \cdot \nabla) \vec{u}(p) = \vec{r}(p), \]
where \(p\) is the node
-th point and \(\vec{v}\) is the vector v
.
dim = 3
, other dimensions are analogous. node | Index of a node from 0 to N for which to write the equation for. This means only node -th, node+N -th and node+2*N -th rows of the matrix are 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. |
v | Vector to multiply the gradient with. |
Example:
Definition at line 465 of file ImplicitVectorOperators_fwd.hpp.
|
inline |
Same as graddiv with row equal to current node.
Definition at line 488 of file ImplicitVectorOperators_fwd.hpp.
|
inline |
Sets implicit equation that gradient of divergence of a vector field is equal to some other value.
The code alpha*op.graddiv(node) = v
fills the node
-th, node+N
-th and node+2*N
-th row of matrix M
these rows of equation \( M u = v \) are a good approximation of the equation
\[ \alpha \nabla(\nabla \cdot \vec{u})(p) = \vec{v}(p), \]
where \(p\) is the node
-th point.
dim = 3
, other dimensions are analogous. node | Index of a node from 0 to N for which to write the equation for. This means only node -th, node+N -th and node+2*N -th rows of the matrix are 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 486 of file ImplicitVectorOperators_fwd.hpp.
|
inline |
Returns true
if operators have a non-null pointer to problem matrix.
Definition at line 363 of file ImplicitVectorOperators_fwd.hpp.
|
inline |
Returns true
if operators have a non-null pointer to problem right hand side.
Definition at line 365 of file ImplicitVectorOperators_fwd.hpp.
|
inline |
Returns true
if operators have a non-null pointer to storage and false
otherwise.
Definition at line 361 of file ImplicitVectorOperators_fwd.hpp.
|
inline |
Same as lap with row equal to current node.
Definition at line 422 of file ImplicitVectorOperators_fwd.hpp.
|
inline |
Sets implicit equation that Laplacian of a vector field is equal to some other value.
The code alpha*op.lap(node) = v
fills the node
-th, node+N
-th and node+2*N
-th row of matrix M
these rows of equation \( M u = v \) are a good approximation of the equation
\[ \alpha \nabla^2\vec{u}(p) = \vec{v}(p), \]
where \(p\) is the node
-th point.
dim = 3
, other dimensions are analogous. node | Index of a node from 0 to N for which to write the equation for. This means only node -th, node+N -th and node+2*N -th rows of the matrix are 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 420 of file ImplicitVectorOperators_fwd.hpp.
|
inline |
Same as neumann with row equal to current node.
Definition at line 511 of file ImplicitVectorOperators_fwd.hpp.
|
inline |
Sets neumann boundary conditions in node node
.
The code alpha*op.neumann(node, normal) = v
fills the node
-th, node+N
-th and node+2*N
-th row of matrix M
these rows of equation \( M u = v \) are a good approximation of the equation
\[ \alpha \dpar{\vec{u}}{\vec{n}}(p) = \vec{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 505 of file ImplicitVectorOperators_fwd.hpp.
|
inline |
Sets col offset for given matrix, treating it as is the first column had index col_offset
.
Definition at line 355 of file ImplicitVectorOperators_fwd.hpp.
|
inline |
Sets current matrix and right hand side.
Definition at line 343 of file ImplicitVectorOperators_fwd.hpp.
|
inline |
Sets row offset for given matrix, treating it as is the first row had index row_offset
.
Definition at line 350 of file ImplicitVectorOperators_fwd.hpp.
|
inline |
Same as traction with row equal to current node.
Definition at line 539 of file ImplicitVectorOperators_fwd.hpp.
|
inline |
Sets traction boundary conditions in node node
.
The code alpha*op.traction(node, lam, mu, normal) = t
fills the node
-th, node+N
-th and node+2*N
-th row of matrix M
these rows of equation \( M u = t \) are a good approximation of the equation
\[ \alpha (\sigma(\vec{u}) \vec{n}) (p) = \vec{t}(p) \]
where \(p\) is the node
-th point, \(\sigma\) is the stress tensor and \(\vec{n}\) is the unit_normal
.
node | Index of a node from 0 to N for which to write the equation for. This means only node -th, node+N -th and node+2*N -th rows of the matrix are 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. |
lam | The first Lame coefficient. |
mu | The second Lame coefficient. |
unit_normal | The outside unit normal on the surface for which to set the traction. |
Definition at line 532 of file ImplicitVectorOperators_fwd.hpp.
|
inline |
Same as value with row equal to current node.
Definition at line 398 of file ImplicitVectorOperators_fwd.hpp.
|
inline |
Sets implicit equation that value of a vector field is equal to some other value.
The code alpha*op.value(node) = v
fills the node
-th, node+N
-th and node+2*N
-th row of matrix M
these rows of equation \( M u = v \) are a good approximation of the equation
\[ \alpha \vec{u}(p) = \vec{v}(p), \]
where \(p\) is the node
-th point.
dim = 3
, other dimensions are analogous. node | Index of a node from 0 to N for which to write the equation for. This means only node -th, node+N -th and node+2*N -th rows of the matrix are 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 396 of file ImplicitVectorOperators_fwd.hpp.
|
friend |
Output basic info about given operators.
Definition at line 43 of file ImplicitVectorOperators.hpp.
|
private |
Column offset to be used when accessing matrix coefficients.
Definition at line 65 of file ImplicitVectorOperators_fwd.hpp.
|
private |
Pointer to problem matrix.
Definition at line 62 of file ImplicitVectorOperators_fwd.hpp.
|
private |
Pointer to right hand side.
Definition at line 63 of file ImplicitVectorOperators_fwd.hpp.
|
private |
Row offset to be used when accessing matrix or rhs coefficients.
Definition at line 64 of file ImplicitVectorOperators_fwd.hpp.
|
private |
Shape storage, but name is shortened for readability.
Definition at line 61 of file ImplicitVectorOperators_fwd.hpp.