Flow123d  release_2.2.0-914-gf1a3a4f
Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Attributes | Static 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 Types

typedef LinSys FactoryBaseType
 
- Public Types inherited from LinSys
enum  SetValuesMode {
  INSERT =INSERT_VALUES, ADD =ADD_VALUES, ALLOCATE, DONE,
  NONE
}
 

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 set_tolerances (double r_tol, double a_tol, unsigned int max_it) override
 
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) override
 
void rhs_set_values (int nrow, int *rows, double *vals) override
 
void diagonal_weights_set_value (int global_index, double value)
 
PetscErrorCode mat_zero_entries () override
 
PetscErrorCode rhs_zero_entries () override
 
void finish_assembly () override
 
void apply_constrains (double scalar=1.) override
 
LinSys::SolveInfo solve () override
 
void set_from_input (const Input::Record in_rec) override
 
double get_solution_precision () override
 
double compute_residual () override
 
void print_matrix (std::ostream &out)
 
 ~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_local_system (LocalSystem &local)
 
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 ()
 

Static Public Member Functions

static const Input::Type::Recordget_input_type ()
 
- Static Public Member Functions inherited from LinSys
static Input::Type::Abstractget_input_type ()
 

Private Types

typedef la::BddcmlWrapper Bddcml_
 

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...
 

Static Private Attributes

static const int registrar = LinSys_BDDC::get_input_type().size()
 Registrar of class to factory. More...
 

Additional Inherited Members

- Protected Types inherited from LinSys
typedef std::pair< unsigned, double > Constraint_
 
typedef std::vector< Constraint_ConstraintVec_
 
- Protected Attributes inherited from LinSys
double r_tol_
 relative tolerance of linear solver More...
 
double a_tol_
 absolute tolerance of linear solver More...
 
unsigned int max_it_
 maximum number of iterations of linear solver More...
 
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_
 
- Static Protected Attributes inherited from LinSys
static constexpr double default_r_tol_ = 1e-7
 
static constexpr double default_a_tol_ = 1e-11
 
static constexpr unsigned int default_max_it_ = 1000
 

Detailed Description

Definition at line 41 of file linsys_BDDC.hh.

Member Typedef Documentation

Definition at line 126 of file linsys_BDDC.hh.

Definition at line 45 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 311 of file linsys_BDDC.cc.

Member Function Documentation

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

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 252 of file linsys_BDDC.cc.

double LinSys_BDDC::compute_residual ( )
inlineoverridevirtual

Explicitly compute residual and its norm for current solution.

Implements LinSys.

Definition at line 88 of file linsys_BDDC.hh.

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

Definition at line 222 of file linsys_BDDC.cc.

void LinSys_BDDC::finish_assembly ( )
overridevirtual

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

Implements LinSys.

Definition at line 245 of file linsys_BDDC.cc.

const it::Record & LinSys_BDDC::get_input_type ( )
static

Definition at line 37 of file linsys_BDDC.cc.

Here is the caller graph for this function:

double LinSys_BDDC::get_solution_precision ( )
overridevirtual

Get precision of solving

Implements LinSys.

Definition at line 379 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 125 of file linsys_BDDC.cc.

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

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

Implements LinSys.

Definition at line 176 of file linsys_BDDC.cc.

PetscErrorCode LinSys_BDDC::mat_zero_entries ( )
overridevirtual

Clears entries of the matrix

Reimplemented from LinSys.

Definition at line 229 of file linsys_BDDC.cc.

void LinSys_BDDC::print_matrix ( std::ostream &  out)

Prints matrix in coordinate format, can be load by matlab as a sparse matrix. Works only on 1 proc.

Definition at line 388 of file linsys_BDDC.cc.

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

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

Implements LinSys.

Definition at line 201 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 237 of file linsys_BDDC.cc.

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

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

Reimplemented from LinSys.

Definition at line 300 of file linsys_BDDC.cc.

Here is the caller graph for this function:

void LinSys_BDDC::set_tolerances ( double  r_tol,
double  a_tol,
unsigned int  max_it 
)
overridevirtual

Set relative tolerance, absolute tolerance, and maximum number of iterations of the linear solver.

For each of these three parameters we first look for the value at user input if not set we use the value provided to this method and finally the default values are set by the call of this method in the constructor.

Implements LinSys.

Definition at line 113 of file linsys_BDDC.cc.

LinSys::SolveInfo LinSys_BDDC::solve ( )
overridevirtual

Solve the system and return convergence reason.

Implements LinSys.

Definition at line 259 of file linsys_BDDC.cc.

Member Data Documentation

Bddcml_* LinSys_BDDC::bddcml_
private

BDDCML wrapper.

Definition at line 127 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 114 of file linsys_BDDC.hh.

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

indices of subdomain nodes in global numbering

Definition at line 121 of file linsys_BDDC.hh.

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

subdomain solution

Definition at line 122 of file linsys_BDDC.hh.

Vec LinSys_BDDC::locSolVec_
private

local solution PETSc vector - sequential

Definition at line 123 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 111 of file linsys_BDDC.hh.

int LinSys_BDDC::number_of_levels_
private

number of levels in the multilevel method

Definition at line 112 of file linsys_BDDC.hh.

const int LinSys_BDDC::registrar = LinSys_BDDC::get_input_type().size()
staticprivate

Registrar of class to factory.

Definition at line 108 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 119 of file linsys_BDDC.hh.

bool LinSys_BDDC::use_adaptive_bddc_
private

should adaptive BDDC be used?

Definition at line 113 of file linsys_BDDC.hh.

VecScatter LinSys_BDDC::VSpetscToSubScatter_
private

scatter from solution_ to locSolVec_

Definition at line 124 of file linsys_BDDC.hh.


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