Documentation 6b54b78464
Loading...
Searching...
No Matches
CSysMatrix< ScalarType > Class Template Reference

Main class for defining block-compressed-row-storage sparse matrices. More...

#include <CSysMatrix.hpp>

Inheritance diagram for CSysMatrix< ScalarType >:
[legend]

Public Member Functions

 CSysMatrix ()
 Constructor of the class.
 
 ~CSysMatrix ()
 Destructor of the class.
 
void Initialize (unsigned long npoint, unsigned long npointdomain, unsigned short nvar, unsigned short neqn, bool EdgeConnect, CGeometry *geometry, const CConfig *config, bool needTranspPtr=false, bool allow_quant=false, std::optional< unsigned short > override_prec=std::nullopt)
 Initializes the sparse matrix.
 
void QuantizeDiagonalBlocks ()
 Compresses off-diagonal blocks into quantized form for use with USE_QUANTIZATION.
 
void SetValZero ()
 Sets to zero all the entries of the sparse matrix.
 
void SetValDiagonalZero ()
 Sets to zero all the block diagonal entries of the sparse matrix.
 
void HtDTransfer (bool trigger=true) const
 Performs the memory copy from host to device.
 
const ScalarType * GetBlock (unsigned long block_i, unsigned long block_j) const
 Get a pointer to the start of block "ij".
 
ScalarType * GetBlock (unsigned long block_i, unsigned long block_j)
 Get a pointer to the start of block "ij", non-const version.
 
CBlockView< const ScalarType > GetBlockView (unsigned long block_i, unsigned long block_j) const
 Read-only view of block (block_i, block_j). In Q_LU_SGS mode values are decoded on access inside CBlockView::operator()(i,j); no temporary copy is made.
 
CBlockView< ScalarType > GetBlockView (unsigned long block_i, unsigned long block_j)
 
template<bool Overwrite = true, class MatrixType >
void SetBlock (unsigned long block_i, unsigned long block_j, MatrixType &val_block, std::decay_t< typename MatrixType::Scalar > alpha=1.0)
 Set the value of a scaled block in the sparse matrix.
 
template<bool Overwrite = true, class OtherType , su2enable_if<!is_pointer< OtherType >::value > = 0>
void SetBlock (unsigned long block_i, unsigned long block_j, const OtherType *val_block, std::decay_t< OtherType > alpha=1.0)
 
template<bool Overwrite = true, class OtherType >
void SetBlock (unsigned long block_i, unsigned long block_j, const OtherType *const *val_block, std::decay_t< OtherType > alpha=1.0)
 
template<class T , class OtherType = ScalarType>
void AddBlock (unsigned long block_i, unsigned long block_j, const T &val_block, OtherType alpha=1.0)
 Add a scaled block (in flat format) to the sparse matrix (see SetBlock).
 
template<class T >
void SubtractBlock (unsigned long block_i, unsigned long block_j, const T &val_block)
 Subtracts the specified block to the sparse matrix (see AddBlock).
 
void GetBlocks (unsigned long iEdge, unsigned long iPoint, unsigned long jPoint, ScalarType *&bii, ScalarType *&bij, ScalarType *&bji, ScalarType *&bjj)
 Returns the 4 blocks ii, ij, ji, jj used by "UpdateBlocks".
 
template<bool OverwriteOffDiag = false, class MatrixType , class OtherType = ScalarType>
void UpdateBlocks (unsigned long iEdge, unsigned long iPoint, unsigned long jPoint, const MatrixType &block_i, const MatrixType &block_j, OtherType scale=1)
 Update 4 blocks ii, ij, ji, jj (add to i* sub from j*).
 
template<class MatrixType >
void UpdateBlocksSub (unsigned long iEdge, unsigned long iPoint, unsigned long jPoint, const MatrixType &block_i, const MatrixType &block_j)
 Short-hand for the "subtractive" version (sub from i* add to j*) of UpdateBlocks.
 
template<class MatTypeSIMD , size_t N, class I , class F = ScalarType>
void SetBlocks (simd::Array< I, N > iEdge, simd::Array< I, N > iPoint, simd::Array< I, N > jPoint, const MatTypeSIMD &block_i, const MatTypeSIMD &block_j, simd::Array< F, N > mask=1)
 SIMD version, does the update for multiple edges and points.
 
template<class MatrixType , class OtherType = ScalarType, bool Overwrite = true>
void SetBlocks (unsigned long iEdge, const MatrixType &block_i, const MatrixType &block_j, OtherType scale=1)
 Sets 2 blocks ij and ji (add to i* sub from j*) associated with one edge of an FVM-type sparse pattern.
 
template<class MatrixType , class OtherType = ScalarType>
void UpdateBlocks (unsigned long iEdge, const MatrixType &block_i, const MatrixType &block_j, OtherType scale=1)
 Short-hand for the "additive overwrite" version of SetBlocks.
 
template<class MatrixType >
void UpdateBlocksSub (unsigned long iEdge, const MatrixType &block_i, const MatrixType &block_j)
 Short-hand for the "subtractive" version (sub from i* add to j*) of SetBlocks.
 
template<class MatrixType , class OtherType = ScalarType>
void SetBlocks (unsigned long iEdge, unsigned long iPoint, unsigned long jPoint, const MatrixType &jac_ii, const MatrixType &jac_ij, const MatrixType &jac_ji, const MatrixType &jac_jj, OtherType mask=1)
 Set the four blocks of an edge, for fluxes whose i and j contributions are independent.
 
template<class MatrixType , class OtherType = ScalarType>
void SetOffDiagBlocks (unsigned long iEdge, const MatrixType &jac_ij, const MatrixType &jac_ji, OtherType mask=1)
 Set the off-diagonal blocks of an edge, the diagonal being assembled elsewhere.
 
template<class MatTypeSIMD , size_t N, class I , class F = ScalarType>
void SetBlocks (simd::Array< I, N > iEdge, const MatTypeSIMD &block_i, const MatTypeSIMD &block_j, simd::Array< F, N > mask=1)
 SIMD version, does the update for multiple edges.
 
template<class OtherType , bool Overwrite = true, class T = ScalarType>
void SetBlock2Diag (unsigned long block_i, const OtherType &val_block, T alpha=1.0)
 Sets the specified block to the (i, i) subblock of the sparse matrix. Scales the input block by factor alpha. If the Overwrite parameter is false we update instead (bii += alpha*b).
 
template<class OtherType , class T = ScalarType>
void AddBlock2Diag (unsigned long block_i, const OtherType &val_block, T alpha=1.0)
 Non overwrite version of SetBlock2Diag, also with scaling.
 
template<class OtherType >
void SubtractBlock2Diag (unsigned long block_i, const OtherType &val_block)
 Short-hand to AddBlock2Diag with alpha = -1, i.e. subtracts from the current diagonal.
 
template<class OtherType >
void AddVal2Diag (unsigned long block_i, OtherType val_matrix)
 Adds the specified value to the diagonal of the (i, i) subblock of the matrix-by-blocks structure.
 
template<class OtherType >
void AddVal2Diag (unsigned long block_i, unsigned long iVar, OtherType val)
 Adds the specified value to the diagonal of the (i, i) subblock of the matrix-by-blocks structure.
 
template<class OtherType >
void SetVal2Diag (unsigned long block_i, OtherType val_matrix)
 Sets the specified value to the diagonal of the (i, i) subblock of the matrix-by-blocks structure.
 
void DeleteValsRowi (unsigned long block_i, unsigned long row)
 Deletes the values of a row of the sparse matrix.
 
template<class OtherType >
void EnforceSolutionAtNode (unsigned long node_i, const OtherType *x_i, CSysVector< OtherType > &b)
 Modifies this matrix (A) and a rhs vector (b) such that (A^-1 * b)_i = x_i.
 
template<class OtherType >
void EnforceZeroProjection (unsigned long node_i, const OtherType *n, CSysVector< OtherType > &b)
 Similar to EnforceSolutionAtNode, but for 0 projection in a given direction.
 
void SetDiagonalAsColumnSum ()
 Sets the diagonal entries of the matrix as the sum of the blocks in the corresponding column.
 
void TransposeInPlace ()
 Transposes the matrix, any preconditioner that was computed may be invalid.
 
void MatrixMatrixAddition (ScalarType alpha, const CSysMatrix &B)
 Add a scaled sparse matrix to "this" (axpy-type operation, A = A+alpha*B).
 
void MatrixVectorProduct (const CSysVector< ScalarType > &vec, CSysVector< ScalarType > &prod, CGeometry *geometry, const CConfig *config) const
 Performs the product of a sparse matrix by a CSysVector.
 
void BuildJacobiPreconditioner ()
 Build the Jacobi preconditioner.
 
void ComputeJacobiPreconditioner (const CSysVector< ScalarType > &vec, CSysVector< ScalarType > &prod, CGeometry *geometry, const CConfig *config) const
 Multiply CSysVector by the preconditioner.
 
void BuildILUPreconditioner ()
 Build the ILU preconditioner.
 
void ComputeILUPreconditioner (const CSysVector< ScalarType > &vec, CSysVector< ScalarType > &prod, CGeometry *geometry, const CConfig *config) const
 Multiply CSysVector by the preconditioner.
 
void BuildLU_SGSPreconditioner ()
 Build the LU-SGS preconditioner.
 
void ComputeLU_SGSPreconditioner (const CSysVector< ScalarType > &vec, CSysVector< ScalarType > &prod, CGeometry *geometry, const CConfig *config) const
 Multiply CSysVector by the preconditioner.
 
void BuildLineletPreconditioner (const CGeometry *geometry, const CConfig *config)
 Build the Linelet preconditioner.
 
void ComputeLineletPreconditioner (const CSysVector< ScalarType > &vec, CSysVector< ScalarType > &prod, CGeometry *geometry, const CConfig *config) const
 Multiply CSysVector by the preconditioner.
 
void ComputeResidual (const CSysVector< ScalarType > &sol, const CSysVector< ScalarType > &f, CSysVector< ScalarType > &res) const
 Compute the linear residual.
 
void BuildPastixPreconditioner (CGeometry *geometry, const CConfig *config, unsigned short kind_fact)
 Factorize matrix using PaStiX.
 
void ComputePastixPreconditioner (const CSysVector< ScalarType > &vec, CSysVector< ScalarType > &prod, CGeometry *geometry, const CConfig *config) const
 Apply the PaStiX factorization to CSysVec.
 

Friends

struct CSysMatrixComms
 

Detailed Description

template<class ScalarType>
class CSysMatrix< ScalarType >

Main class for defining block-compressed-row-storage sparse matrices.

Constructor & Destructor Documentation

◆ CSysMatrix()

template<class ScalarType >
CSysMatrix< ScalarType >::CSysMatrix ( )

Constructor of the class.

◆ ~CSysMatrix()

template<class ScalarType >
CSysMatrix< ScalarType >::~CSysMatrix ( )

Destructor of the class.

Member Function Documentation

◆ AddBlock()

template<class ScalarType >
template<class T , class OtherType = ScalarType>
void CSysMatrix< ScalarType >::AddBlock ( unsigned long  block_i,
unsigned long  block_j,
const T &  val_block,
OtherType  alpha = 1.0 
)
inline

Add a scaled block (in flat format) to the sparse matrix (see SetBlock).

Parameters
[in]block_i- Row index.
[in]block_j- Column index.
[in]val_block- Block to set to A(i, j).
[in]alpha- Scale factor.

◆ AddBlock2Diag()

template<class ScalarType >
template<class OtherType , class T = ScalarType>
void CSysMatrix< ScalarType >::AddBlock2Diag ( unsigned long  block_i,
const OtherType &  val_block,
T  alpha = 1.0 
)
inline

Non overwrite version of SetBlock2Diag, also with scaling.

◆ AddVal2Diag() [1/2]

template<class ScalarType >
template<class OtherType >
void CSysMatrix< ScalarType >::AddVal2Diag ( unsigned long  block_i,
OtherType  val_matrix 
)
inline

Adds the specified value to the diagonal of the (i, i) subblock of the matrix-by-blocks structure.

Parameters
[in]block_i- Diagonal index.
[in]val_matrix- Value to add to the diagonal elements of A(i, i).

◆ AddVal2Diag() [2/2]

template<class ScalarType >
template<class OtherType >
void CSysMatrix< ScalarType >::AddVal2Diag ( unsigned long  block_i,
unsigned long  iVar,
OtherType  val 
)
inline

Adds the specified value to the diagonal of the (i, i) subblock of the matrix-by-blocks structure.

Parameters
[in]block_i- Diagonal index.
[in]iVar- Variable index.
[in]val- Value to add to the diagonal elements of A(i, i).

◆ BuildILUPreconditioner()

template<class ScalarType >
void CSysMatrix< ScalarType >::BuildILUPreconditioner ( )

Build the ILU preconditioner.

◆ BuildJacobiPreconditioner()

template<class ScalarType >
void CSysMatrix< ScalarType >::BuildJacobiPreconditioner ( )

Build the Jacobi preconditioner.

◆ BuildLineletPreconditioner()

template<class ScalarType >
void CSysMatrix< ScalarType >::BuildLineletPreconditioner ( const CGeometry *  geometry,
const CConfig *  config 
)

Build the Linelet preconditioner.

Parameters
[in]geometry- Geometrical definition of the problem.
[in]config- Definition of the particular problem.

◆ BuildLU_SGSPreconditioner()

template<class ScalarType >
void CSysMatrix< ScalarType >::BuildLU_SGSPreconditioner ( )

Build the LU-SGS preconditioner.

◆ BuildPastixPreconditioner()

template<class ScalarType >
void CSysMatrix< ScalarType >::BuildPastixPreconditioner ( CGeometry *  geometry,
const CConfig *  config,
unsigned short  kind_fact 
)

Factorize matrix using PaStiX.

Parameters
[in]geometry- Geometrical definition of the problem.
[in]config- Definition of the particular problem.
[in]kind_fact- Type of factorization.

◆ ComputeILUPreconditioner()

template<class ScalarType >
void CSysMatrix< ScalarType >::ComputeILUPreconditioner ( const CSysVector< ScalarType > &  vec,
CSysVector< ScalarType > &  prod,
CGeometry *  geometry,
const CConfig *  config 
) const

Multiply CSysVector by the preconditioner.

Parameters
[in]vec- CSysVector to be multiplied by the preconditioner.
[out]prod- Result of the product A*vec.
[in]geometry- Geometrical definition of the problem.
[in]config- Definition of the particular problem.

◆ ComputeJacobiPreconditioner()

template<class ScalarType >
void CSysMatrix< ScalarType >::ComputeJacobiPreconditioner ( const CSysVector< ScalarType > &  vec,
CSysVector< ScalarType > &  prod,
CGeometry *  geometry,
const CConfig *  config 
) const

Multiply CSysVector by the preconditioner.

Parameters
[in]vec- CSysVector to be multiplied by the preconditioner.
[out]prod- Result of the product A*vec.
[in]geometry- Geometrical definition of the problem.
[in]config- Definition of the particular problem.

◆ ComputeLineletPreconditioner()

template<class ScalarType >
void CSysMatrix< ScalarType >::ComputeLineletPreconditioner ( const CSysVector< ScalarType > &  vec,
CSysVector< ScalarType > &  prod,
CGeometry *  geometry,
const CConfig *  config 
) const

Multiply CSysVector by the preconditioner.

Parameters
[in]vec- CSysVector to be multiplied by the preconditioner.
[out]prod- Result of the product A*vec.

◆ ComputeLU_SGSPreconditioner()

template<class ScalarType >
void CSysMatrix< ScalarType >::ComputeLU_SGSPreconditioner ( const CSysVector< ScalarType > &  vec,
CSysVector< ScalarType > &  prod,
CGeometry *  geometry,
const CConfig *  config 
) const

Multiply CSysVector by the preconditioner.

Parameters
[in]vec- CSysVector to be multiplied by the preconditioner.
[out]prod- Result of the product A*vec.

◆ ComputePastixPreconditioner()

template<class ScalarType >
void CSysMatrix< ScalarType >::ComputePastixPreconditioner ( const CSysVector< ScalarType > &  vec,
CSysVector< ScalarType > &  prod,
CGeometry *  geometry,
const CConfig *  config 
) const

Apply the PaStiX factorization to CSysVec.

Parameters
[in]vec- CSysVector to be multiplied by the preconditioner.
[out]prod- Result of the product M*vec.
[in]geometry- Geometrical definition of the problem.
[in]config- Definition of the particular problem.

◆ ComputeResidual()

template<class ScalarType >
void CSysMatrix< ScalarType >::ComputeResidual ( const CSysVector< ScalarType > &  sol,
const CSysVector< ScalarType > &  f,
CSysVector< ScalarType > &  res 
) const

Compute the linear residual.

Parameters
[in]sol- Solution (x).
[in]f- Right hand side (b).
[out]res- Residual (Ax-b).

◆ DeleteValsRowi()

template<class ScalarType >
void CSysMatrix< ScalarType >::DeleteValsRowi ( unsigned long  block_i,
unsigned long  row 
)

Deletes the values of a row of the sparse matrix.

Parameters
[in]block_i- Index of the block.
[in]row- Row within the block.

◆ EnforceSolutionAtNode()

template<class ScalarType >
template<class OtherType >
void CSysMatrix< ScalarType >::EnforceSolutionAtNode ( unsigned long  node_i,
const OtherType *  x_i,
CSysVector< OtherType > &  b 
)

Modifies this matrix (A) and a rhs vector (b) such that (A^-1 * b)_i = x_i.

Parameters
[in]node_i- Index of the node for which to enforce the solution of all DOF's.
[in]x_i- Values to enforce (nVar sized).
[in,out]b- The rhs vector (b := b - A_{*,i} * x_i; b_i = x_i).

◆ EnforceZeroProjection()

template<class ScalarType >
template<class OtherType >
void CSysMatrix< ScalarType >::EnforceZeroProjection ( unsigned long  node_i,
const OtherType *  n,
CSysVector< OtherType > &  b 
)

Similar to EnforceSolutionAtNode, but for 0 projection in a given direction.

◆ GetBlock() [1/2]

template<class ScalarType >
ScalarType * CSysMatrix< ScalarType >::GetBlock ( unsigned long  block_i,
unsigned long  block_j 
)
inline

Get a pointer to the start of block "ij", non-const version.

◆ GetBlock() [2/2]

template<class ScalarType >
const ScalarType * CSysMatrix< ScalarType >::GetBlock ( unsigned long  block_i,
unsigned long  block_j 
) const
inline

Get a pointer to the start of block "ij".

Parameters
[in]block_i- Row index.
[in]block_j- Column index.
Returns
Pointer to location in memory where the block starts.

◆ GetBlocks()

template<class ScalarType >
void CSysMatrix< ScalarType >::GetBlocks ( unsigned long  iEdge,
unsigned long  iPoint,
unsigned long  jPoint,
ScalarType *&  bii,
ScalarType *&  bij,
ScalarType *&  bji,
ScalarType *&  bjj 
)
inline

Returns the 4 blocks ii, ij, ji, jj used by "UpdateBlocks".

Note
This method assumes an FVM-type sparse pattern.
Parameters
[in]edge- Index of edge that connects iPoint and jPoint.
[in]iPoint- Row to which we add the blocks.
[in]jPoint- Row from which we subtract the blocks.
[out]bii,bij,bji,bjj- Blocks of the matrix.

◆ GetBlockView() [1/2]

template<class ScalarType >
CBlockView< ScalarType > CSysMatrix< ScalarType >::GetBlockView ( unsigned long  block_i,
unsigned long  block_j 
)
inline

◆ GetBlockView() [2/2]

template<class ScalarType >
CBlockView< const ScalarType > CSysMatrix< ScalarType >::GetBlockView ( unsigned long  block_i,
unsigned long  block_j 
) const
inline

Read-only view of block (block_i, block_j). In Q_LU_SGS mode values are decoded on access inside CBlockView::operator()(i,j); no temporary copy is made.

Returns
A CBlockView<const ScalarType> that evaluates to false if the block is absent.

◆ HtDTransfer()

template<class ScalarType >
void CSysMatrix< ScalarType >::HtDTransfer ( bool  trigger = true) const

Performs the memory copy from host to device.

Parameters
[in]trigger- boolean value that decides whether to conduct the transfer or not. True by default.

◆ Initialize()

template<class ScalarType >
void CSysMatrix< ScalarType >::Initialize ( unsigned long  npoint,
unsigned long  npointdomain,
unsigned short  nvar,
unsigned short  neqn,
bool  EdgeConnect,
CGeometry *  geometry,
const CConfig *  config,
bool  needTranspPtr = false,
bool  allow_quant = false,
std::optional< unsigned short >  override_prec = std::nullopt 
)

Initializes the sparse matrix.

Note
The preconditioners require nVar == nEqn (square blocks).
Parameters
[in]npoint- Number of points including halos.
[in]npointdomain- Number of points excluding halos.
[in]nvar- Number of variables (and rows of the blocks).
[in]neqn- Number of equations (and columns of the blocks).
[in]geometry- Geometrical definition of the problem.
[in]config- Definition of the particular problem.
[in]needTranspPtr- If the L/U transpose maps should be built, used for "SetDiagonalAsColumnSum".
[in]allow_quant- Quantization is only possible with solvers that "set and forget" the off-diagonal blocks of the matrix. Solvers that perform multiple updates would lose too much information, so that pattern is not supported with quantization (the code will hit null pointers). It is up to the solver to declare whether it will "set and forget".
[in]override_prec- Decide if, and with what argument to override the preconditioner.

◆ MatrixMatrixAddition()

template<class ScalarType >
void CSysMatrix< ScalarType >::MatrixMatrixAddition ( ScalarType  alpha,
const CSysMatrix< ScalarType > &  B 
)

Add a scaled sparse matrix to "this" (axpy-type operation, A = A+alpha*B).

Note
Matrices must have the same sparse pattern.
Parameters
[in]alpha- The scaling constant.
[in]B- Matrix being.

◆ MatrixVectorProduct()

template<class ScalarType >
void CSysMatrix< ScalarType >::MatrixVectorProduct ( const CSysVector< ScalarType > &  vec,
CSysVector< ScalarType > &  prod,
CGeometry *  geometry,
const CConfig *  config 
) const

Performs the product of a sparse matrix by a CSysVector.

Parameters
[in]vec- CSysVector to be multiplied by the sparse matrix A.
[in]geometry- Geometrical definition of the problem.
[in]config- Definition of the particular problem.
[out]prod- Result of the product.

◆ QuantizeDiagonalBlocks()

template<class ScalarType >
void CSysMatrix< ScalarType >::QuantizeDiagonalBlocks ( )

Compresses off-diagonal blocks into quantized form for use with USE_QUANTIZATION.

◆ SetBlock() [1/3]

template<class ScalarType >
template<bool Overwrite = true, class OtherType >
void CSysMatrix< ScalarType >::SetBlock ( unsigned long  block_i,
unsigned long  block_j,
const OtherType *const *  val_block,
std::decay_t< OtherType >  alpha = 1.0 
)
inline

◆ SetBlock() [2/3]

template<class ScalarType >
template<bool Overwrite = true, class OtherType , su2enable_if<!is_pointer< OtherType >::value > = 0>
void CSysMatrix< ScalarType >::SetBlock ( unsigned long  block_i,
unsigned long  block_j,
const OtherType *  val_block,
std::decay_t< OtherType >  alpha = 1.0 
)
inline

◆ SetBlock() [3/3]

template<class ScalarType >
template<bool Overwrite = true, class MatrixType >
void CSysMatrix< ScalarType >::SetBlock ( unsigned long  block_i,
unsigned long  block_j,
MatrixType &  val_block,
std::decay_t< typename MatrixType::Scalar >  alpha = 1.0 
)
inline

Set the value of a scaled block in the sparse matrix.

Note
This is an templated overload for C2Dcontainer specialization su2matrix. It assumes that MatrixType supports a member type Scalar and access operator(i, j). If the template param Overwrite is false we add to the block (bij += alpha*b).
Parameters
[in]block_i- Row index.
[in]block_j- Column index.
[in]val_block- Block to set to A(i, j).
[in]alpha- Scale factor.

◆ SetBlock2Diag()

template<class ScalarType >
template<class OtherType , bool Overwrite = true, class T = ScalarType>
void CSysMatrix< ScalarType >::SetBlock2Diag ( unsigned long  block_i,
const OtherType &  val_block,
T  alpha = 1.0 
)
inline

Sets the specified block to the (i, i) subblock of the sparse matrix. Scales the input block by factor alpha. If the Overwrite parameter is false we update instead (bii += alpha*b).

Parameters
[in]block_i- Diagonal index.
[in]val_block- Block to add to the diagonal of the matrix.
[in]alpha- Scale factor.

◆ SetBlocks() [1/4]

template<class ScalarType >
template<class MatTypeSIMD , size_t N, class I , class F = ScalarType>
void CSysMatrix< ScalarType >::SetBlocks ( simd::Array< I, N >  iEdge,
const MatTypeSIMD &  block_i,
const MatTypeSIMD &  block_j,
simd::Array< F, N >  mask = 1 
)
inline

SIMD version, does the update for multiple edges.

Note
Nothing is updated if the mask is 0.

◆ SetBlocks() [2/4]

template<class ScalarType >
template<class MatTypeSIMD , size_t N, class I , class F = ScalarType>
void CSysMatrix< ScalarType >::SetBlocks ( simd::Array< I, N >  iEdge,
simd::Array< I, N >  iPoint,
simd::Array< I, N >  jPoint,
const MatTypeSIMD &  block_i,
const MatTypeSIMD &  block_j,
simd::Array< F, N >  mask = 1 
)
inline

SIMD version, does the update for multiple edges and points.

Note
Nothing is updated if the mask is 0.

◆ SetBlocks() [3/4]

template<class ScalarType >
template<class MatrixType , class OtherType = ScalarType, bool Overwrite = true>
void CSysMatrix< ScalarType >::SetBlocks ( unsigned long  iEdge,
const MatrixType &  block_i,
const MatrixType &  block_j,
OtherType  scale = 1 
)
inline

Sets 2 blocks ij and ji (add to i* sub from j*) associated with one edge of an FVM-type sparse pattern.

Note
The parameter Overwrite allows completely writing over the current values held by the matrix (true), or updating them (false).
Parameters
[in]edge- Index of edge that connects iPoint and jPoint.
[in]block_i- Subs from ji.
[in]block_j- Adds to ij.
[in]scale- Scale blocks during update (axpy type op).

◆ SetBlocks() [4/4]

template<class ScalarType >
template<class MatrixType , class OtherType = ScalarType>
void CSysMatrix< ScalarType >::SetBlocks ( unsigned long  iEdge,
unsigned long  iPoint,
unsigned long  jPoint,
const MatrixType &  jac_ii,
const MatrixType &  jac_ij,
const MatrixType &  jac_ji,
const MatrixType &  jac_jj,
OtherType  mask = 1 
)
inline

Set the four blocks of an edge, for fluxes whose i and j contributions are independent.

Note
The diagonal blocks are accumulated, the off-diagonal blocks are set.

◆ SetDiagonalAsColumnSum()

template<class ScalarType >
void CSysMatrix< ScalarType >::SetDiagonalAsColumnSum ( )

Sets the diagonal entries of the matrix as the sum of the blocks in the corresponding column.

◆ SetOffDiagBlocks()

template<class ScalarType >
template<class MatrixType , class OtherType = ScalarType>
void CSysMatrix< ScalarType >::SetOffDiagBlocks ( unsigned long  iEdge,
const MatrixType &  jac_ij,
const MatrixType &  jac_ji,
OtherType  mask = 1 
)
inline

Set the off-diagonal blocks of an edge, the diagonal being assembled elsewhere.

◆ SetVal2Diag()

template<class ScalarType >
template<class OtherType >
void CSysMatrix< ScalarType >::SetVal2Diag ( unsigned long  block_i,
OtherType  val_matrix 
)
inline

Sets the specified value to the diagonal of the (i, i) subblock of the matrix-by-blocks structure.

Parameters
[in]block_i- Diagonal index.
[in]val_matrix- Value to add to the diagonal elements of A(i, i).

◆ SetValDiagonalZero()

template<class ScalarType >
void CSysMatrix< ScalarType >::SetValDiagonalZero ( )

Sets to zero all the block diagonal entries of the sparse matrix.

◆ SetValZero()

template<class ScalarType >
void CSysMatrix< ScalarType >::SetValZero ( )

Sets to zero all the entries of the sparse matrix.

◆ SubtractBlock()

template<class ScalarType >
template<class T >
void CSysMatrix< ScalarType >::SubtractBlock ( unsigned long  block_i,
unsigned long  block_j,
const T &  val_block 
)
inline

Subtracts the specified block to the sparse matrix (see AddBlock).

Parameters
[in]block_i- Row index.
[in]block_j- Column index.
[in]val_block- Block to subtract to A(i, j).

◆ SubtractBlock2Diag()

template<class ScalarType >
template<class OtherType >
void CSysMatrix< ScalarType >::SubtractBlock2Diag ( unsigned long  block_i,
const OtherType &  val_block 
)
inline

Short-hand to AddBlock2Diag with alpha = -1, i.e. subtracts from the current diagonal.

◆ TransposeInPlace()

template<class ScalarType >
void CSysMatrix< ScalarType >::TransposeInPlace ( )

Transposes the matrix, any preconditioner that was computed may be invalid.

◆ UpdateBlocks() [1/2]

template<class ScalarType >
template<class MatrixType , class OtherType = ScalarType>
void CSysMatrix< ScalarType >::UpdateBlocks ( unsigned long  iEdge,
const MatrixType &  block_i,
const MatrixType &  block_j,
OtherType  scale = 1 
)
inline

Short-hand for the "additive overwrite" version of SetBlocks.

◆ UpdateBlocks() [2/2]

template<class ScalarType >
template<bool OverwriteOffDiag = false, class MatrixType , class OtherType = ScalarType>
void CSysMatrix< ScalarType >::UpdateBlocks ( unsigned long  iEdge,
unsigned long  iPoint,
unsigned long  jPoint,
const MatrixType &  block_i,
const MatrixType &  block_j,
OtherType  scale = 1 
)
inline

Update 4 blocks ii, ij, ji, jj (add to i* sub from j*).

Note
This method assumes an FVM-type sparse pattern.
Parameters
[in]edge- Index of edge that connects iPoint and jPoint.
[in]iPoint- Row to which we add the blocks.
[in]jPoint- Row from which we subtract the blocks.
[in]block_i- Adds to ii, subs from ji.
[in]block_j- Adds to ij, subs from jj.
[in]scale- Scale blocks during update (axpy type op).

◆ UpdateBlocksSub() [1/2]

template<class ScalarType >
template<class MatrixType >
void CSysMatrix< ScalarType >::UpdateBlocksSub ( unsigned long  iEdge,
const MatrixType &  block_i,
const MatrixType &  block_j 
)
inline

Short-hand for the "subtractive" version (sub from i* add to j*) of SetBlocks.

◆ UpdateBlocksSub() [2/2]

template<class ScalarType >
template<class MatrixType >
void CSysMatrix< ScalarType >::UpdateBlocksSub ( unsigned long  iEdge,
unsigned long  iPoint,
unsigned long  jPoint,
const MatrixType &  block_i,
const MatrixType &  block_j 
)
inline

Short-hand for the "subtractive" version (sub from i* add to j*) of UpdateBlocks.

Friends And Related Symbol Documentation

◆ CSysMatrixComms

template<class ScalarType >
friend struct CSysMatrixComms
friend

The documentation for this class was generated from the following files: