|
VMTK
|
Implements a row-based sparse matrix built from mesh neighborhoods or stencils, supporting basic linear algebra operations. More...
#include <vtkvmtkSparseMatrix.h>
Public Types | |
| typedef vtkObject | Superclass |
Public Member Functions | |
| virtual int | IsA (const char *type) |
| vtkvmtkSparseMatrix * | NewInstance () const |
| void | Multiply (vtkvmtkDoubleVector *x, vtkvmtkDoubleVector *y) |
| void | TransposeMultiply (vtkvmtkDoubleVector *x, vtkvmtkDoubleVector *y) |
| vtkvmtkSparseMatrixRow * | GetRow (vtkIdType i) |
| virtual vtkIdType | GetNumberOfRows () |
| void | CopyRowsFromStencils (vtkvmtkStencils *stencils) |
| void | AllocateRowsFromNeighborhoods (vtkvmtkNeighborhoods *neighborhoods, int numberOfVariables=1) |
| void | AllocateRowsFromDataSet (vtkDataSet *dataSet, int numberOfVariables=1) |
| void | Initialize () |
| void | SetNumberOfRows (vtkIdType numberOfRows) |
| double | GetElement (vtkIdType i, vtkIdType j) |
| void | SetElement (vtkIdType i, vtkIdType j, double value) |
| void | AddElement (vtkIdType i, vtkIdType j, double value) |
| void | DeepCopy (vtkvmtkSparseMatrix *src) |
Static Public Member Functions | |
| static vtkvmtkSparseMatrix * | New () |
| static int | IsTypeOf (const char *type) |
| static vtkvmtkSparseMatrix * | SafeDownCast (vtkObjectBase *o) |
Protected Member Functions | |
| virtual vtkObjectBase * | NewInstanceInternal () const |
| vtkvmtkSparseMatrix () | |
| ~vtkvmtkSparseMatrix () | |
Protected Attributes | |
| vtkvmtkSparseMatrixRow ** | Array |
| vtkIdType | NumberOfRows |
Implements a row-based sparse matrix built from mesh neighborhoods or stencils, supporting basic linear algebra operations.
vtkvmtkSparseMatrix stores one vtkvmtkSparseMatrixRow per matrix row, each row holding the off-diagonal (column id, value) pairs plus a separate diagonal element. Rows can be allocated from the point connectivity of a vtkDataSet (AllocateRowsFromDataSet) or from a vtkvmtkNeighborhoods object (AllocateRowsFromNeighborhoods) – both optionally replicated for several independent variables per point (numberOfVariables) to build a block-structured system – or its row structure and weights can be copied directly from a set of finite-element/ Laplacian vtkvmtkStencils (CopyRowsFromStencils). It supports matrix-vector multiplication (Multiply, TransposeMultiply) against a vtkvmtkDoubleVector and is the matrix type used by vtkvmtkLinearSystem / vtkvmtkOpenNLLinearSystemSolver and the finite-element assemblers (vtkvmtkFEAssembler subclasses) throughout vmtk's harmonic mapping, gradient, and vorticity filters.
Definition at line 49 of file vtkvmtkSparseMatrix.h.
| typedef vtkObject vtkvmtkSparseMatrix::Superclass |
Definition at line 54 of file vtkvmtkSparseMatrix.h.
|
protected |
Definition at line 32 of file vtkvmtkSparseMatrix.cxx.
|
protected |
Definition at line 38 of file vtkvmtkSparseMatrix.cxx.
|
static |
|
static |
|
virtual |
|
static |
|
protectedvirtual |
| vtkvmtkSparseMatrix * vtkvmtkSparseMatrix::NewInstance | ( | ) | const |
| void vtkvmtkSparseMatrix::Multiply | ( | vtkvmtkDoubleVector * | x, |
| vtkvmtkDoubleVector * | y ) |
Compute y = A*x, the matrix-vector product of this sparse matrix with x, storing the result in y. Values are clamped to +/-VTK_VMTK_LARGE_DOUBLE and snapped to zero below VTK_VMTK_PIVOTING_TOL to guard against overflow/underflow.
Definition at line 247 of file vtkvmtkSparseMatrix.cxx.
| void vtkvmtkSparseMatrix::TransposeMultiply | ( | vtkvmtkDoubleVector * | x, |
| vtkvmtkDoubleVector * | y ) |
Compute y = A^T*x, the matrix-vector product of this sparse matrix's transpose with x, storing the result in y. Values are clamped/snapped the same way as Multiply().
Definition at line 282 of file vtkvmtkSparseMatrix.cxx.
|
inline |
|
virtual |
Get the number of rows currently allocated in the matrix. Use SetNumberOfRows() to change it.
| void vtkvmtkSparseMatrix::CopyRowsFromStencils | ( | vtkvmtkStencils * | stencils | ) |
Initialize the matrix with one row per stencil in stencils, copying each stencil's neighbor ids, weights, and center weight into the corresponding matrix row (see vtkvmtkSparseMatrixRow::CopyStencil). Replaces any previously allocated rows.
Definition at line 86 of file vtkvmtkSparseMatrix.cxx.
| void vtkvmtkSparseMatrix::AllocateRowsFromNeighborhoods | ( | vtkvmtkNeighborhoods * | neighborhoods, |
| int | numberOfVariables = 1 ) |
Initialize the matrix with numberOfVariables * neighborhoods->GetNumberOfNeighborhoods() rows, one per (point, variable) pair, allocating each row's column structure (values left at 0) from the corresponding neighborhood's point ids, replicated across all variable blocks so the matrix can represent a coupled multi-variable system. Replaces any previously allocated rows.
Definition at line 108 of file vtkvmtkSparseMatrix.cxx.
| void vtkvmtkSparseMatrix::AllocateRowsFromDataSet | ( | vtkDataSet * | dataSet, |
| int | numberOfVariables = 1 ) |
Initialize the matrix the same way as AllocateRowsFromNeighborhoods, but building the point neighborhoods internally from the connectivity of dataSet (must be a vtkPolyData or vtkUnstructuredGrid). Replaces any previously allocated rows.
Definition at line 152 of file vtkvmtkSparseMatrix.cxx.
| void vtkvmtkSparseMatrix::Initialize | ( | ) |
Release all allocated rows and reset the matrix to zero rows.
Definition at line 51 of file vtkvmtkSparseMatrix.cxx.
| void vtkvmtkSparseMatrix::SetNumberOfRows | ( | vtkIdType | numberOfRows | ) |
Set the number of rows in the matrix, (re)allocating a fresh vtkvmtkSparseMatrixRow for each row (any previously allocated rows are released). Rows are created empty; use GetRow()->SetNumberOfElements() or one of the Allocate.../CopyRowsFromStencils() helpers to populate them.
Definition at line 65 of file vtkvmtkSparseMatrix.cxx.
| double vtkvmtkSparseMatrix::GetElement | ( | vtkIdType | i, |
| vtkIdType | j ) |
Get the value at row i, column j (the diagonal element when i == j, otherwise the off-diagonal element identified by column id j, which must already exist in the row's sparsity pattern).
Definition at line 215 of file vtkvmtkSparseMatrix.cxx.
| void vtkvmtkSparseMatrix::SetElement | ( | vtkIdType | i, |
| vtkIdType | j, | ||
| double | value ) |
Set the value at row i, column j (the diagonal element when i == j, otherwise the off-diagonal element identified by column id j, which must already exist in the row's sparsity pattern).
Definition at line 228 of file vtkvmtkSparseMatrix.cxx.
| void vtkvmtkSparseMatrix::AddElement | ( | vtkIdType | i, |
| vtkIdType | j, | ||
| double | value ) |
Add value to the current value at row i, column j (equivalent to SetElement(i,j,GetElement(i,j)+value)).
Definition at line 241 of file vtkvmtkSparseMatrix.cxx.
| void vtkvmtkSparseMatrix::DeepCopy | ( | vtkvmtkSparseMatrix * | src | ) |
Standard DeepCopy method: copies the number of rows and the contents of every row from src.
Definition at line 323 of file vtkvmtkSparseMatrix.cxx.
|
protected |
Definition at line 144 of file vtkvmtkSparseMatrix.h.
|
protected |
Definition at line 145 of file vtkvmtkSparseMatrix.h.