Flow123d
Public Member Functions | Static Public Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
LinSys_BDDC Class Reference

#include <linsys_BDDC.hh>

Inheritance diagram for LinSys_BDDC:
Inheritance graph
[legend]
Collaboration diagram for LinSys_BDDC:
Collaboration graph
[legend]

Public Member Functions

 LinSys_BDDC (const unsigned numDofsSub, const Distribution *rows_ds, const int matrixTypeInt=0, const int numSubLoc=1, const bool swap_sign=false)
 
void load_mesh (const int nDim, const int numNodes, const int numDofs, const std::vector< int > &inet, const std::vector< int > &nnet, const std::vector< int > &nndf, const std::vector< int > &isegn, const std::vector< int > &isngn, const std::vector< int > &isvgvn, const std::vector< double > &xyz, const std::vector< double > &element_permeability, const int meshDim)
 
void mat_set_values (int nrow, int *rows, int ncol, int *cols, double *vals)
 
void rhs_set_values (int nrow, int *rows, double *vals)
 
void diagonal_weights_set_value (int global_index, double value)
 
PetscErrorCode mat_zero_entries () override
 
PetscErrorCode rhs_zero_entries () override
 
void finish_assembly ()
 
void apply_constrains (double scalar=1.)
 
int solve ()
 
void get_whole_solution (std::vector< double > &globalSolution)
 
void set_whole_solution (std::vector< double > &globalSolution)
 
void set_from_input (const Input::Record in_rec)
 
double get_solution_precision ()
 
 ~LinSys_BDDC ()
 
- Public Member Functions inherited from LinSys
 LinSys (const Distribution *rows_ds)
 
 LinSys (LinSys &other)
 
unsigned int size ()
 
unsigned int vec_lsize ()
 
virtual const Mat & get_matrix ()
 
virtual const Vec & get_rhs ()
 
void set_matrix_changed ()
 
void set_rhs_changed ()
 
bool is_matrix_changed ()
 
bool is_rhs_changed ()
 
virtual PetscErrorCode set_matrix (Mat &matrix, MatStructure str)
 
virtual PetscErrorCode set_rhs (Vec &rhs)
 
const Vec & get_solution ()
 
void set_solution (double *sol_array)
 
double * get_solution_array ()
 
virtual void start_allocation ()
 
virtual void start_add_assembly ()
 
virtual void start_insert_assembly ()
 
void mat_set_value (int row, int col, double val)
 
void rhs_set_value (int row, double val)
 
void set_values (int nrow, int *rows, int ncol, int *cols, PetscScalar *mat_vals, PetscScalar *rhs_vals)
 Set values in the system matrix and values in the right-hand side vector on corresponding rows. More...
 
void set_values (std::vector< int > &row_dofs, std::vector< int > &col_dofs, const arma::mat &matrix, const arma::vec &rhs, const arma::vec &row_solution, const arma::vec &col_solution)
 
void add_constraint (int row, double value)
 
double get_residual_norm ()
 
double get_relative_accuracy ()
 
virtual double get_absolute_accuracy ()
 
void set_symmetric (bool flag=true)
 
bool is_symmetric ()
 
void set_positive_definite (bool flag=true)
 
void set_negative_definite (bool flag=true)
 
bool is_positive_definite ()
 
bool is_negative_definite ()
 
bool is_new ()
 
bool is_preallocated ()
 
void set_spd_via_symmetric_general (bool flag=true)
 
bool is_spd_via_symmetric_general ()
 
virtual void view ()
 
virtual ~LinSys ()
 
 LinSys (unsigned int lsize, double *sol_array=NULL)
 
unsigned int size ()
 
unsigned int vec_lsize ()
 
const Distributionds ()
 
const Mat & get_matrix ()
 
const Vec & get_rhs ()
 
const Vec & get_solution ()
 
double * get_solution_array ()
 
virtual void start_allocation ()=0
 
void start_add_assembly ()
 
void start_insert_assembly ()
 
void partial_assembly ()
 
void finish_assembly ()
 
virtual void mat_set_values (int nrow, int *rows, int ncol, int *cols, PetscScalar *vals)=0
 
void mat_set_value (int row, int col, PetscScalar val)
 
void rhs_set_values (int nrow, int *rows, PetscScalar *vals)
 
void rhs_set_value (int row, PetscScalar val)
 
void set_values (int nrow, int *rows, int ncol, int *cols, PetscScalar *mat_vals, PetscScalar *rhs_vals, std::vector< bool > &constrains_row_mask=std::vector(0), double *constrain_values=NULL)
 
void add_constrain (int row, double value)
 
void apply_constrains (std::vector< Constrain > &constraints)
 
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 *output_mapping=NULL)
 
virtual ~LinSys ()
 

Static Public Attributes

static Input::Type::Record input_type
 
- Static Public Attributes inherited from LinSys
static Input::Type::AbstractRecord input_type
 

Private Types

typedef la::BddcmlWrapper Bddcml_
 

Private Member Functions

void gatherSolution_ ()
 

Private Attributes

int max_nondecr_it_
 parameters expected from input file: More...
 
int number_of_levels_
 number of levels in the multilevel method More...
 
bool use_adaptive_bddc_
 should adaptive BDDC be used? More...
 
int bddcml_verbosity_level_
 
const bool swap_sign_
 swap sign of matrix and rhs entries, e.g. to make the matrix SPD More...
 
std::vector< int > isngn_
 indices of subdomain nodes in global numbering More...
 
std::vector< double > locSolution_
 subdomain solution More...
 
Vec locSolVec_
 local solution PETSc vector - sequential More...
 
VecScatter VSpetscToSubScatter_
 scatter from solution_ to locSolVec_ More...
 
Bddcml_bddcml_
 BDDCML wrapper. More...
 

Additional Inherited Members

- Public Types inherited from LinSys
enum  SetValuesMode {
  INSERT =INSERT_VALUES, ADD =ADD_VALUES, ALLOCATE, DONE,
  NONE, INSERT =INSERT_VALUES, ADD =ADD_VALUES, ALLOCATE,
  DONE, NONE
}
 
enum  SetValuesMode {
  INSERT =INSERT_VALUES, ADD =ADD_VALUES, ALLOCATE, DONE,
  NONE, INSERT =INSERT_VALUES, ADD =ADD_VALUES, ALLOCATE,
  DONE, NONE
}
 
enum  LinSysType { PETSC_MPIAIJ_preallocate_by_assembly, PETSC_MPIAIJ_assembly_by_triples, BDDC, PETSC_schur_complement }
 
- Public Attributes inherited from LinSys
LinSysType type
 Particular type of the linear system. More...
 
- Protected Types inherited from LinSys
typedef std::pair< unsigned,
double > 
Constraint_
 
typedef std::vector< Constraint_ConstraintVec_
 
- Protected Member Functions inherited from LinSys
virtual void preallocate_matrix ()=0
 
virtual void preallocate_values (int nrow, int *rows, int ncol, int *cols)=0
 
- Protected Attributes inherited from LinSys
double r_tol_
 
double a_tol_
 
int max_it_
 
MPI_Comm comm_
 
SetValuesMode status_
 Set value status of the linear system. More...
 
const unsigned lsize_
 local number of matrix rows (non-overlapping division of rows) More...
 
unsigned size_
 global number of matrix rows, i.e. problem size More...
 
const Distributionrows_ds_
 final distribution of rows of MH matrix More...
 
bool symmetric_
 
bool positive_definite_
 
bool negative_definite_
 
bool spd_via_symmetric_general_
 
bool matrix_changed_
 true if the matrix was changed since the last solve More...
 
bool rhs_changed_
 true if the right hand side was changed since the last solve More...
 
Vec solution_
 PETSc vector constructed with vb array. More...
 
double * v_solution_
 local solution array pointing into Vec solution_ More...
 
bool own_solution_
 Indicates if the solution array has been allocated by this class. More...
 
double residual_norm_
 local solution array pointing into Vec solution_ More...
 
ConstraintVec_ constraints_
 
std::vector< double > globalSolution_
 global solution in numbering for linear system More...
 
Input::Record in_rec_
 
Distribution vec_ds
 Distribution of continuous blocks of system rows among the processors. More...
 
bool symmetric
 Flag for the symmetric system. More...
 
bool positive_definite
 Flag for positive definite system. More...
 
bool own_solution
 Indicates if the solution array has been allocated by this class. More...
 
SetValuesMode status
 Set value status of the linear system. More...
 
Mat matrix
 Petsc matrix of the problem. More...
 
Vec rhs
 PETSc vector constructed with vx array. More...
 
Vec solution
 PETSc vector constructed with vb array. More...
 
double * v_rhs
 RHS vector. More...
 
double * v_solution
 Vector of solution. More...
 
int * subdomain_indices
 Remember indices which created mapping. More...
 
Mat local_matrix
 local matrix of subdomain (used in LinSys_MATIS) More...
 

Detailed Description

Definition at line 50 of file linsys_BDDC.hh.

Member Typedef Documentation

Definition at line 121 of file linsys_BDDC.hh.

Constructor & Destructor Documentation

LinSys_BDDC::LinSys_BDDC ( const unsigned  numDofsSub,
const Distribution rows_ds,
const int  matrixTypeInt = 0,
const int  numSubLoc = 1,
const bool  swap_sign = false 
)

Definition at line 61 of file linsys_BDDC.cc.

LinSys_BDDC::~LinSys_BDDC ( )

Definition at line 318 of file linsys_BDDC.cc.

Member Function Documentation

void LinSys_BDDC::apply_constrains ( double  scalar = 1.)
virtual

Apply constrains to assembled matrix. Constrains are given by pairs: global row index, value. i.e. typedef pair<unsigned int, double> Constrain;

What is th meaning of ( const double factor ) form Cambridge code?

Implements LinSys.

Definition at line 246 of file linsys_BDDC.cc.

void LinSys_BDDC::diagonal_weights_set_value ( int  global_index,
double  value 
)

Definition at line 218 of file linsys_BDDC.cc.

void LinSys_BDDC::finish_assembly ( )
virtual

Finish assembly of the whole system. For PETSC this should call MatEndAssembly with MAT_FINAL_ASSEMBLY

Implements LinSys.

Definition at line 239 of file linsys_BDDC.cc.

void LinSys_BDDC::gatherSolution_ ( )
private

Definition at line 334 of file linsys_BDDC.cc.

Here is the caller graph for this function:

double LinSys_BDDC::get_solution_precision ( )
virtual

Get precision of solving

Implements LinSys.

Definition at line 386 of file linsys_BDDC.cc.

void LinSys_BDDC::get_whole_solution ( std::vector< double > &  globalSolution)
virtual

Returns whole solution vector.

Reimplemented from LinSys.

Definition at line 288 of file linsys_BDDC.cc.

void LinSys_BDDC::load_mesh ( const int  nDim,
const int  numNodes,
const int  numDofs,
const std::vector< int > &  inet,
const std::vector< int > &  nnet,
const std::vector< int > &  nndf,
const std::vector< int > &  isegn,
const std::vector< int > &  isngn,
const std::vector< int > &  isvgvn,
const std::vector< double > &  xyz,
const std::vector< double > &  element_permeability,
const int  meshDim 
)

Definition at line 113 of file linsys_BDDC.cc.

void LinSys_BDDC::mat_set_values ( int  nrow,
int *  rows,
int  ncol,
int *  cols,
double *  vals 
)
virtual

Assembly full rectangular submatrix into the system matrix. Should be virtual, implemented differently in particular solvers.

Implements LinSys.

Definition at line 172 of file linsys_BDDC.cc.

PetscErrorCode LinSys_BDDC::mat_zero_entries ( )
overridevirtual

Clears entries of the matrix

Reimplemented from LinSys.

Definition at line 225 of file linsys_BDDC.cc.

void LinSys_BDDC::rhs_set_values ( int  nrow,
int *  rows,
double *  vals 
)
virtual

Set values of the system right-hand side. Should be virtual, implemented differently in particular solvers.

Implements LinSys.

Definition at line 197 of file linsys_BDDC.cc.

PetscErrorCode LinSys_BDDC::rhs_zero_entries ( )
overridevirtual

Clears entries of the right-hand side

Reimplemented from LinSys.

Definition at line 232 of file linsys_BDDC.cc.

void LinSys_BDDC::set_from_input ( const Input::Record  in_rec)
virtual

Sets basic parameters of LinSys defined by user in input file and used to calculate

Reimplemented from LinSys.

Definition at line 305 of file linsys_BDDC.cc.

Here is the caller graph for this function:

void LinSys_BDDC::set_whole_solution ( std::vector< double > &  globalSolution)
virtual

Inserts solution vector.

Reimplemented from LinSys.

Definition at line 297 of file linsys_BDDC.cc.

int LinSys_BDDC::solve ( )
virtual

Solve the system and return convergence reason.

Implements LinSys.

Definition at line 253 of file linsys_BDDC.cc.

Member Data Documentation

Bddcml_* LinSys_BDDC::bddcml_
private

BDDCML wrapper.

Definition at line 122 of file linsys_BDDC.hh.

int LinSys_BDDC::bddcml_verbosity_level_
private

level of verbosity of BDDCML library ( 0 - only fatal errors reported, 1 - mild output, 2 - detailed output )//!< should adaptive BDDC be used?

Definition at line 109 of file linsys_BDDC.hh.

it::Record LinSys_BDDC::input_type
static
Initial value:
= it::Record("Bddc", "Solver setting.")
.declare_key("max_nondecr_it", it::Integer(0), it::Default("30"),
"Maximum number of iterations of the linear solver with non-decreasing residual.")
.declare_key("number_of_levels", it::Integer(0), it::Default("2"),
"Number of levels in the multilevel method (=2 for the standard BDDC).")
.declare_key("use_adaptive_bddc", it::Bool(), it::Default("false"),
"Use adaptive selection of constraints in BDDCML.")
.declare_key("bddcml_verbosity_level", it::Integer(0,2), it::Default("0"),
"Level of verbosity of the BDDCML library: 0 - no output, 1 - mild output, 2 - detailed output.")

Definition at line 54 of file linsys_BDDC.hh.

std::vector<int> LinSys_BDDC::isngn_
private

indices of subdomain nodes in global numbering

Definition at line 116 of file linsys_BDDC.hh.

std::vector<double> LinSys_BDDC::locSolution_
private

subdomain solution

Definition at line 117 of file linsys_BDDC.hh.

Vec LinSys_BDDC::locSolVec_
private

local solution PETSc vector - sequential

Definition at line 118 of file linsys_BDDC.hh.

int LinSys_BDDC::max_nondecr_it_
private

parameters expected from input file:

maximum number of iterations of linear solver with non-decreasing residual

Definition at line 106 of file linsys_BDDC.hh.

int LinSys_BDDC::number_of_levels_
private

number of levels in the multilevel method

Definition at line 107 of file linsys_BDDC.hh.

const bool LinSys_BDDC::swap_sign_
private

swap sign of matrix and rhs entries, e.g. to make the matrix SPD

Definition at line 114 of file linsys_BDDC.hh.

bool LinSys_BDDC::use_adaptive_bddc_
private

should adaptive BDDC be used?

Definition at line 108 of file linsys_BDDC.hh.

VecScatter LinSys_BDDC::VSpetscToSubScatter_
private

scatter from solution_ to locSolVec_

Definition at line 119 of file linsys_BDDC.hh.


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