1 #ifndef ABLATELIBRARY_PETSCUTILITIES_HPP
2 #define ABLATELIBRARY_PETSCUTILITIES_HPP
6 namespace ablate::utilities {
17 static std::string GetMessage(PetscErrorCode ierr) {
21 PetscErrorMessage(ierr, &text, &specific);
23 return std::string(text) +
": " + std::string(specific);
27 explicit PetscError(PetscErrorCode ierr) : std::runtime_error(GetMessage(ierr)) {}
30 inline friend void operator>>(PetscErrorCode ierr,
const ErrorChecker&) {
41 static void Initialize(
const char[] =
nullptr);
54 static void Set(
const std::string& prefix,
const std::map<std::string, std::string>& options,
bool override =
true);
61 static void Set(
const std::map<std::string, std::string>& options);
68 static void Set(PetscOptions petscOptions,
const std::map<std::string, std::string>& options);
77 static void Set(PetscOptions petscOptions,
const char name[],
const char value[],
bool override =
true);
96 std::istream& operator>>(std::istream& is, PetscDataType& v);
104 std::ostream& operator<<(std::ostream& os,
const PetscDataType& dt);
Definition: petscUtilities.hpp:13
Definition: petscUtilities.hpp:8
static void PetscOptionsDestroyAndCheck(const std::string &name, PetscOptions *options)
Definition: petscUtilities.cpp:41
static void Set(const std::string &prefix, const std::map< std::string, std::string > &options, bool override=true)
Definition: petscUtilities.cpp:11
static void Initialize(const char[]=nullptr)
Definition: petscUtilities.cpp:4
static utilities::PetscUtilities::ErrorChecker checkError
Definition: petscUtilities.hpp:46
static void Set(PetscOptions petscOptions, const char name[], const char value[], bool override=true)
Definition: petscUtilities.hpp:15