15 #include "libmesh/nonlinear_solver.h" 16 #include "libmesh/nonlinear_implicit_system.h" 17 #include "libmesh/petsc_matrix.h" 29 "The petsc binary mat file containing the matrix. If this " 30 "parameter is not provided, then the system matrix is used");
32 "symmetry_tol", 1e-8,
"The tolerance (both relative and absolute) for comparing symmetry");
36 "A binary file may contain multiple writes of a matrix. This parameter can be used to load a " 37 "particular matrix from the binary file. By default we load the first written matrix");
43 _mat_from_file(isParamValid(
"mat")),
44 _mat_file_name(_mat_from_file ? getParam<
std::string>(
"mat") :
""),
45 _symm_tol(getParam<
Real>(
"symmetry_tol")),
46 _mat_number_to_load(getParam<unsigned
int>(
"mat_number_to_load")),
51 "This parameter should only be set in conjunction with the 'mat' parameter");
63 std::unique_ptr<SparseMatrix<Number>> file_mat_wrapper;
68 mat = file_mat_wrapper.get();
73 mooseAssert(nl_solver,
"This should be non-null");
74 auto & sys_mat = nl_solver->system().get_system_matrix();
81 const auto val1 = (*mat)(i, j);
82 const auto val2 = (*mat)(j, i);
bool _equiv
Whether the matrix is symmetric.
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
Function to check whether two variables are equal within an absolute tolerance.
const unsigned int _mat_number_to_load
A binary file may contain multiple writes of a matrix.
std::unique_ptr< PetscMatrix< Number > > createMatrixFromFile(const libMesh::Parallel::Communicator &comm, Mat &petsc_mat, const std::string &binary_mat_file, unsigned int mat_number_to_load=1)
Create a matrix from a binary file.
virtual libMesh::NonlinearSolver< Number > * nonlinearSolver()=0
const Parallel::Communicator & _communicator
This class is here to combine the Postprocessor interface and the base class Postprocessor object alo...
virtual Real getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
virtual void execute() override
Execute method.
virtual numeric_index_type row_stop() const =0
registerMooseObject("MooseApp", MatrixSymmetryCheck)
static InputParameters validParams()
MatrixSymmetryCheck(const InputParameters ¶meters)
void min(const T &r, T &o, Request &req) const
const bool _mat_from_file
Whether the matrix we are checking for symmetry is from a file.
virtual numeric_index_type col_stop() const =0
virtual numeric_index_type col_start() const =0
const std::string _mat_file_name
The matrix from file name. Empty string if _mat_from_file is false.
NonlinearSystemBase & getNonlinearSystemBase(const unsigned int sys_num)
void paramError(const std::string ¶m, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
Checks whether the nonlinear system matrix is symmetric.
bool isParamSetByUser(const std::string &nm) const
Test if the supplied parameter is set by a user, as opposed to not set or set to default.
const Real _symm_tol
Tolerance for the comparison between coefficients and transpose counterparts.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
FEProblemBase & _fe_problem
Reference to the FEProblemBase for this user object.
virtual numeric_index_type row_start() const =0
bool relativeFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
Function to check whether two variables are equal within a relative tolerance.
IntRange< T > make_range(T beg, T end)
static InputParameters validParams()
void ErrorVector unsigned int