19 #ifndef LA_LINSYS_PETSC_HH_ 20 #define LA_LINSYS_PETSC_HH_ 47 void set_tolerances(
double r_tol,
double a_tol,
unsigned int max_it)
override;
67 PetscErrorCode
set_matrix(Mat &matrix, MatStructure str)
override 70 return MatCopy(matrix,
matrix_, str);
76 return VecCopy(rhs,
rhs_);
88 return VecSet(
rhs_, 0);
97 void mat_set_values(
int nrow,
int *rows,
int ncol,
int *cols,
double *vals )
override;
113 int solve()
override;
122 void view( )
override;
143 if ( array.size() )
return &(array[0]);
152 return static_cast<double>(
arg );
const Distribution * get_ds()
void apply_constrains(double scalar=1.) override
const Mat * get_matrix() override
bool matrix_changed_
true if the matrix was changed since the last solve
double * v_rhs_
local RHS array pointing to Vec rhs_
void set_from_input(const Input::Record in_rec) override
double get_absolute_accuracy() override
Wrappers for linear systems based on MPIAIJ and MATIS format.
Vec rhs_
PETSc vector constructed with vx array.
void start_allocation() override
double operator()(PetscScalar arg)
void preallocate_values(int nrow, int *rows, int ncol, int *cols)
void start_add_assembly() override
bool rhs_changed_
true if the right hand side was changed since the last solve
double get_solution_precision() override
void start_insert_assembly() override
T * makePetscPointer_(std::vector< T > &array)
LinSys_PETSC(const Distribution *rows_ds, const std::string ¶ms="")
const Distribution * rows_ds_
final distribution of rows of MH matrix
double a_tol_
absolute tolerance of linear solver
PetscErrorCode set_matrix(Mat &matrix, MatStructure str) override
PetscErrorCode mat_zero_entries() override
Vec on_vec_
Vectors for counting non-zero entries in diagonal block.
void preallocate_matrix()
double compute_residual() override
PetscErrorCode set_rhs(Vec &rhs) override
std::string params_
command-line-like options for the PETSc solver
Support classes for parallel programing.
KSPConvergedReason reason
internal::NamedArg< char > arg(StringRef name, const T &arg)
const Vec * get_rhs() override
Vec off_vec_
Vectors for counting non-zero entries in off-diagonal block.
void finish_assembly() override
void rhs_set_values(int nrow, int *rows, double *vals) override
Abstract linear system class.
void set_initial_guess_nonzero(bool set_nonzero=true)
static const Input::Type::Record & get_input_type()
void set_tolerances(double r_tol, double a_tol, unsigned int max_it) override
Mat matrix_
Petsc matrix of the problem.
static const int registrar
Registrar of class to factory.
PetscErrorCode rhs_zero_entries() override
void mat_set_values(int nrow, int *rows, int ncol, int *cols, double *vals) override
bool init_guess_nonzero
flag for starting from nonzero guess
double solution_precision_