1#ifndef CHI_MATH_PETSC_UTILS_H
2#define CHI_MATH_PETSC_UTILS_H
35 const std::vector<int64_t>& ghost_indices);
41 const std::vector<int64_t>& nodal_nnz_in_diag,
42 const std::vector<int64_t>& nodal_nnz_off_diag);
44 int64_t nodal_nnz_in_diag,
45 int64_t nodal_nnz_off_diag);
50 const std::string& in_solver_name =
"KSPSolver",
51 const std::string& in_solver_type = KSPGMRES,
52 const std::string& in_preconditioner_type = PCNONE,
53 double in_relative_residual_tolerance = 1.0e-6,
54 int64_t in_maximum_iterations = 100);
59 KSPConvergedReason* convergedReason,
60 void *monitordestroy);
64 PetscReal rnorm,
void *);
67 PetscReal rnorm,
void *);
78 const std::vector<int64_t>& global_indices,
79 std::vector<double>& data);
void RestoreGhostVectorLocalViewRead(Vec x, GhostVecLocalRaw &local_data)
GhostVecLocalRaw GetGhostVectorLocalViewRead(Vec x)
void InitMatrixSparsity(Mat &A, const std::vector< int64_t > &nodal_nnz_in_diag, const std::vector< int64_t > &nodal_nnz_off_diag)
void CopyVecToSTLvectorWithGhosts(Vec x, std::vector< double > &data, size_t N, bool resize_STL=true)
PetscErrorCode KSPMonitorStraight(KSP ksp, PetscInt n, PetscReal rnorm, void *)
void CopyGlobalVecToSTLvector(Vec x, const std::vector< int64_t > &global_indices, std::vector< double > &data)
PetscErrorCode RelativeResidualConvergenceTest(KSP ksp, PetscInt n, PetscReal rnorm, KSPConvergedReason *convergedReason, void *monitordestroy)
void CopyParallelVectorToVec(const ParallelVector &y, Vec x)
PETScSolverSetup CreateCommonKrylovSolverSetup(Mat ref_matrix, const std::string &in_solver_name="KSPSolver", const std::string &in_solver_type=KSPGMRES, const std::string &in_preconditioner_type=PCNONE, double in_relative_residual_tolerance=1.0e-6, int64_t in_maximum_iterations=100)
void CopyVecToSTLvector(Vec x, std::vector< double > &data, size_t N, bool resize_STL=true)
PetscErrorCode KSPMonitorRelativeToRHS(KSP ksp, PetscInt n, PetscReal rnorm, void *)
void CommunicateGhostEntries(Vec x)
Vec CreateVectorWithGhosts(int64_t local_size, int64_t global_size, int64_t nghosts, const std::vector< int64_t > &ghost_indices)
void CopySTLvectorToVec(const std::vector< double > &data, Vec x, size_t N)
Mat CreateSquareMatrix(int64_t local_size, int64_t global_size)
Vec CreateVector(int64_t local_size, int64_t global_size)
double & operator()(int index)
double operator[](int index)
std::string preconditioner_type
std::string in_solver_name
double relative_residual_tol