Flow123d  JS_before_hm-2154-g185f171e0
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
 
typedef la::BddcmlWrapper::MatrixType BDDCMatrixType
 
- Public Types inherited from LinSys
enum  SetValuesMode {
  INSERT =INSERT_VALUES, ADD =ADD_VALUES, ALLOCATE, DONE,
  NONE
}
 

Public Member Functions

 LinSys_BDDC (const Distribution *rows_ds, const bool swap_sign=false)
 
void set_tolerances (double r_tol, double a_tol, unsigned int max_it) override
 Sets tolerances. Note that BDDC does not use a_tol. More...
 
void load_mesh (BDDCMatrixType matrix_type, 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 &, MatStructure)
 
virtual PetscErrorCode set_rhs (Vec &)
 
const Vec & get_solution ()
 
void set_solution (Vec sol_vec)
 
void set_solution (double *sol_array)
 
void set_solution ()
 
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_local_system (LocalSystem &local, const std::vector< LongIdx > &local_to_global_map)
 
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 (string)
 
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_vec_
 Indicates if the solution vector has been allocated by this class. 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 39 of file linsys_BDDC.hh.

Member Typedef Documentation

◆ BDDCMatrixType

Definition at line 44 of file linsys_BDDC.hh.

◆ Bddcml_

Definition at line 141 of file linsys_BDDC.hh.

◆ FactoryBaseType

Definition at line 43 of file linsys_BDDC.hh.

Constructor & Destructor Documentation

◆ LinSys_BDDC()

LinSys_BDDC::LinSys_BDDC ( const Distribution rows_ds,
const bool  swap_sign = false 
)

Definition at line 65 of file linsys_BDDC.cc.

◆ ~LinSys_BDDC()

LinSys_BDDC::~LinSys_BDDC ( )

Definition at line 290 of file linsys_BDDC.cc.

Member Function Documentation

◆ apply_constrains()

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

◆ compute_residual()

double LinSys_BDDC::compute_residual ( )
inlineoverridevirtual

Explicitly compute residual and its norm for current solution.

Implements LinSys.

Definition at line 103 of file linsys_BDDC.hh.

◆ diagonal_weights_set_value()

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

Definition at line 201 of file linsys_BDDC.cc.

◆ finish_assembly()

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

◆ get_input_type()

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

Definition at line 39 of file linsys_BDDC.cc.

Here is the caller graph for this function:

◆ get_solution_precision()

double LinSys_BDDC::get_solution_precision ( )
overridevirtual

Get precision of solving

Implements LinSys.

Definition at line 357 of file linsys_BDDC.cc.

◆ load_mesh()

void LinSys_BDDC::load_mesh ( BDDCMatrixType  matrix_type,
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 
)

Extracted from bddcml_wrapper.hpp:

nDim - dimension of the ambient space numNodes - number of nodes (auxiliary points related to dofs) numDofs - size of the linear system inet - local dof indices on elements nnet - numbers of dofs per elements nndf - number of dofs per node, size numNodes

isegn - global indices of subdomain elements isngn - global indices of subdomain nodes isvggn - global indices of subdomain dofs xyz - coordinates of nodes element_permability - scaling parameters one per element meshDim - topological dimension of the problem (e.g. shell in 3d)

Definition at line 91 of file linsys_BDDC.cc.

◆ mat_set_values()

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

◆ mat_zero_entries()

PetscErrorCode LinSys_BDDC::mat_zero_entries ( )
overridevirtual

Clears entries of the matrix

Reimplemented from LinSys.

Definition at line 208 of file linsys_BDDC.cc.

◆ print_matrix()

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

◆ rhs_set_values()

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

◆ rhs_zero_entries()

PetscErrorCode LinSys_BDDC::rhs_zero_entries ( )
overridevirtual

Clears entries of the right-hand side

Reimplemented from LinSys.

Definition at line 216 of file linsys_BDDC.cc.

◆ set_from_input()

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

Here is the caller graph for this function:

◆ set_tolerances()

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

Sets tolerances. Note that BDDC does not use a_tol.

Implements LinSys.

Definition at line 79 of file linsys_BDDC.cc.

◆ solve()

LinSys::SolveInfo LinSys_BDDC::solve ( )
overridevirtual

Solve the system and return convergence reason.

Implements LinSys.

Definition at line 238 of file linsys_BDDC.cc.

Member Data Documentation

◆ bddcml_

Bddcml_* LinSys_BDDC::bddcml_
private

BDDCML wrapper.

Definition at line 142 of file linsys_BDDC.hh.

◆ bddcml_verbosity_level_

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 129 of file linsys_BDDC.hh.

◆ isngn_

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

indices of subdomain nodes in global numbering

Definition at line 136 of file linsys_BDDC.hh.

◆ locSolution_

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

subdomain solution

Definition at line 137 of file linsys_BDDC.hh.

◆ locSolVec_

Vec LinSys_BDDC::locSolVec_
private

local solution PETSc vector - sequential

Definition at line 138 of file linsys_BDDC.hh.

◆ max_nondecr_it_

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 126 of file linsys_BDDC.hh.

◆ number_of_levels_

int LinSys_BDDC::number_of_levels_
private

number of levels in the multilevel method

Definition at line 127 of file linsys_BDDC.hh.

◆ registrar

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

Registrar of class to factory.

Definition at line 123 of file linsys_BDDC.hh.

◆ swap_sign_

const bool LinSys_BDDC::swap_sign_
private

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

Definition at line 134 of file linsys_BDDC.hh.

◆ use_adaptive_bddc_

bool LinSys_BDDC::use_adaptive_bddc_
private

should adaptive BDDC be used?

Definition at line 128 of file linsys_BDDC.hh.

◆ VSpetscToSubScatter_

VecScatter LinSys_BDDC::VSpetscToSubScatter_
private

scatter from solution_ to locSolVec_

Definition at line 139 of file linsys_BDDC.hh.


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