Flow123d  JS_before_hm-2158-g8a5161593
Public Types | Public Member Functions | Protected Attributes | List of all members
MatrixSimple Class Referenceabstract

#include <la_linsys_new.hh>

Collaboration diagram for MatrixSimple:
Collaboration graph
[legend]

Public Types

enum  SetValuesMode {
  INSERT =INSERT_VALUES, ADD =ADD_VALUES, ALLOCATE, DONE,
  NONE
}
 possible states of the matrix More...
 
typedef * block
 

Public Member Functions

 MatrixSimple (unsigned int loc_row_size, unsigned int col_size)
 Construct a parallel system with given local size. More...
 
void multiply (Vec x, Vec y)
 multiply PETSC vector: y=Ax More...
 
void multiply_add (Vec x, Vec b, Vec y)
 multiply vector and ad onother one: y=Ax+b More...
 
void multiply_mat (...)
 multiply matrix .. has to deal with preallocation of result and reuse of structure More...
 
void axpy (...)
 
void aypx (...)
 
virtual void start_allocation ()=0
 
void start_add_assembly ()
 
void start_insert_assembly ()
 
void finalize (MatAssemblyType assembly_type=MAT_FINAL_ASSEMBLY)
 
virtual void preallocate_matrix ()=0
 
virtual void preallocate_values (int nrow, int *rows, int ncol, int *cols)=0
 
virtual void view_local_matrix ()=0
 
void mat_set_values (int nrow, int *rows, int ncol, int *cols, PetscScalar *vals)
 Set full rectangular submatrix of the system matrix. More...
 
void mat_set_value (int row, int col, PetscScalar val)
 Set one element of the system matrix. More...
 
void set_symmetric (bool flag=true)
 
bool is_symmetric ()
 
void set_positive_definite (bool flag=true)
 
bool is_positive_definite ()
 
void view (std::ostream output_stream, int *row_mapping=NULL, int *col_mapping=NULL)
 Output the matrix in the Matlab format possibly with given renumbering of rows/cols. More...
 
virtual ~LinSys ()
 
access members @{

Access to distribution of rows, thhrou that you can get also matix size and local size. But for convenience we provide also direct functions

Distributionget_row_ds ()
 
Distributionget_col_ds ()
 
unsigned int size ()
 Get global system size. More...
 
const Mat & get_matrix ()
 Get matrix. SHOULD NOT BE USED !!! More...
 

Protected Attributes

Distribution row_ds
 Distribution of continuous blocks of system rows among the processors. More...
 
Distribution col_ds
 Distribution of multiplied vector. More...
 
bool symmetric
 Flag for the symmetric system. More...
 
bool positive_definite
 Flag for positive definite system. More...
 
SetValuesMode status
 Set value status of the linear system. More...
 
Mat matrix
 Petsc matrix of the problem. More...
 

Detailed Description

Classes for block linear systems. Namely it should provide following functionality: 1) interface to various PETSC (or possibly other) matrices, with preallocation through the set_values method 2) For coupling problems creation of the global linear system by connectiong sub systems of individual equations. Working cycle could be:

  1. creation of sub problems up to the global problem (just matrix dimensions and types)
  2. pre assembly - > preallocation
  3. assembly - by the same functions
  4. matrix modifications (schur complements, assembly of one global matrix, preconditioners ...
  5. iterative solution in parallel
  6. for nonlinear/time problems: jump to 3. and reuse the structures

3) Solution through explicit or implicit schur complements 4) Preconditioning for coupled problems . 5) In assembly, the access to the matrices in LinSys hierarchy is through successive call of block(i,j) method, but there also should be a class or another mechanism how to represent a coordinate in the hierarchy. Then one can access a MatriSimple directly by two coordinates and constantly access correct part of rhs vector

Virtual test cases:

Questions:

Definition at line 62 of file la_linsys_new.hh.

Member Typedef Documentation

◆ block

Member Enumeration Documentation

◆ SetValuesMode

possible states of the matrix

Enumerator
INSERT 
ADD 
ALLOCATE 
DONE 
NONE 

Definition at line 65 of file la_linsys_new.hh.

Constructor & Destructor Documentation

◆ MatrixSimple()

MatrixSimple::MatrixSimple ( unsigned int  loc_row_size,
unsigned int  col_size 
)

Construct a parallel system with given local size.

◆ ~LinSys()

virtual MatrixSimple::~LinSys ( )
virtual

Member Function Documentation

◆ axpy()

void MatrixSimple::axpy (   ...)

add and scale sparse matrices ... has to deal with different nonzero structures, in such a case petsc rutines are inceribly slow

◆ aypx()

void MatrixSimple::aypx (   ...)

◆ finalize()

void MatrixSimple::finalize ( MatAssemblyType  assembly_type = MAT_FINAL_ASSEMBLY)

◆ get_col_ds()

Distribution& MatrixSimple::get_col_ds ( )

◆ get_matrix()

const Mat& MatrixSimple::get_matrix ( )
inline

Get matrix. SHOULD NOT BE USED !!!

Definition at line 95 of file la_linsys_new.hh.

◆ get_row_ds()

Distribution& MatrixSimple::get_row_ds ( )

◆ is_positive_definite()

bool MatrixSimple::is_positive_definite ( )
inline

◆ is_symmetric()

bool MatrixSimple::is_symmetric ( )
inline

◆ mat_set_value()

void MatrixSimple::mat_set_value ( int  row,
int  col,
PetscScalar  val 
)
inline

Set one element of the system matrix.

◆ mat_set_values()

void MatrixSimple::mat_set_values ( int  nrow,
int *  rows,
int  ncol,
int *  cols,
PetscScalar *  vals 
)

Set full rectangular submatrix of the system matrix.

◆ multiply()

void MatrixSimple::multiply ( Vec  x,
Vec  y 
)

multiply PETSC vector: y=Ax

◆ multiply_add()

void MatrixSimple::multiply_add ( Vec  x,
Vec  b,
Vec  y 
)

multiply vector and ad onother one: y=Ax+b

◆ multiply_mat()

void MatrixSimple::multiply_mat (   ...)

multiply matrix .. has to deal with preallocation of result and reuse of structure

◆ preallocate_matrix()

virtual void MatrixSimple::preallocate_matrix ( )
pure virtual

◆ preallocate_values()

virtual void MatrixSimple::preallocate_values ( int  nrow,
int *  rows,
int  ncol,
int *  cols 
)
pure virtual

◆ set_positive_definite()

void MatrixSimple::set_positive_definite ( bool  flag = true)
inline

◆ set_symmetric()

void MatrixSimple::set_symmetric ( bool  flag = true)
inline

◆ size()

unsigned int MatrixSimple::size ( )
inline

Get global system size.

◆ start_add_assembly()

void MatrixSimple::start_add_assembly ( )

◆ start_allocation()

virtual void MatrixSimple::start_allocation ( )
pure virtual

◆ start_insert_assembly()

void MatrixSimple::start_insert_assembly ( )

◆ view()

void MatrixSimple::view ( std::ostream  output_stream,
int *  row_mapping = NULL,
int *  col_mapping = NULL 
)

Output the matrix in the Matlab format possibly with given renumbering of rows/cols.

◆ view_local_matrix()

virtual void MatrixSimple::view_local_matrix ( )
pure virtual

Member Data Documentation

◆ col_ds

Distribution MatrixSimple::col_ds
protected

Distribution of multiplied vector.

Definition at line 128 of file la_linsys_new.hh.

◆ matrix

Mat MatrixSimple::matrix
protected

Petsc matrix of the problem.

Definition at line 133 of file la_linsys_new.hh.

◆ positive_definite

bool MatrixSimple::positive_definite
protected

Flag for positive definite system.

Definition at line 130 of file la_linsys_new.hh.

◆ row_ds

Distribution MatrixSimple::row_ds
protected

Distribution of continuous blocks of system rows among the processors.

Definition at line 127 of file la_linsys_new.hh.

◆ status

SetValuesMode MatrixSimple::status
protected

Set value status of the linear system.

Definition at line 131 of file la_linsys_new.hh.

◆ symmetric

bool MatrixSimple::symmetric
protected

Flag for the symmetric system.

Definition at line 129 of file la_linsys_new.hh.


The documentation for this class was generated from the following file: