|
Flow123d
intersections_paper-476-gbe68821
|
#include <local_system.hh>
Public Types | |
| typedef arma::uvec | DofVec |
Public Member Functions | |
| LocalSystem () | |
| Default constructor. More... | |
| LocalSystem (unsigned int nrows, unsigned int ncols) | |
| Constructor. More... | |
| void | reset () |
| Resets the matrix, RHS, dofs to zero and clears solution settings. More... | |
| void | reset (unsigned int nrows, unsigned int ncols) |
| Resize and reset. More... | |
| void | reset (const DofVec &row_dofs, const DofVec &col_dofs) |
| const arma::mat & | get_matrix () |
| const arma::vec & | get_rhs () |
| void | set_solution (unsigned int loc_dof, double solution, double diag=0.0) |
| Set the position and value of known solution. E.g. Dirichlet boundary condition. More... | |
| void | set_solution_row (uint loc_row, double solution, double diag=0.0) |
| void | set_solution_col (uint loc_col, double solution) |
| void | eliminate_solution () |
| void | add_value (unsigned int row, unsigned int col, double mat_val, double rhs_val) |
| Adds a single entry into the local system. More... | |
| void | add_value (unsigned int row, unsigned int col, double mat_val) |
| Matrix entry. Adds a single entry into the local system matrix. More... | |
| void | add_value (unsigned int row, double rhs_val) |
| RHS entry. Adds a single entry into the local system RHS. More... | |
| void | set_matrix (arma::mat matrix) |
| void | set_rhs (arma::vec rhs) |
Public Attributes | |
| DofVec | row_dofs |
| DofVec | col_dofs |
Protected Member Functions | |
| void | set_size (unsigned int nrows, unsigned int ncols) |
Protected Attributes | |
| arma::mat | matrix |
| local system matrix More... | |
| arma::vec | rhs |
| local system RHS More... | |
| unsigned int | n_elim_rows |
| unsigned int | n_elim_cols |
| DofVec | elim_rows |
| DofVec | elim_cols |
| arma::vec | solution_rows |
| arma::vec | solution_cols |
| arma::vec | diag_rows |
Friends | |
| class | LinSys |
| vector of global row indices where the solution is set (dirichlet BC) More... | |
Local system class is meant to be used for local assembly and then pass to global linear system. The key idea is to take care of known solution values (Dirichlet boundary conditions) in a common way.
Usage of the class consists of 3 steps: 1) create local system, set global DoFs. 2) set all known values (Dirichlet BC) 3) set matrix and RHS entries (if the entry is on dirichlet row or column, it is now taken care of) 4) eliminate known solution and possibly fix the diagonal entries of the local system, where Dirichlet BC is set
TODO:
Definition at line 26 of file local_system.hh.
| typedef arma::uvec LocalSystem::DofVec |
Definition at line 29 of file local_system.hh.
| LocalSystem::LocalSystem | ( | ) |
Default constructor.
Object must be initialized by subsequent call of reset(nrows, ncols).
Definition at line 8 of file local_system.cc.
| LocalSystem::LocalSystem | ( | unsigned int | nrows, |
| unsigned int | ncols | ||
| ) |
Constructor.
nrows is number of rows of local system ncols is number of columns of local system
Definition at line 12 of file local_system.cc.
| void LocalSystem::add_value | ( | unsigned int | row, |
| unsigned int | col, | ||
| double | mat_val, | ||
| double | rhs_val | ||
| ) |
Adds a single entry into the local system.
row is local row index of local system col is local column index of local system mat_val is matrix entry value rhs_val is RHS entry value
Definition at line 165 of file local_system.cc.

| void LocalSystem::add_value | ( | unsigned int | row, |
| unsigned int | col, | ||
| double | mat_val | ||
| ) |
Matrix entry. Adds a single entry into the local system matrix.
row is local row index of local system col is local column index of local system mat_val is matrix entry value
Definition at line 174 of file local_system.cc.
| void LocalSystem::add_value | ( | unsigned int | row, |
| double | rhs_val | ||
| ) |
RHS entry. Adds a single entry into the local system RHS.
row is local row index of local system rhs_val is RHS entry value
Definition at line 182 of file local_system.cc.
| void LocalSystem::eliminate_solution | ( | ) |
When finished with assembly of the local system, this function eliminates all the known dofs.
It is skipped if there is not any solution dof set.
During elimination, the (global) diagonal entries on the rows, where the solution is set, might be zero. Therefore it is necessary to set a proper value to the diagonal entry and respective RHS entry, such that the given solution holds. If preferred diagonal value has been set by set_solution then it is used.
Calling this function after the assembly of local system is finished is users's responsibility.
Definition at line 103 of file local_system.cc.

|
inline |
|
inline |
| void LocalSystem::reset | ( | ) |
Resets the matrix, RHS, dofs to zero and clears solution settings.
Definition at line 39 of file local_system.cc.

| void LocalSystem::reset | ( | unsigned int | nrows, |
| unsigned int | ncols | ||
| ) |
Resize and reset.
Definition at line 49 of file local_system.cc.
Resize and reset. Set dofs vectors to reuse arrays provided by given vectors. Given vectors can not be changed until next call to of any reset function.
Definition at line 60 of file local_system.cc.
| void LocalSystem::set_matrix | ( | arma::mat | matrix | ) |
| void LocalSystem::set_rhs | ( | arma::vec | rhs | ) |
|
protected |
| void LocalSystem::set_solution | ( | unsigned int | loc_dof, |
| double | solution, | ||
| double | diag = 0.0 |
||
| ) |
Set the position and value of known solution. E.g. Dirichlet boundary condition.
loc_dofs is local row index in solution vector solution is the values of the solution diag_val is preferred diagonal value on the solution row
Definition at line 70 of file local_system.cc.

| void LocalSystem::set_solution_col | ( | uint | loc_col, |
| double | solution | ||
| ) |
| void LocalSystem::set_solution_row | ( | uint | loc_row, |
| double | solution, | ||
| double | diag = 0.0 |
||
| ) |
|
friend |
vector of global row indices where the solution is set (dirichlet BC)
vector of solution values at global_solution_rows indices (dirichlet BC) diagonal values for dirichlet BC rows (set in set_solution) Optimization. Is false if solution (at least one entry) is known.
Definition at line 159 of file local_system.hh.
| DofVec LocalSystem::col_dofs |
Definition at line 36 of file local_system.hh.
|
protected |
Definition at line 143 of file local_system.hh.
|
protected |
Definition at line 140 of file local_system.hh.
|
protected |
Definition at line 139 of file local_system.hh.
|
protected |
local system matrix
Definition at line 135 of file local_system.hh.
|
protected |
Definition at line 138 of file local_system.hh.
|
protected |
Definition at line 138 of file local_system.hh.
|
protected |
local system RHS
Definition at line 136 of file local_system.hh.
| DofVec LocalSystem::row_dofs |
Global row and col indices. Are public and can be freely set. Nevertheless one can also provide reference to already existing arrays through specific constructor or reset function.
Definition at line 36 of file local_system.hh.
|
protected |
Definition at line 142 of file local_system.hh.
|
protected |
Definition at line 141 of file local_system.hh.
1.8.11