An open source method of characteristics neutron transport code.
|
Public Member Functions | |
Vector (omp_lock_t *cell_locks, int num_x=1, int num_y=1, int num_z=1, int num_groups=1) | |
Constructor initializes Vector object as a floating point array and sets the vector dimensions. More... | |
virtual | ~Vector () |
Destructor deletes the arrays used to represent the vector. | |
void | incrementValue (int cell, int group, CMFD_PRECISION val) |
Increment a value in the vector. More... | |
void | incrementValues (int cell, int group_start, int group_end, CMFD_PRECISION *vals) |
Increment values in the vector. More... | |
void | clear () |
Clear all values in the vector. | |
void | scaleByValue (CMFD_PRECISION val) |
Scales the vector by a given value. More... | |
void | printString () |
Print the vector object to the log file. | |
void | copyTo (Vector *vector) |
Copy the values from the current vector to an input vector. More... | |
CMFD_PRECISION | getValue (int cell, int group) |
Get a value at location described by a given cell and group index. More... | |
CMFD_PRECISION * | getArray () |
Get the array describing the vector. 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 vector. More... | |
double | getSum () |
Get the sum of all the values in the vector. More... | |
omp_lock_t * | getCellLocks () |
Return the array of cell locks for atomic cell operations. More... | |
void | setValue (int cell, int group, CMFD_PRECISION val) |
Set a value in the vector. More... | |
void | setValues (int cell, int group_start, int group_end, CMFD_PRECISION *vals) |
Set values in the vector. More... | |
void | setAll (CMFD_PRECISION val) |
Fill vector with a value. More... | |
Vector::Vector | ( | omp_lock_t * | cell_locks, |
int | num_x = 1 , |
||
int | num_y = 1 , |
||
int | num_z = 1 , |
||
int | num_groups = 1 |
||
) |
Constructor initializes Vector object as a floating point array and sets the vector dimensions.
The vector is ordered by cell (as opposed to by group) on the outside to be consistent with the Matrix object. Locks are used to make the vector object thread-safe against concurrent writes the same value. One lock locks out multiple rows of the vector at a time representing multiple groups in the same cell.
cell_locks | OpenMP 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. |
void Vector::copyTo | ( | Vector * | vector | ) |
Copy the values from the current vector to an input vector.
vector | The vector to copy values to. |
CMFD_PRECISION * Vector::getArray | ( | ) |
Get the array describing the vector.
omp_lock_t * Vector::getCellLocks | ( | ) |
Return the array of cell locks for atomic cell operations.
int Vector::getNumGroups | ( | ) |
Get the number of groups in each cell.
int Vector::getNumRows | ( | ) |
Get the number of rows in the vector.
int Vector::getNumX | ( | ) |
Get the number of cells in the x dimension.
int Vector::getNumY | ( | ) |
Get the number of cells in the y dimension.
int Vector::getNumZ | ( | ) |
Get the number of cells in the z dimension.
double Vector::getSum | ( | ) |
Get the sum of all the values in the vector.
CMFD_PRECISION Vector::getValue | ( | int | cell, |
int | group | ||
) |
Get a value at location described by a given cell and group index.
cell | The cell location index. |
group | The group location index. |
void Vector::incrementValue | ( | int | cell, |
int | group, | ||
CMFD_PRECISION | val | ||
) |
Increment a value in the vector.
This method takes a cell and group and floating point value. The cell and group are used to compute the row in the vector. If a value exists for the row, the value is incremented by val; otherwise, it is set to val.
cell | The cell location. |
group | The group location. |
val | The value used to increment the row location. |
void Vector::incrementValues | ( | int | cell, |
int | group_first, | ||
int | group_last, | ||
CMFD_PRECISION * | vals | ||
) |
Increment values in the vector.
This method takes a cell, first group, last group, and floating point value. The cell and groups are used to compute the rows in the vector. If values exist for the rows, the values are incremented by vals; otherwise, they are set.
cell | The cell location. |
group_first | The first group location to increment. |
group_last | The last group location to increment. |
vals | The values used to increment the row locations. NOTE: vals at group_first must be aligned with cache boundaries. |
void Vector::scaleByValue | ( | CMFD_PRECISION | val | ) |
Scales the vector by a given value.
val | The value to scale the vector by. |
void Vector::setAll | ( | CMFD_PRECISION | val | ) |
Fill vector with a value.
val | value to use to fill |
void Vector::setValue | ( | int | cell, |
int | group, | ||
CMFD_PRECISION | val | ||
) |
Set a value in the vector.
This method takes a cell and group and floating point value. The cell and group are used to compute the row and column in the vector. The location of the corresponding row is set to val.
cell | The cell location. |
group | The group location. |
val | The value used to set the row location. |
void Vector::setValues | ( | int | cell, |
int | group_first, | ||
int | group_last, | ||
CMFD_PRECISION * | vals | ||
) |
Set values in the vector.
This method takes a cell, first group, last group, and floating point value. The cell and groups are used to compute the rows in the vector. If a value exist for the rows, the values are overwritten.
cell | The cell location. |
group_first | The first group location to set. |
group_last | The last group location to set. |
vals | The values used to set the row locations. |