An open source method of characteristics neutron transport code.
|
Public Member Functions | |
Matrix (omp_lock_t *cell_locks, int num_x=1, int num_y=1, int num_z=1, int num_groups=1) | |
Constructor initializes Matrix as a vector of maps and sets the matrix dimensions. More... | |
virtual | ~Matrix () |
Destructor clears list of lists and deletes the arrays used to represent the matrix in CSR form. | |
void | incrementValue (int cell_from, int group_from, int cell_to, int group_to, CMFD_PRECISION val) |
Increment a value in the matrix. More... | |
void | clear () |
Clear all values in the matrix list of lists. | |
void | printString () |
Print the matrix object to the log file. | |
void | transpose () |
Transpose the matrix in place. | |
CMFD_PRECISION | getValue (int cell_from, int group_from, int cell_to, int group_to) |
Get a value in the matrix. More... | |
CMFD_PRECISION * | getA () |
Get the A component of the CSR form of the matrix object. More... | |
int * | getIA () |
Get the IA component of the CSR form of the matrix object. More... | |
int * | getJA () |
Get the JA component of the CSR form of the matrix object. More... | |
CMFD_PRECISION * | getDiag () |
Get the diagonal component of the matrix object. More... | |
int | getNumX () |
Get the number of cells in the x dimension. More... | |
int | getNumY () |
Get the number of cells in the y dimension. More... | |
int | getNumZ () |
Get the number of cells in the z dimension. More... | |
int | getNumGroups () |
Get the number of groups in each cell. More... | |
int | getNumRows () |
Get the number of rows in the matrix. More... | |
int | getNNZ () |
Get the number of non-zero values in the matrix. More... | |
omp_lock_t * | getCellLocks () |
Return the array of cell locks for atomic cell operations. More... | |
void | setValue (int cell_from, int group_from, int cell_to, int group_to, CMFD_PRECISION val) |
Set a value in the matrix. More... | |
Matrix::Matrix | ( | omp_lock_t * | cell_locks, |
int | num_x = 1 , |
||
int | num_y = 1 , |
||
int | num_z = 1 , |
||
int | num_groups = 1 |
||
) |
Constructor initializes Matrix as a vector of maps and sets the matrix dimensions.
The matrix object uses a "lists of lists" structure (implemented as a vector of maps) to allow for easy setting and incrementing of the values in the object. When the matrix is needed to perform linear algebra operations, it is converted to compressed row storage (CSR) form. The matrix is ordered by cell (as opposed to by group) on the outside. Locks are used to make the matrix thread-safe against concurrent writes the same value. One lock locks out multiple rows of the matrix at a time representing multiple groups in the same cell.
cell_locks | Omp locks for atomic cell operations |
num_x | The number of cells in the x direction. |
num_y | The number of cells in the y direction. |
num_z | The number of cells in the z direction. |
num_groups | The number of energy groups in each cell. |
CMFD_PRECISION * Matrix::getA | ( | ) |
Get the A component of the CSR form of the matrix object.
omp_lock_t * Matrix::getCellLocks | ( | ) |
Return the array of cell locks for atomic cell operations.
CMFD_PRECISION * Matrix::getDiag | ( | ) |
Get the diagonal component of the matrix object.
int * Matrix::getIA | ( | ) |
Get the IA component of the CSR form of the matrix object.
int * Matrix::getJA | ( | ) |
Get the JA component of the CSR form of the matrix object.
int Matrix::getNNZ | ( | ) |
Get the number of non-zero values in the matrix.
int Matrix::getNumGroups | ( | ) |
Get the number of groups in each cell.
int Matrix::getNumRows | ( | ) |
Get the number of rows in the matrix.
int Matrix::getNumX | ( | ) |
Get the number of cells in the x dimension.
int Matrix::getNumY | ( | ) |
Get the number of cells in the y dimension.
int Matrix::getNumZ | ( | ) |
Get the number of cells in the z dimension.
CMFD_PRECISION Matrix::getValue | ( | int | cell_from, |
int | group_from, | ||
int | cell_to, | ||
int | group_to | ||
) |
Get a value in the matrix.
This method takes a cell and group of origin (cell/group from) and cell and group of destination (cell/group to). The origin and destination are used to compute the row and column in the matrix. The value at the location specified by the row/column is returned.
cell_from | The origin cell. |
group_from | The origin group. |
cell_to | The destination cell. |
group_to | The destination group. |
void Matrix::incrementValue | ( | int | cell_from, |
int | group_from, | ||
int | cell_to, | ||
int | group_to, | ||
CMFD_PRECISION | val | ||
) |
Increment a value in the matrix.
This method takes a cell and group of origin (cell/group from) and cell and group of destination (cell/group to) and a floating point value. The origin and destination are used to compute the row and column in the matrix. If a value exists for the row/column, the value is incremented by val; otherwise, it is set to val.
cell_from | The origin cell. |
group_from | The origin group. |
cell_to | The destination cell. |
group_to | The destination group. |
val | The value used to increment the row/column location. |
void Matrix::setValue | ( | int | cell_from, |
int | group_from, | ||
int | cell_to, | ||
int | group_to, | ||
CMFD_PRECISION | val | ||
) |
Set a value in the matrix.
This method takes a cell and group of origin (cell/group from) and cell and group of destination (cell/group to) and floating point value. The origin and destination are used to compute the row and column in the matrix. The location specified by the row/column is set to val.
cell_from | The origin cell. |
group_from | The origin group. |
cell_to | The destination cell. |
group_to | The destination group. |
val | The value used to set the row/column location. |