Represents a single row of a vtkvmtkSparseMatrix: a sparse list of (column id, value) pairs plus a separate diagonal element.
More...
#include <vtkvmtkSparseMatrixRow.h>
Represents a single row of a vtkvmtkSparseMatrix: a sparse list of (column id, value) pairs plus a separate diagonal element.
vtkvmtkSparseMatrixRow stores the off-diagonal, non-zero entries of one matrix row as two parallel arrays – element (column) ids and their values – together with a distinct diagonal value stored separately for fast access. Rows can be populated directly (SetElementId/ SetElement) or built from the neighbor list and weights of a vtkvmtkStencil (CopyStencil) or the point ids of a vtkvmtkNeighborhood (CopyNeighborhood). It is the building block used by vtkvmtkSparseMatrix.
- See also
- vtkvmtkSparseMatrix, vtkvmtkStencil, vtkvmtkNeighborhood
Definition at line 42 of file vtkvmtkSparseMatrixRow.h.
◆ Superclass
◆ vtkvmtkSparseMatrixRow()
| vtkvmtkSparseMatrixRow::vtkvmtkSparseMatrixRow |
( |
| ) |
|
|
protected |
◆ ~vtkvmtkSparseMatrixRow()
| vtkvmtkSparseMatrixRow::~vtkvmtkSparseMatrixRow |
( |
| ) |
|
|
protected |
◆ New()
◆ IsTypeOf()
| int vtkvmtkSparseMatrixRow::IsTypeOf |
( |
const char * | type | ) |
|
|
static |
◆ IsA()
| virtual int vtkvmtkSparseMatrixRow::IsA |
( |
const char * | type | ) |
|
|
virtual |
◆ SafeDownCast()
◆ NewInstanceInternal()
| virtual vtkObjectBase * vtkvmtkSparseMatrixRow::NewInstanceInternal |
( |
| ) |
const |
|
protectedvirtual |
◆ NewInstance()
◆ GetElementId()
| vtkIdType vtkvmtkSparseMatrixRow::GetElementId |
( |
vtkIdType | i | ) |
|
|
inline |
Get/set the column id stored at position i (0-based index into this row's element arrays, not a matrix column lookup – see GetElementIndex() to find the position for a given column id).
Definition at line 54 of file vtkvmtkSparseMatrixRow.h.
◆ SetElementId()
| void vtkvmtkSparseMatrixRow::SetElementId |
( |
vtkIdType | i, |
|
|
vtkIdType | id ) |
|
inline |
Get/set the column id stored at position i (0-based index into this row's element arrays, not a matrix column lookup – see GetElementIndex() to find the position for a given column id).
Definition at line 55 of file vtkvmtkSparseMatrixRow.h.
◆ GetElement()
| double vtkvmtkSparseMatrixRow::GetElement |
( |
vtkIdType | i | ) |
|
|
inline |
Get/set the off-diagonal value stored at position i (0-based index into this row's element arrays; see GetElementIndex() to find the position for a given column id).
Definition at line 63 of file vtkvmtkSparseMatrixRow.h.
◆ SetElement()
| void vtkvmtkSparseMatrixRow::SetElement |
( |
vtkIdType | i, |
|
|
double | element ) |
|
inline |
Get/set the off-diagonal value stored at position i (0-based index into this row's element arrays; see GetElementIndex() to find the position for a given column id).
Definition at line 64 of file vtkvmtkSparseMatrixRow.h.
◆ GetElementIndex()
| vtkIdType vtkvmtkSparseMatrixRow::GetElementIndex |
( |
vtkIdType | id | ) |
|
Look up the 0-based position within this row's element arrays that holds column id id, by linear search. Returns -1 (and raises an error) if id is not present in the row.
Definition at line 106 of file vtkvmtkSparseMatrixRow.cxx.
107{
108 vtkIdType index = -1;
109 int j;
111 {
113 {
114 index = j;
115 break;
116 }
117 }
118 if (index == -1)
119 {
120 vtkErrorMacro("Error: ElementId not in sparse matrix");
121 return -1;
122 }
123 return index;
124}
◆ GetNumberOfElements()
| vtkIdType vtkvmtkSparseMatrixRow::GetNumberOfElements |
( |
| ) |
|
|
inline |
Get/set the number of off-diagonal (column id, value) entries stored in this row. Setting the count (re)allocates the ElementIds/Elements arrays, releasing any previous contents and filling the new entries with id 0 / value 0.0; the diagonal element is also reset to 0.0.
Definition at line 79 of file vtkvmtkSparseMatrixRow.h.
◆ SetNumberOfElements()
| void vtkvmtkSparseMatrixRow::SetNumberOfElements |
( |
vtkIdType | numberOfElements | ) |
|
Get/set the number of off-diagonal (column id, value) entries stored in this row. Setting the count (re)allocates the ElementIds/Elements arrays, releasing any previous contents and filling the new entries with id 0 / value 0.0; the diagonal element is also reset to 0.0.
Definition at line 71 of file vtkvmtkSparseMatrixRow.cxx.
72{
73 vtkIdType i;
74
76
78 {
81 }
82
84
86 {
88 }
89
91 {
94 }
95
97
99 {
101 }
102
104}
◆ SetDiagonalElement()
| virtual void vtkvmtkSparseMatrixRow::SetDiagonalElement |
( |
double | | ) |
|
|
virtual |
Set/get the diagonal value of this matrix row, stored separately from the off-diagonal entries. Default: 0.0.
◆ GetDiagonalElement()
| virtual double vtkvmtkSparseMatrixRow::GetDiagonalElement |
( |
| ) |
|
|
virtual |
Set/get the diagonal value of this matrix row, stored separately from the off-diagonal entries. Default: 0.0.
◆ Initialize()
| void vtkvmtkSparseMatrixRow::Initialize |
( |
| ) |
|
Release the row's element arrays, reset the number of elements to zero, and reset the diagonal element to 0.0.
Definition at line 52 of file vtkvmtkSparseMatrixRow.cxx.
53{
55
57 {
60 }
61
63 {
66 }
67
69}
◆ CopyStencil()
Replace this row's contents with the neighbor point ids and weights of stencil: one off-diagonal entry per stencil neighbor (id = stencil point id, value = stencil weight) and the diagonal element set to the stencil's center weight.
Definition at line 126 of file vtkvmtkSparseMatrixRow.cxx.
127{
128 vtkIdType i;
129
131
133 {
136 }
137
139
141 {
143 }
144
146 {
149 }
150
152
154 {
156 }
157
159}
vtkIdType GetPointId(vtkIdType i)
vtkIdType GetNumberOfPoints()
double GetWeight(vtkIdType i)
◆ CopyNeighborhood()
Replace this row's off-diagonal column ids with the point ids of neighborhood (one entry per neighbor, values left at 0.0); the diagonal element is left unchanged.
Definition at line 161 of file vtkvmtkSparseMatrixRow.cxx.
162{
163 vtkIdType i;
164
166
168
169 for (i=0; i<numberOfNeighborhoodPoints; i++)
170 {
172 }
173}
void SetNumberOfElements(vtkIdType numberOfElements)
◆ DeepCopy()
Standard DeepCopy method. Since this object contains no reference to other objects, there is no ShallowCopy.
Definition at line 175 of file vtkvmtkSparseMatrixRow.cxx.
176{
178 {
181 }
182
184 {
187 }
188
190
192 {
197 }
198
200}
◆ ElementIds
| vtkIdType* vtkvmtkSparseMatrixRow::ElementIds |
|
protected |
◆ Elements
| double* vtkvmtkSparseMatrixRow::Elements |
|
protected |
◆ DiagonalElement
| double vtkvmtkSparseMatrixRow::DiagonalElement |
|
protected |
◆ NElements
| vtkIdType vtkvmtkSparseMatrixRow::NElements |
|
protected |
The documentation for this class was generated from the following files: