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;
95 return MatZeroEntries(matrix_);
101 return VecSet(rhs_, 0);
104 void start_allocation()
override;
106 void start_add_assembly()
override;
108 void start_insert_assembly()
override;
110 void mat_set_values(
int nrow,
int *rows,
int ncol,
int *cols,
double *vals )
override;
112 void rhs_set_values(
int nrow,
int *rows,
double *vals )
override;
114 void preallocate_values(
int nrow,
int *rows,
int ncol,
int *cols);
116 void preallocate_matrix();
118 void finish_assembly()
override;
120 void finish_assembly( MatAssemblyType assembly_type );
122 void apply_constrains(
double scalar = 1. )
override;
124 void set_initial_guess_nonzero(
bool set_nonzero =
true);
135 void view( )
override;
142 double get_solution_precision()
override;
144 double compute_residual()
override;
156 if ( array.size() )
return &(array[0]);
165 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_