ITK
4.9.0
Insight Segmentation and Registration Toolkit
|
#include <itkFEMLinearSystemWrapper.h>
Defines all functions required by Solver class to allocate, assemble and solve a linear system of equation.
Linear system is defined as A*x=B, where A is a square matrix and F is a vector. Member functions are provided to access a specific element within A and B. Objects of derived classes should make appropriate calls to the numeric library in implementation of virtual functions to assemble and solve the linear system.
See comments for each virtual member for more information about how to derive a new LinearSystemWrapper class. An example derived class LinearSystemWrapperVNL is defined to use VNL sparse matrix representation and solver.
Definition at line 54 of file itkFEMLinearSystemWrapper.h.
Public Types | |
typedef std::vector< unsigned int > | ColumnArray |
typedef const Self * | ConstPointer |
typedef Self * | Pointer |
typedef LinearSystemWrapper | Self |
typedef Solution | Superclass |
Public Types inherited from itk::fem::Solution | |
typedef const Self * | ConstPointer |
typedef double | Float |
typedef Self * | Pointer |
typedef Solution | Self |
typedef Solution | Superclass |
Public Member Functions | |
virtual void | AddMatrixMatrix (unsigned int matrixIndex1, unsigned int matrixIndex2) |
virtual void | AddMatrixValue (unsigned int i, unsigned int j, Float value, unsigned int matrixIndex=0)=0 |
virtual void | AddSolutionValue (unsigned int i, Float value, unsigned int solutionIndex=0)=0 |
virtual void | AddVectorValue (unsigned int i, Float value, unsigned int vectorIndex=0)=0 |
virtual void | AddVectorVector (unsigned int vectorIndex1, unsigned int vectorIndex2) |
virtual void | Clean () |
virtual void | CopyMatrix (unsigned int matrixIndex1, unsigned int matrixIndex2) |
virtual void | CopySolution2Vector (unsigned int solutionIndex, unsigned int vectorIndex)=0 |
virtual void | CopyVector (unsigned int vectorSource, unsigned int vectorDestination) |
virtual void | CopyVector2Solution (unsigned int vectorIndex, unsigned int solutionIndex)=0 |
virtual void | DestroyMatrix (unsigned int matrixIndex=0)=0 |
virtual void | DestroySolution (unsigned int solutionIndex=0)=0 |
virtual void | DestroyVector (unsigned int vectorIndex=0)=0 |
virtual void | GetColumnsOfNonZeroMatrixElementsInRow (unsigned int row, ColumnArray &cols, unsigned int matrixIndex=0) |
virtual Float | GetMatrixValue (unsigned int i, unsigned int j, unsigned int matrixIndex=0) const =0 |
unsigned int | GetNumberOfMatrices () const |
unsigned int | GetNumberOfSolutions () const |
unsigned int | GetNumberOfVectors () const |
unsigned int | GetSystemOrder () const |
virtual Float | GetVectorValue (unsigned int i, unsigned int vectorIndex=0) const =0 |
virtual void | InitializeMatrix (unsigned int matrixIndex=0)=0 |
virtual void | InitializeSolution (unsigned int solutionIndex=0)=0 |
virtual void | InitializeVector (unsigned int vectorIndex=0)=0 |
virtual bool | IsMatrixInitialized (unsigned int matrixIndex=0)=0 |
virtual bool | IsSolutionInitialized (unsigned int solutionIndex=0)=0 |
virtual bool | IsVectorInitialized (unsigned int vectorIndex=0)=0 |
virtual void | MultiplyMatrixMatrix (unsigned int resultMatrixIndex, unsigned int leftMatrixIndex, unsigned int rightMatrixIndex)=0 |
virtual void | MultiplyMatrixSolution (unsigned int resultVectorIndex, unsigned int matrixIndex, unsigned int solutionIndex) |
virtual void | MultiplyMatrixVector (unsigned int resultVectorIndex, unsigned int matrixIndex, unsigned int vectorIndex) |
virtual void | OptimizeMatrixStorage (unsigned int matrixIndex, unsigned int tempMatrixIndex) |
virtual void | ReverseCuthillMckeeOrdering (ColumnArray &newNumbering, unsigned int matrixIndex=0) |
virtual void | ScaleMatrix (Float scale, unsigned int matrixIndex=0) |
void | ScaleSolution (Float scale, unsigned int solutionIndex=0) |
void | ScaleVector (Float scale, unsigned int vectorIndex=0) |
virtual void | SetMatrixValue (unsigned int i, unsigned int j, Float value, unsigned int matrixIndex=0)=0 |
void | SetNumberOfMatrices (unsigned int nMatrices) |
void | SetNumberOfSolutions (unsigned int nSolutions) |
void | SetNumberOfVectors (unsigned int nVectors) |
virtual void | SetSolutionValue (unsigned int i, Float value, unsigned int solutionIndex=0)=0 |
void | SetSystemOrder (unsigned int N) |
virtual void | SetVectorValue (unsigned int i, Float value, unsigned int vectorIndex=0)=0 |
virtual void | Solve (void)=0 |
virtual void | SwapMatrices (unsigned int matrixIndex1, unsigned int matrixIndex2)=0 |
virtual void | SwapSolutions (unsigned int solutionIndex1, unsigned int solutionIndex2)=0 |
virtual void | SwapVectors (unsigned int vectorIndex1, unsigned int vectorIndex2)=0 |
virtual | ~LinearSystemWrapper () |
LinearSystemWrapper () | |
Public Member Functions inherited from itk::fem::Solution | |
virtual Float | GetSolutionValue (unsigned int i, unsigned int solutionIndex=0) const =0 |
virtual | ~Solution () |
Protected Attributes | |
unsigned int | m_NumberOfMatrices |
unsigned int | m_NumberOfSolutions |
unsigned int | m_NumberOfVectors |
unsigned int | m_Order |
Private Member Functions | |
void | CuthillMckeeOrdering (ColumnArray &newNumbering, int startingRow, unsigned int matrixIndex=0) |
void | FollowConnectionsCuthillMckeeOrdering (unsigned int rowNumber, ColumnArray &rowDegree, ColumnArray &newNumbering, unsigned int nextRowNumber, unsigned int matrixIndex=0) |
LinearSystemWrapper (const LinearSystemWrapper &) | |
const LinearSystemWrapper & | operator= (const LinearSystemWrapper &) |
typedef std::vector<unsigned int> itk::fem::LinearSystemWrapper::ColumnArray |
Definition at line 62 of file itkFEMLinearSystemWrapper.h.
typedef const Self* itk::fem::LinearSystemWrapper::ConstPointer |
Definition at line 60 of file itkFEMLinearSystemWrapper.h.
Definition at line 59 of file itkFEMLinearSystemWrapper.h.
Definition at line 57 of file itkFEMLinearSystemWrapper.h.
Definition at line 58 of file itkFEMLinearSystemWrapper.h.
|
inline |
Constructor for linear system, should perform any initialization that is required by derived class.
Definition at line 68 of file itkFEMLinearSystemWrapper.h.
|
virtual |
Virtual destructor should properly destroy the object and clean up any memory allocated for matrix and vector storage.
|
private |
Copy constructor is not allowed.
|
virtual |
Adds two matrices storing the result in the first matrix.
matrixIndex1 | index of a matrix to add the other matrix to |
matrixIndex2 | index of matrix to add |
|
pure virtual |
Virtual function to add a value to a specific element of the A matrix.
i | row of the element |
j | column of the element |
value | value to add to the existing element |
matrixIndex | index of matrix to add value to |
Implemented in itk::fem::LinearSystemWrapperItpack, itk::fem::LinearSystemWrapperVNL, and itk::fem::LinearSystemWrapperDenseVNL.
|
pure virtual |
Virtual function to add a value of specific element of the solution vector.
i | element Index in solution vector |
value | new value of the element |
solutionIndex | index of solution vector to add value to |
Implemented in itk::fem::LinearSystemWrapperItpack, itk::fem::LinearSystemWrapperVNL, and itk::fem::LinearSystemWrapperDenseVNL.
|
pure virtual |
Virtual function to add a value to a specific element of the B vector.
i | row of the element |
value | value to add to the existing element |
vectorIndex | index of vector to add value to |
Implemented in itk::fem::LinearSystemWrapperItpack, itk::fem::LinearSystemWrapperVNL, and itk::fem::LinearSystemWrapperDenseVNL.
|
virtual |
Adds two vectors storing the result in the first vector.
vectorIndex1 | index of a vector to add the other vector to |
vectorIndex2 | index of vector to add |
|
virtual |
Clear all the data (matrices) inside the system, so that the system is ready to solve another problem from scratch.
|
virtual |
Copies the content of source matrix to destination matrix. Any existing data in destination matrix is overwritten.
matrixIndex1 | index of a matrix that will be copied |
matrixIndex2 | index of matrix to copy to |
|
pure virtual |
Copy a solution vector to a vector
solutionIndex | index of solution vector to copy |
vectorIndex | index of vector to copy solution to |
|
virtual |
Copy a vector
vectorSource | index of a vector to copy |
vectorDestination | index to copy the vector to |
|
pure virtual |
Copy a vector to a solution vector
vectorIndex | index of a vector to copy |
solutionIndex | index of a solution to copy the solution to |
Implemented in itk::fem::LinearSystemWrapperItpack, itk::fem::LinearSystemWrapperDenseVNL, and itk::fem::LinearSystemWrapperVNL.
|
private |
matrix reordering utility
|
pure virtual |
Free the memory from a matrix
matrixIndex | index of matrix to destroy |
Implemented in itk::fem::LinearSystemWrapperItpack, itk::fem::LinearSystemWrapperVNL, and itk::fem::LinearSystemWrapperDenseVNL.
|
pure virtual |
Free the memory from a solution vector
solutionIndex | index of solution vector to destroy |
Implemented in itk::fem::LinearSystemWrapperItpack, itk::fem::LinearSystemWrapperVNL, and itk::fem::LinearSystemWrapperDenseVNL.
|
pure virtual |
Free the memory from a vector
vectorIndex | index of vector to destroy |
Implemented in itk::fem::LinearSystemWrapperItpack, itk::fem::LinearSystemWrapperVNL, and itk::fem::LinearSystemWrapperDenseVNL.
|
private |
|
virtual |
Returns the column index (zero based) of the i-th non zero (non allocated)element in a given row of A matrix. This function is useful for optimizations when sparse matrices are used. Note that the value of an element with returned column index may actually be equal zero.
row | Row number |
cols | Which element in that row. Can range from 0 to number of elements allocated in a row. If this is out of range, the function returns -1. |
matrixIndex | Index of matrix (defaults to 0) |
Reimplemented in itk::fem::LinearSystemWrapperItpack.
|
pure virtual |
Virtual function to get a value of a specific element of a matrix.
i | row of the element |
j | column of the element |
matrixIndex | index of matrix to get value from |
Implemented in itk::fem::LinearSystemWrapperItpack, itk::fem::LinearSystemWrapperVNL, and itk::fem::LinearSystemWrapperDenseVNL.
|
inline |
Get Index of matrices used by system
Definition at line 128 of file itkFEMLinearSystemWrapper.h.
|
inline |
Get Index of solutions used by system
Definition at line 162 of file itkFEMLinearSystemWrapper.h.
|
inline |
Get Index of vectors used by system
Definition at line 145 of file itkFEMLinearSystemWrapper.h.
|
inline |
Get the order of the system
Definition at line 101 of file itkFEMLinearSystemWrapper.h.
|
pure virtual |
Virtual function to get a value of a specific element of the B vector.
i | row of the element |
vectorIndex | index of vector to get value from |
Implemented in itk::fem::LinearSystemWrapperItpack, itk::fem::LinearSystemWrapperVNL, and itk::fem::LinearSystemWrapperDenseVNL.
|
pure virtual |
Initialization of the A matrix. First any existing data for matrix A must be be destroyed, and then a new matrix is created in the memory. All elements in A must be set to zero.
matrixIndex | index of matrix to initialize |
Implemented in itk::fem::LinearSystemWrapperItpack, itk::fem::LinearSystemWrapperVNL, and itk::fem::LinearSystemWrapperDenseVNL.
|
pure virtual |
Initialization of a solution vector. Existing memory must be destroyed and the new solution vector is created in memory. All values should be set to zero.
solutionIndex | index of solution vector to initialize |
Implemented in itk::fem::LinearSystemWrapperItpack, itk::fem::LinearSystemWrapperVNL, and itk::fem::LinearSystemWrapperDenseVNL.
|
pure virtual |
Initialization of the a vector. First any existing data for vector B must be destroyed, then new vector is created in the memory. All elements in B must be set to zero.
Implemented in itk::fem::LinearSystemWrapperItpack, itk::fem::LinearSystemWrapperVNL, and itk::fem::LinearSystemWrapperDenseVNL.
|
pure virtual |
Check to see if matrix is initialized
matrixIndex | index of matrix to examine |
Implemented in itk::fem::LinearSystemWrapperItpack, itk::fem::LinearSystemWrapperVNL, and itk::fem::LinearSystemWrapperDenseVNL.
|
pure virtual |
Check to see if solution vector is initialized
solutionIndex | index of solution vector to examine |
Implemented in itk::fem::LinearSystemWrapperItpack, itk::fem::LinearSystemWrapperVNL, and itk::fem::LinearSystemWrapperDenseVNL.
|
pure virtual |
Check to see if vector is initialized
vectorIndex | vector of index to examine |
Implemented in itk::fem::LinearSystemWrapperItpack, itk::fem::LinearSystemWrapperVNL, and itk::fem::LinearSystemWrapperDenseVNL.
|
pure virtual |
Perform a matrix*matrix operation and store the result in the linear system
leftMatrixIndex | index of left matrix |
rightMatrixIndex | index of right matrix |
resultMatrixIndex | index of matrix where solution is stored |
Implemented in itk::fem::LinearSystemWrapperItpack, itk::fem::LinearSystemWrapperDenseVNL, and itk::fem::LinearSystemWrapperVNL.
|
virtual |
Perform a matrix*solution operation and store the result in the linear system
matrixIndex | index of matrix to multiply |
solutionIndex | index of solution to multiply |
resultVectorIndex | index of vector where result is store |
Reimplemented in itk::fem::LinearSystemWrapperItpack.
|
virtual |
Perform a matrix*vector operation and store the result in the linear system
matrixIndex | index of matrix to multiply |
vectorIndex | index of vector to multiply |
resultVectorIndex | index of vector where result is store |
Reimplemented in itk::fem::LinearSystemWrapperItpack, itk::fem::LinearSystemWrapperDenseVNL, and itk::fem::LinearSystemWrapperVNL.
|
private |
Asignment operator is not allowed.
|
virtual |
Remove all zeros from a matrix
matrixIndex | index of matrix to remove zeros from |
tempMatrixIndex | index of matrix to use for temp storage space |
|
virtual |
Reorder the Degrees of Freedom in order to reduce bandwidth of matrix
matrixIndex | index of matrix to examine |
newNumbering | vector of new degree of freedom ordering |
|
virtual |
Multiplies all elements of a matrix by a scalar
scale | scalar to multiply all matrix values by |
matrixIndex | index of matrix to modify |
Reimplemented in itk::fem::LinearSystemWrapperItpack, itk::fem::LinearSystemWrapperVNL, and itk::fem::LinearSystemWrapperDenseVNL.
void itk::fem::LinearSystemWrapper::ScaleSolution | ( | Float | scale, |
unsigned int | solutionIndex = 0 |
||
) |
Multiplies all elements of a solution by a scalar
scale | scalar to multiply all solution values by |
solutionIndex | index of solution to modify |
void itk::fem::LinearSystemWrapper::ScaleVector | ( | Float | scale, |
unsigned int | vectorIndex = 0 |
||
) |
Multiplies all elements of a vector by a scalar
scale | scalar to multiply all vector values by |
vectorIndex | index of vector to modify |
|
pure virtual |
Virtual function to set a value of a specific element of the A matrix.
i | row of the element |
j | column of the element |
value | new value of the element |
matrixIndex | index of matrix to set value in |
Implemented in itk::fem::LinearSystemWrapperItpack, itk::fem::LinearSystemWrapperVNL, and itk::fem::LinearSystemWrapperDenseVNL.
|
inline |
Set Index of matrices used by the system
nMatrices | Index of matrices used by system |
Definition at line 110 of file itkFEMLinearSystemWrapper.h.
|
inline |
Set Index of solutions used by the system
nSolutions | Index of solutions used by system |
Definition at line 154 of file itkFEMLinearSystemWrapper.h.
|
inline |
Set Index of vectors used by the system
nVectors | Index of vectors used by system |
Definition at line 137 of file itkFEMLinearSystemWrapper.h.
|
pure virtual |
Virtual function to set a value of specific element of the solution vector.
i | element Index in solution vector |
value | new value of the element |
solutionIndex | index of solution vector to set value in |
Implemented in itk::fem::LinearSystemWrapperItpack, itk::fem::LinearSystemWrapperVNL, and itk::fem::LinearSystemWrapperDenseVNL.
|
inline |
Set the order of the system. All matrices will be of size NxN and all vectors will be of size N
N | order of the linear system |
Definition at line 93 of file itkFEMLinearSystemWrapper.h.
|
pure virtual |
Virtual function to set a value of a specific element of the B vector.
i | row of the element |
value | new value of the element |
vectorIndex | index of vector to set value in |
Implemented in itk::fem::LinearSystemWrapperItpack, itk::fem::LinearSystemWrapperVNL, and itk::fem::LinearSystemWrapperDenseVNL.
|
pure virtual |
Solves the linear system and creates the solution vector, which can later be accessed via GetSolutionValue(i,SolutionIndex) member function. Here all the major processing is done with calls to external numeric library.
Implemented in itk::fem::LinearSystemWrapperItpack, itk::fem::LinearSystemWrapperVNL, and itk::fem::LinearSystemWrapperDenseVNL.
|
pure virtual |
Swaps access indices of any 2 matrices in the linear system
matrixIndex1 | index of a matrix to swap |
matrixIndex2 | index of matrix to swap with |
Implemented in itk::fem::LinearSystemWrapperItpack, itk::fem::LinearSystemWrapperDenseVNL, and itk::fem::LinearSystemWrapperVNL.
|
pure virtual |
Swaps access indices of any 2 solution vectors in the linear system
solutionIndex1 | index of a solution vector to swap |
solutionIndex2 | index of solution vector to swap with |
Implemented in itk::fem::LinearSystemWrapperItpack, itk::fem::LinearSystemWrapperDenseVNL, and itk::fem::LinearSystemWrapperVNL.
|
pure virtual |
Swaps access indices of any 2 vectors in the linear system
vectorIndex1 | index of a vector to swap |
vectorIndex2 | index of vector to swap with |
Implemented in itk::fem::LinearSystemWrapperItpack, itk::fem::LinearSystemWrapperDenseVNL, and itk::fem::LinearSystemWrapperVNL.
|
protected |
Number of matrices used by system
Definition at line 454 of file itkFEMLinearSystemWrapper.h.
|
protected |
Number of solutions used by system
Definition at line 464 of file itkFEMLinearSystemWrapper.h.
|
protected |
Number of vectors used by system
Definition at line 459 of file itkFEMLinearSystemWrapper.h.
|
protected |
Order of linear system
Definition at line 449 of file itkFEMLinearSystemWrapper.h.