Flow123d  3.9.0-c13e246a6
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | Static Private Attributes | List of all members
LinSys_PERMON Class Reference

#include <linsys_PERMON.hh>

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

Classes

struct  PetscScalar2Double_
 

Public Types

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

Public Member Functions

 LinSys_PERMON (const Distribution *rows_ds, const std::string &params="")
 
 LinSys_PERMON (LinSys_PERMON &other)
 
void set_inequality (Mat matrix_ineq, Vec ineq)
 
LinSys_PETSC::SolveInfo solve () override
 
double get_absolute_accuracy () override
 
void view (string text="") override
 
double get_solution_precision () override
 
double compute_residual () override
 
 ~LinSys_PERMON ()
 
- Public Member Functions inherited from LinSys_PETSC
 LinSys_PETSC (const Distribution *rows_ds, const std::string &params="")
 
 LinSys_PETSC (LinSys_PETSC &other)
 
void set_tolerances (double r_tol, double a_tol, unsigned int max_it) override
 
const Distributionget_ds ()
 
const Mat * get_matrix () override
 
const Vec * get_rhs () override
 
PetscErrorCode set_matrix (Mat &matrix, MatStructure str) override
 
PetscErrorCode set_rhs (Vec &rhs) override
 
PetscErrorCode mat_zero_entries () override
 
PetscErrorCode rhs_zero_entries () override
 
void start_allocation () override
 
void start_add_assembly () override
 
void start_insert_assembly () override
 
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 preallocate_values (int nrow, int *rows, int ncol, int *cols)
 
void preallocate_matrix ()
 
void finish_assembly () override
 
void finish_assembly (MatAssemblyType assembly_type)
 
void apply_constrains (double scalar=1.) override
 
void set_initial_guess_nonzero (bool set_nonzero=true)
 
LinSys::SolveInfo solve () override
 
double get_absolute_accuracy () override
 
void view (string text="") override
 
void set_from_input (const Input::Record in_rec) override
 
double get_solution_precision () override
 
double compute_residual () override
 
 ~LinSys_PETSC ()
 
- Public Member Functions inherited from LinSys
 LinSys (const Distribution *rows_ds)
 
 LinSys (LinSys &other)
 
unsigned int size ()
 
unsigned int vec_lsize ()
 
void set_matrix_changed ()
 
void set_rhs_changed ()
 
bool is_matrix_changed ()
 
bool is_rhs_changed ()
 
const Vec & get_solution ()
 
void set_solution (Vec sol_vec)
 
void set_solution (double *sol_array)
 
void set_solution ()
 
double * get_solution_array ()
 
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 ()
 
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 ~LinSys ()
 

Static Public Member Functions

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

Protected Attributes

Mat matrix_ineq_
 PETSc matrix of inequality constraint. More...
 
Vec ineq_
 PETSc vector of inequality constraint. More...
 
QP system
 
QPS solver
 
- Protected Attributes inherited from LinSys_PETSC
std::string params_
 command-line-like options for the PETSc solver More...
 
bool init_guess_nonzero
 flag for starting from nonzero guess More...
 
Mat matrix_
 Petsc matrix of the problem. More...
 
Vec rhs_
 PETSc vector constructed with vx array. More...
 
Vec residual_
 
double * v_rhs_
 local RHS array pointing to Vec rhs_ More...
 
Vec on_vec_
 Vectors for counting non-zero entries in diagonal block. More...
 
Vec off_vec_
 Vectors for counting non-zero entries in off-diagonal block. More...
 
double solution_precision_
 
KSP system
 
KSPConvergedReason reason
 
- 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_
 

Private Member Functions

template<typename T >
T * makePetscPointer_ (std::vector< T > &array)
 

Static Private Attributes

static const int registrar = LinSys_PERMON::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_
 
- 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_PERMON.hh.

Member Typedef Documentation

◆ FactoryBaseType

Definition at line 43 of file linsys_PERMON.hh.

Constructor & Destructor Documentation

◆ LinSys_PERMON() [1/2]

LinSys_PERMON::LinSys_PERMON ( const Distribution rows_ds,
const std::string &  params = "" 
)

Definition at line 61 of file linsys_PERMON.cc.

◆ LinSys_PERMON() [2/2]

LinSys_PERMON::LinSys_PERMON ( LinSys_PERMON other)

Copy constructor.

Definition at line 68 of file linsys_PERMON.cc.

◆ ~LinSys_PERMON()

LinSys_PERMON::~LinSys_PERMON ( )

Definition at line 228 of file linsys_PERMON.cc.

Member Function Documentation

◆ compute_residual()

double LinSys_PERMON::compute_residual ( )
overridevirtual

Explicitly compute residual and its norm for current solution.

Implements LinSys.

Definition at line 242 of file linsys_PERMON.cc.

◆ get_absolute_accuracy()

double LinSys_PERMON::get_absolute_accuracy ( )
inlineoverridevirtual

Returns information on absolute solver accuracy

Reimplemented from LinSys.

Definition at line 61 of file linsys_PERMON.hh.

◆ get_input_type()

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

Definition at line 32 of file linsys_PERMON.cc.

◆ get_solution_precision()

double LinSys_PERMON::get_solution_precision ( )
overridevirtual

Get precision of solving

Implements LinSys.

Definition at line 236 of file linsys_PERMON.cc.

◆ makePetscPointer_()

template<typename T >
T* LinSys_PERMON::makePetscPointer_ ( std::vector< T > &  array)
inlineprivate

Definition at line 79 of file linsys_PERMON.hh.

◆ set_inequality()

void LinSys_PERMON::set_inequality ( Mat  matrix_ineq,
Vec  ineq 
)

Definition at line 75 of file linsys_PERMON.cc.

◆ solve()

LinSys::SolveInfo LinSys_PERMON::solve ( )
overridevirtual

Solve the system and return convergence reason.

Implements LinSys.

Definition at line 82 of file linsys_PERMON.cc.

◆ view()

void LinSys_PERMON::view ( string  = "")
overridevirtual

Output the system in the Matlab format possibly with given ordering. Rather we shoud provide output operator <<, since it is more flexible.

Reimplemented from LinSys.

Definition at line 174 of file linsys_PERMON.cc.

Member Data Documentation

◆ ineq_

Vec LinSys_PERMON::ineq_
protected

PETSc vector of inequality constraint.

Definition at line 97 of file linsys_PERMON.hh.

◆ matrix_ineq_

Mat LinSys_PERMON::matrix_ineq_
protected

PETSc matrix of inequality constraint.

Definition at line 96 of file linsys_PERMON.hh.

◆ registrar

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

Registrar of class to factory.

Definition at line 75 of file linsys_PERMON.hh.

◆ solver

QPS LinSys_PERMON::solver
protected

Definition at line 100 of file linsys_PERMON.hh.

◆ system

QP LinSys_PERMON::system
protected

Definition at line 99 of file linsys_PERMON.hh.


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