#include <scr.h>
Public Member Functions | |
void | add_entry (double e, long ri, long rci) |
void | addmat_scr (double c, symcomprow &scr) |
void | addresses (void) |
void | allocadr (long m) |
void | cg (double *x, double *y, long ni, double err, long &ani, double &ares, double limit, long iv) |
void | cg_prec (double *x, double *y, long ni, double err, long &ani, double &ares, double zero, long iv, long tprec, double par, ISolver *sdirect) |
void | changedecomp () |
void | copy_scr (symcomprow &scr) |
long | decomp () |
void | fillarray (gtopology *top) |
void | fillarray_elem (long *cn, long ndofe) |
double | give_entry (long ri, long rci) |
long | give_negm () |
void | incomplete_ldl (double gamma) |
void | initiate (gtopology *top, long ndof, long mespr) |
void | localize (matrix &b, long *cn) |
void | localized (double *b, long *cn, long nc) |
long | minimize (double limit) |
void | mxv_scr (double *b, double *c) |
void | nullmat () |
void | numcontr (gtopology *top) |
void | numcontr_elem (long *cn, long ndofe) |
void | prec_diag_scr (double *x, double *y) |
void | prec_ildl_scr (double *x, double *y) |
void | prec_ssor_scr (double *x, double *y, double omega) |
void | printdiag (FILE *out) |
void | printmat (FILE *out) |
double | rows_mult_ldl_scr (long m, long o) |
void | scalmat_scr (double c) |
void | select_submatrix (symcomprow *smscr, long nsdof, long *sdof) |
void | sort_and_colindex (void) |
void | sort_and_colindex_tko (void) |
double * | status () |
symcomprow (void) | |
~symcomprow (void) | |
Public Attributes | |
double * | a |
array containing nonzero entries of the matrix | |
long * | adr |
array containing addresses of the beginnings of rows | |
long * | adra |
auxiliary array containing addresses | |
long * | aux |
auxiliary array containing column indices | |
long * | ci |
array containing column indices | |
long | decompid |
decomposition indicator | |
double * | incdec |
array containing incomplete decomposition | |
double | limit |
threshold for entries rejection | |
long | n |
number of rows of the matrix | |
long | negm |
number of entries in the global matrix |
class symcomprow
serves for matrix storage called symmetric compressed rows compressed rows storage is available for symmetric real matrices only non-zero matrix entries are stored row by row from the first entry in the row to the diagonal one
basic data double array a where matrix entries are stored long array ci where column indices of stored non-zero matrix entries are stored long array adr where the first row entries are stored long number n stands for number of rows (columns) of matrix long number negm stands for number of entries of matrix
basic relations array a has negm components array ci has negm components array adr has n+1 components adr[n] is equal to negm
JK
Definition at line 32 of file scr.h.
symcomprow | ( | void | ) |
~symcomprow | ( | void | ) |
void add_entry | ( | double | e, | |
long | ri, | |||
long | rci | |||
) |
void addmat_scr | ( | double | c, | |
symcomprow & | scr | |||
) |
void addresses | ( | void | ) |
void allocadr | ( | long | m | ) |
void cg | ( | double * | x, | |
double * | y, | |||
long | ni, | |||
double | err, | |||
long & | ani, | |||
double & | ares, | |||
double | zero, | |||
long | iv | |||
) |
function solves system of linear algebraic equations by conjugate gradient method, matrix is stored as compressed rows
x | - vector of unknowns | |
y | - vector of right hand side | |
ni | - maximum number of iterations | |
err | - required error (norm of residual vector) | |
ani | - number of performed iterations | |
ares | - attained error (norm of residual vector) | |
zero | - computer zero | |
iv | - initial values indicator |
iv=0 - initial vector is zero vector iv=1 - initial vector is taken from x array
JK, 17.7.2001
Definition at line 676 of file scr.cpp.
References mxv_scr(), n, p, print_warning(), and ss().
Referenced by gmatrix::solve_system().
void cg_prec | ( | double * | x, | |
double * | y, | |||
long | ni, | |||
double | err, | |||
long & | ani, | |||
double & | ares, | |||
double | zero, | |||
long | iv, | |||
long | tprec, | |||
double | par, | |||
ISolver * | sdirect | |||
) |
function solves system of linear algebraic equations by preconditioned conjugate gradient method
if incomplete decomposition preconditioner is used, matrix must be incompletely decomposed before this function is called
x | - vector of unknowns | |
y | - vector of right hand side | |
ni | - maximum number of iterations | |
err | - required error (norm of residula vector) | |
ani | - number of computed iterations | |
ares | - reached residual norm | |
zero | - computer zero | |
iv | - initial values indicator | |
tprec | - type of preconditioner | |
par | - preconditioning parameter |
iv=0 - initial vector is assumed as zero vector iv=1 - initial vector is taken from x array
tprec=1 - diagonal (Jacobi) preconditioner tprec=10 - incomplete decomposition
par: relaxation parameter - for SSOR preconditioner weight coefficient - for incomplete decomposition
JK, 2.12.2001
Definition at line 983 of file scr.cpp.
References h(), mxv_scr(), n, p, prec_diag_scr(), prec_ildl_scr(), prec_ssor_scr(), print_err(), ISolver::Solve(), sparseindec, and ss().
Referenced by gmatrix::solve_system().
void changedecomp | ( | ) |
function changes indicator of decomposition (factorization)
JK
Definition at line 47 of file scr.cpp.
References decompid.
Referenced by gmatrix::solve_system().
void copy_scr | ( | symcomprow & | scr | ) |
long decomp | ( | ) |
function returns indicator of decomposition (factorization)
JK
Definition at line 37 of file scr.cpp.
References decompid.
Referenced by gmatrix::solve_system().
void fillarray | ( | gtopology * | top | ) |
function fills auxiliary array
top | - pointer to general topology |
param aux - auxiliary array containing column indices
JK, 22.6.2001
Definition at line 179 of file scr.cpp.
References fillarray_elem(), gtopology::give_code_numbers(), gtopology::give_ndofe(), and gtopology::ne.
Referenced by initiate().
void fillarray_elem | ( | long * | cn, | |
long | ndofe | |||
) |
function fills auxiliary array by one element
cn | - array containg code numbers of the element | |
ndofe | - number of DOFs on the element |
param aux - auxiliary array containing column indexes
JK, 22.6.2001
Definition at line 153 of file scr.cpp.
Referenced by fillarray().
double give_entry | ( | long | ri, | |
long | rci | |||
) |
long give_negm | ( | ) |
function returns number of stored matrix entries
JK, 16.8.2007
Definition at line 1186 of file scr.cpp.
References negm.
Referenced by gmatrix::give_negm().
void incomplete_ldl | ( | double | gamma | ) |
function decomposes matrix in symmetric compressed rows storage by incomplete decomposition (factorization)
gamma | - weight coefficient |
JK, 2.12.2001
Definition at line 880 of file scr.cpp.
References a, adr, ci, incdec, n, negm, and rows_mult_ldl_scr().
Referenced by gmatrix::solve_system().
void initiate | ( | gtopology * | top, | |
long | ndof, | |||
long | mespr | |||
) |
function initiates symmetric compressed rows storage
top | - pointer to general topology | |
ndof | - number of rows/columns of the matrix | |
mespr | - indicator of message printing |
JK
Definition at line 516 of file scr.cpp.
References addresses(), allocadr(), fillarray(), negm, nullmat(), numcontr(), sort_and_colindex_tko(), and status().
Referenced by gmatrix::initiate().
void localize | ( | matrix & | b, | |
long * | cn | |||
) |
function localizes local matrix b to the global matrix matrix b is stored as dense matrix
b | - local matrix in row ordering | |
cn | - array containing code numbers of element |
JK, 25.6.2001
Definition at line 386 of file scr.cpp.
References a, adr, ci, ll, and matrix::m.
Referenced by gmatrix::localize().
void localized | ( | double * | b, | |
long * | cn, | |||
long | nc | |||
) |
function localizes local matrix b to the global matrix matrix b is stored as dense matrix
b | - local matrix in row ordering | |
cn | - array containing code numbers of element | |
n | - order of matrix b (number of rows or columns) |
JK, 25.6.2001
Definition at line 434 of file scr.cpp.
References a, adr, ci, and ll.
Referenced by gmatrix::localized().
long minimize | ( | double | limit | ) |
void mxv_scr | ( | double * | b, | |
double * | c | |||
) |
void nullmat | ( | ) |
void numcontr | ( | gtopology * | top | ) |
function evaluates number of contributions to the matrix
top | - pointer to general topology |
JK, 22.6.2001
Definition at line 130 of file scr.cpp.
References gtopology::give_code_numbers(), gtopology::give_ndofe(), gtopology::ne, and numcontr_elem().
Referenced by initiate().
void numcontr_elem | ( | long * | cn, | |
long | ndofe | |||
) |
function evaluates number of contributions to the matrix from one element
cn | - array containing code numbers of the element | |
ndofe | - number of DOFs on the element |
JK, 22.6.2001
Definition at line 106 of file scr.cpp.
References adr.
Referenced by numcontr().
void prec_diag_scr | ( | double * | x, | |
double * | y | |||
) |
function computes preconditioned vector via Jacobi method new vector is computed from equation A.x = y, where A is diagonal matrix and contains diagonal entries of system matrix
x | - vector of unknowns | |
y | - vector of right hand side |
JK, 2.12.2001
Definition at line 787 of file scr.cpp.
Referenced by cg_prec().
void prec_ildl_scr | ( | double * | x, | |
double * | y | |||
) |
function computes preconditioned vector via incomplete decomposition new vector is computed from equation A.x = y matrix A is incompletely decomposed in scr storage
x | - vector of unknowns | |
y | - vector of right hand side |
JK, 2.12.2001
Definition at line 919 of file scr.cpp.
References adr, ci, incdec, n, and p.
Referenced by cg_prec().
void prec_ssor_scr | ( | double * | x, | |
double * | y, | |||
double | omega | |||
) |
function computes preconditioned vector via SSOR method new vector is computed approximately from equation A.x = y computation is done like one step of SSOR method
x | - vector of unknowns | |
y | - vector of right hand side | |
omega | - relaxation parameter |
JK, 2.12.2001
Definition at line 809 of file scr.cpp.
References a, adr, ci, memset(), and n.
Referenced by cg_prec().
void printdiag | ( | FILE * | out | ) |
void printmat | ( | FILE * | out | ) |
double rows_mult_ldl_scr | ( | long | m, | |
long | o | |||
) |
function computes multiplication of two matrix rows in scr storage
m,o | - row numbers, equality m>=o must be satisfied |
JK, 2.12.2001
Definition at line 849 of file scr.cpp.
References adr, ci, incdec, and print_err().
Referenced by incomplete_ldl().
void scalmat_scr | ( | double | c | ) |
void select_submatrix | ( | symcomprow * | smscr, | |
long | nsdof, | |||
long * | sdof | |||
) |
Funkce vybere prvky z matice na zaklade pole sdof, kde jsou umisteny prvky, ktere se maji vybrat Podminka pouziti funkce - pole sdof je serazeno od nejmensiho kodoveho cisla po nejvetsi kodove cislo
JB, 11.10.2007
Definition at line 1201 of file scr.cpp.
References a, adr, ci, n, and negm.
Referenced by seqfeti::subdomain_matrices().
void sort_and_colindex | ( | void | ) |
void sort_and_colindex_tko | ( | void | ) |
double * status | ( | ) |
function returns status of array s
JK
Definition at line 78 of file scr.cpp.
References a.
Referenced by initiate().
double* a |
array containing nonzero entries of the matrix
Definition at line 93 of file scr.h.
Referenced by add_entry(), addmat_scr(), copy_scr(), give_entry(), boundparcongrad::ilu_mat_petsc(), incomplete_ldl(), boundparcongrad::initialize_diag_prec(), gmatrix::initiate(), localize(), localized(), minimize(), mxv_scr(), nullmat(), prec_diag_scr(), prec_ssor_scr(), gmatrix::prepmat2(), printdiag(), printmat(), scalmat_scr(), select_submatrix(), sort_and_colindex(), sort_and_colindex_tko(), status(), seqschur::subdomain_matrices(), seqfeti::subdomain_matrices(), symcomprow(), and ~symcomprow().
long* adr |
array containing addresses of the beginnings of rows
Definition at line 85 of file scr.h.
Referenced by add_entry(), addresses(), allocadr(), copy_scr(), give_entry(), boundparcongrad::ilu_mat_petsc(), incomplete_ldl(), boundparcongrad::initialize_diag_prec(), gmatrix::initiate(), localize(), localized(), minimize(), mxv_scr(), numcontr_elem(), prec_diag_scr(), prec_ildl_scr(), prec_ssor_scr(), gmatrix::prepmat2(), printdiag(), printmat(), rows_mult_ldl_scr(), select_submatrix(), sort_and_colindex(), sort_and_colindex_tko(), seqschur::subdomain_matrices(), seqfeti::subdomain_matrices(), symcomprow(), and ~symcomprow().
long* adra |
auxiliary array containing addresses
Definition at line 87 of file scr.h.
Referenced by addresses(), allocadr(), fillarray_elem(), minimize(), sort_and_colindex(), sort_and_colindex_tko(), symcomprow(), and ~symcomprow().
long* aux |
auxiliary array containing column indices
Definition at line 89 of file scr.h.
Referenced by addresses(), fillarray_elem(), sort_and_colindex(), sort_and_colindex_tko(), symcomprow(), and ~symcomprow().
long* ci |
array containing column indices
Definition at line 91 of file scr.h.
Referenced by add_entry(), copy_scr(), give_entry(), boundparcongrad::ilu_mat_petsc(), incomplete_ldl(), boundparcongrad::initialize_diag_prec(), gmatrix::initiate(), localize(), localized(), minimize(), mxv_scr(), prec_ildl_scr(), prec_ssor_scr(), gmatrix::prepmat2(), printmat(), rows_mult_ldl_scr(), select_submatrix(), sort_and_colindex(), sort_and_colindex_tko(), seqschur::subdomain_matrices(), seqfeti::subdomain_matrices(), symcomprow(), and ~symcomprow().
long decompid |
decomposition indicator
Definition at line 99 of file scr.h.
Referenced by changedecomp(), decomp(), gmatrix::prepmat(), and symcomprow().
double* incdec |
array containing incomplete decomposition
Definition at line 95 of file scr.h.
Referenced by incomplete_ldl(), prec_ildl_scr(), rows_mult_ldl_scr(), symcomprow(), and ~symcomprow().
double limit |
long n |
number of rows of the matrix
Definition at line 81 of file scr.h.
Referenced by addresses(), allocadr(), cg(), cg_prec(), copy_scr(), boundparcongrad::ilu_mat_petsc(), incomplete_ldl(), boundparcongrad::initialize_diag_prec(), minimize(), mxv_scr(), prec_diag_scr(), prec_ildl_scr(), prec_ssor_scr(), printdiag(), printmat(), select_submatrix(), sort_and_colindex(), and sort_and_colindex_tko().
long negm |
number of entries in the global matrix
Definition at line 83 of file scr.h.
Referenced by addmat_scr(), copy_scr(), give_negm(), incomplete_ldl(), initiate(), minimize(), nullmat(), gmatrix::prepmat(), printmat(), scalmat_scr(), select_submatrix(), sort_and_colindex(), and sort_and_colindex_tko().