19 #ifndef LA_LINSYS_PETSC_HH_ 20 #define LA_LINSYS_PETSC_HH_ 28 #include "petscmath.h" 59 void set_tolerances(
double r_tol,
double a_tol,
unsigned int max_it)
override;
79 PetscErrorCode
set_matrix(Mat &matrix, MatStructure str)
override 81 matrix_changed_ =
true;
82 return MatCopy(matrix, matrix_, str);
88 return VecCopy(rhs, rhs_);
93 matrix_changed_ =
true;
94 return MatZeroEntries(matrix_);
100 return VecSet(rhs_, 0);
103 void start_allocation()
override;
105 void start_add_assembly()
override;
107 void start_insert_assembly()
override;
109 void mat_set_values(
int nrow,
int *rows,
int ncol,
int *cols,
double *vals )
override;
111 void rhs_set_values(
int nrow,
int *rows,
double *vals )
override;
113 void preallocate_values(
int nrow,
int *rows,
int ncol,
int *cols);
115 void preallocate_matrix();
117 void finish_assembly()
override;
119 void finish_assembly( MatAssemblyType assembly_type );
121 void apply_constrains(
double scalar = 1. )
override;
123 void set_initial_guess_nonzero(
bool set_nonzero =
true);
134 void view( )
override;
141 double get_solution_precision()
override;
143 double compute_residual()
override;
155 if ( array.size() )
return &(array[0]);
164 return static_cast<double>(
arg );
const Distribution * get_ds()
const Mat * get_matrix() override
double * v_rhs_
local RHS array pointing to Vec rhs_
double get_absolute_accuracy() override
Wrappers for linear systems based on MPIAIJ and MATIS format.
Vec rhs_
PETSc vector constructed with vx array.
double operator()(PetscScalar arg)
T * makePetscPointer_(std::vector< T > &array)
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.
PetscErrorCode set_rhs(Vec &rhs) override
std::string params_
command-line-like options for the PETSc solver
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.
Mat matrix_
Petsc matrix of the problem.
static const int registrar
Registrar of class to factory.
PetscErrorCode rhs_zero_entries() override
bool init_guess_nonzero
flag for starting from nonzero guess
double solution_precision_