SparseSubstitutionSolver Class Reference

#include <SparseSubstitutionSolver.h>

Inheritance diagram for SparseSubstitutionSolver:
Solver

Public Member Functions

 SparseSubstitutionSolver ()
 
 ~SparseSubstitutionSolver ()
 
int init (int num_nodes, int num_elements, mesh_node *node, tetra_element_linear *elem, SimulationParams *params, int num_pinned_nodes, int *pinned_nodes_list, set< int > bsite_pinned_node_list)
 
int solve (vector3 *x)
 
void apply_matrix (scalar *in, scalar *result)
 
- Public Member Functions inherited from Solver
 Solver ()
 
virtual ~Solver ()
 

Private Attributes

int num_rows
 
int total_entries_in_U
 
scalarinverse_diag
 
int * L_key
 
int * U_key
 
scalarL
 
scalarU
 

Constructor & Destructor Documentation

◆ SparseSubstitutionSolver()

SparseSubstitutionSolver::SparseSubstitutionSolver ( )

Constructor

◆ ~SparseSubstitutionSolver()

SparseSubstitutionSolver::~SparseSubstitutionSolver ( )

Destructor

Member Function Documentation

◆ apply_matrix()

void SparseSubstitutionSolver::apply_matrix ( scalar in,
scalar result 
)
virtual

Implements Solver.

◆ init()

int SparseSubstitutionSolver::init ( int  num_nodes,
int  num_elements,
mesh_node node,
tetra_element_linear elem,
SimulationParams params,
int  num_pinned_nodes,
int *  pinned_nodes_list,
set< int >  bsite_pinned_node_list 
)
virtual

Builds the lower triangular Cholesky decomposed mass matrix

Implements Solver.

◆ solve()

int SparseSubstitutionSolver::solve ( vector3 x)
virtual

Solves the equation Ax = b for the unknown vector x, for 3 right-hand-sides (b vectors) at once, using forward and backward substitution. This function considers the case where A is sparse symmetric positive-definite and therefore the solver must have constructed a variable band matrix containing the result of a Cholesky decomposition on the original matrix A.

This implementation is memory efficient as it modifies the vector x in place (no temporary vectors are needed).

Implements Solver.

Field Documentation

◆ inverse_diag

scalar* SparseSubstitutionSolver::inverse_diag
private

Stores the inverse of the diagonal elements (need for LU solving)

Referenced by init(), solve(), SparseSubstitutionSolver(), and ~SparseSubstitutionSolver().

◆ L

scalar* SparseSubstitutionSolver::L
private

Stores all the data from the bands of the band matrix (note that this may contain some zeroes, but if it is a proper sparse band matrix there should be very few of these) NOT INCLUDING THE DIAGONAL: only the inverse of the diagonal.

The off-diagonal data for the lower and upper triangles are stored in L and U respectively.

Referenced by init(), solve(), SparseSubstitutionSolver(), and ~SparseSubstitutionSolver().

◆ L_key

int* SparseSubstitutionSolver::L_key
private

Array of size num_rows. Each element contains the index of the last non-zero entry in the corresponding column. This is the end of the "band" of entries stored in that column, that starts from the diagonal (travelling downwards or upwards for the L and U matrices respectively).

Referenced by init(), solve(), SparseSubstitutionSolver(), and ~SparseSubstitutionSolver().

◆ num_rows

int SparseSubstitutionSolver::num_rows
private

Number of rows in this cholesky variable band matrix

Referenced by init(), solve(), SparseSubstitutionSolver(), and ~SparseSubstitutionSolver().

◆ total_entries_in_U

int SparseSubstitutionSolver::total_entries_in_U
private

Stores the number of entries stored in the upper triangle

Referenced by init(), and solve().

◆ U

scalar * SparseSubstitutionSolver::U
private

◆ U_key

int * SparseSubstitutionSolver::U_key
private

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