#include <PetscMatTools.hpp>
Static Public Member Functions | |
static void | SetElement (Mat matrix, PetscInt row, PetscInt col, double value) |
static void | AddToElement (Mat matrix, PetscInt row, PetscInt col, double value) |
static void | AssembleFinal (Mat matrix) |
static void | AssembleIntermediate (Mat matrix) |
static void | Display (Mat matrix) |
static void | SetRow (Mat matrix, PetscInt row, double value) |
static void | ZeroRowsWithValueOnDiagonal (Mat matrix, std::vector< unsigned > &rRows, double diagonalValue) |
static void | ZeroRowsAndColumnsWithValueOnDiagonal (Mat matrix, std::vector< unsigned > &rRowColIndices, double diagonalValue) |
static void | ZeroColumn (Mat matrix, PetscInt col) |
static void | Zero (Mat matrix) |
static unsigned | GetSize (Mat matrix) |
static void | GetOwnershipRange (Mat matrix, PetscInt &lo, PetscInt &hi) |
static double | GetElement (Mat matrix, PetscInt row, PetscInt col) |
static void | SetOption (Mat matrix, MatOption option) |
template<size_t MATRIX_SIZE> | |
static void | AddMultipleValues (Mat matrix, unsigned *matrixRowAndColIndices, c_matrix< double, MATRIX_SIZE, MATRIX_SIZE > &rSmallMatrix) |
Definition at line 42 of file PetscMatTools.hpp.
void PetscMatTools::SetElement | ( | Mat | matrix, | |
PetscInt | row, | |||
PetscInt | col, | |||
double | value | |||
) | [static] |
Change one of the entries of a matrix to the specified value.
matrix | the matrix | |
row | the row index | |
col | the column index | |
value | the value for this entry |
Definition at line 37 of file PetscMatTools.cpp.
References GetOwnershipRange().
Referenced by AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::ComputeJacobianNumerically(), AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::FinaliseForBath(), LinearSystem::SetMatrixElement(), and SetRow().
void PetscMatTools::AddToElement | ( | Mat | matrix, | |
PetscInt | row, | |||
PetscInt | col, | |||
double | value | |||
) | [static] |
Add the specified value to an entry of a matrix.
matrix | the matrix | |
row | the row index | |
col | the column index | |
value | the value for this entry |
Definition at line 48 of file PetscMatTools.cpp.
References GetOwnershipRange().
Referenced by LinearSystem::AddToMatrixElement().
void PetscMatTools::AssembleFinal | ( | Mat | matrix | ) | [static] |
Sets up the matrix ready for use, e.g. in solving a linear system.
matrix | the matrix |
Definition at line 59 of file PetscMatTools.cpp.
Referenced by BoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::ApplyDirichletToNonlinearJacobian(), LinearSystem::AssembleFinalLhsMatrix(), LinearSystem::AssembleFinalPrecondMatrix(), AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::ComputeJacobian(), AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::ComputeJacobianNumerically(), OperatorSplittingMonodomainSolver< ELEMENT_DIM, SPACE_DIM >::SetupLinearSystem(), MatrixBasedMonodomainSolver< ELEMENT_DIM, SPACE_DIM >::SetupLinearSystem(), MatrixBasedBidomainSolver< ELEMENT_DIM, SPACE_DIM >::SetupLinearSystem(), ZeroColumn(), ZeroRowsAndColumnsWithValueOnDiagonal(), and ZeroRowsWithValueOnDiagonal().
void PetscMatTools::AssembleIntermediate | ( | Mat | matrix | ) | [static] |
This must be called if switching between inserting or adding values to the matrix, to ensure all processes are in sync.
matrix | the matrix |
Definition at line 65 of file PetscMatTools.cpp.
Referenced by LinearSystem::AssembleIntermediateLhsMatrix(), and AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::ComputeJacobian().
void PetscMatTools::Display | ( | Mat | matrix | ) | [static] |
Display a matrix.
matrix | the matrix |
Definition at line 71 of file PetscMatTools.cpp.
Referenced by LinearSystem::DisplayMatrix().
void PetscMatTools::SetRow | ( | Mat | matrix, | |
PetscInt | row, | |||
double | value | |||
) | [static] |
Set all entries in a given row of a matrix to a certain value. This must be called by the process who owns the row, (but other processors will treat it as a null-op
matrix | the matrix | |
row | the row index | |
value | the value to set each entry in this row |
Definition at line 76 of file PetscMatTools.cpp.
References GetOwnershipRange(), and SetElement().
Referenced by LinearSystem::SetMatrixRow().
void PetscMatTools::ZeroRowsWithValueOnDiagonal | ( | Mat | matrix, | |
std::vector< unsigned > & | rRows, | |||
double | diagonalValue | |||
) | [static] |
Zero several rows of a matrix, putting a given value in the diagonal entries.
*Massively* less expensive than zeroing each matrix row individually
matrix | the matrix | |
rRows | std::vector of rows to be zeroed | |
diagonalValue | value to put in the diagonal entries (of the zeroed rows) |
Definition at line 92 of file PetscMatTools.cpp.
References AssembleFinal().
Referenced by BoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::ApplyDirichletToNonlinearJacobian(), LinearSystem::ZeroMatrixRowsWithValueOnDiagonal(), and ZeroRowsAndColumnsWithValueOnDiagonal().
void PetscMatTools::ZeroRowsAndColumnsWithValueOnDiagonal | ( | Mat | matrix, | |
std::vector< unsigned > & | rRowColIndices, | |||
double | diagonalValue | |||
) | [static] |
Zero several rows and columns of a matrix, putting a given value on the diagonal.
matrix | the matrix | |
rRowColIndices | A list of indices. All the rows with these indices, and all the columns with these indices, will be zeroed. | |
diagonalValue | value to put in the diagonal entries (of the zeroed rows) |
Definition at line 169 of file PetscMatTools.cpp.
References AssembleFinal(), GetElement(), GetOwnershipRange(), and ZeroRowsWithValueOnDiagonal().
Referenced by LinearSystem::ZeroMatrixRowsAndColumnsWithValueOnDiagonal().
void PetscMatTools::ZeroColumn | ( | Mat | matrix, | |
PetscInt | col | |||
) | [static] |
Zero a column of a matrix.
Unfortunately there is no equivalent method in Petsc, so this has to be done carefully to ensure that the sparsity structure of the matrix is not broken. Only owned entries which are non-zero are zeroed.
matrix | the matrix | |
col | the column index |
Definition at line 223 of file PetscMatTools.cpp.
References AssembleFinal(), GetElement(), and GetOwnershipRange().
Referenced by LinearSystem::ZeroMatrixColumn().
void PetscMatTools::Zero | ( | Mat | matrix | ) | [static] |
Zero all entries of a matrix.
matrix | the matrix |
Definition at line 260 of file PetscMatTools.cpp.
Referenced by AbstractFeObjectAssembler< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX, INTERPOLATION_LEVEL >::DoAssemble(), and LinearSystem::ZeroLhsMatrix().
unsigned PetscMatTools::GetSize | ( | Mat | matrix | ) | [static] |
Get the size of a matrix
matrix | the matrix |
Definition at line 265 of file PetscMatTools.cpp.
void PetscMatTools::GetOwnershipRange | ( | Mat | matrix, | |
PetscInt & | lo, | |||
PetscInt & | hi | |||
) | [static] |
Get this process's ownership range of the contents of the system.
matrix | the matrix | |
lo | lowest index owned by this process | |
hi | highest index owned by this process |
Definition at line 274 of file PetscMatTools.cpp.
Referenced by AddMultipleValues(), AddToElement(), GetElement(), SetElement(), SetRow(), ZeroColumn(), and ZeroRowsAndColumnsWithValueOnDiagonal().
double PetscMatTools::GetElement | ( | Mat | matrix, | |
PetscInt | row, | |||
PetscInt | col | |||
) | [static] |
Return an element of a matrix. May only be called for elements you own.
matrix | the matrix | |
row | the row index | |
col | the column index |
Definition at line 279 of file PetscMatTools.cpp.
References GetOwnershipRange().
Referenced by LinearSystem::GetMatrixElement(), ZeroColumn(), and ZeroRowsAndColumnsWithValueOnDiagonal().
void PetscMatTools::SetOption | ( | Mat | matrix, | |
MatOption | option | |||
) | [static] |
Set a PETSc matrix option to be true, using the PETSc method MatSetOption.
matrix | the matrix for which to set the option | |
option | the option to set |
Definition at line 298 of file PetscMatTools.cpp.
Referenced by LinearSystem::SetMatrixIsSymmetric().
static void PetscMatTools::AddMultipleValues | ( | Mat | matrix, | |
unsigned * | matrixRowAndColIndices, | |||
c_matrix< double, MATRIX_SIZE, MATRIX_SIZE > & | rSmallMatrix | |||
) | [inline, static] |
Add multiple values to a matrix.
matrix | the matrix | |
matrixRowAndColIndices | mapping from index of the ublas matrix (see param below) to index of the Petsc matrix of this linear system | |
rSmallMatrix | Ublas matrix containing the values to be added |
Definition at line 182 of file PetscMatTools.hpp.
References GetOwnershipRange().
Referenced by LinearSystem::AddLhsMultipleValues().