44 return fabs(v) <= eps;
65 else if (fabs(v1) > 0)
66 rval = fabs((v1-v2)/v1) <= tol;
75 m0_rows = (
unsigned int) m0.rows(),
76 m0_cols = (
unsigned int) m0.cols();
77 libmesh_assert_equal_to(m0_rows, m.rows());
78 libmesh_assert_equal_to(m0_cols, m.cols());
82 for (
unsigned int i=0; i<m0_rows; i++) {
83 for (
unsigned int j=0; j<m0_cols; j++)
85 libMesh::out <<
"Failed comparison at (i,j) = (" 86 << i <<
", " << j <<
") : " 87 <<
"expected: " << m0(i,j) <<
" , " 88 <<
"computed: " << m(i,j) <<
" : " 89 <<
"diff: " << m0(i,j) - m(i,j) <<
" , " 90 <<
"tol: " << tol << std::endl;
114 unsigned int ndofs = (
unsigned int)sol.size();
117 jac0.setZero(ndofs, ndofs);
118 jac.setZero(ndofs, ndofs);
124 for (
unsigned int i=0; i<sol.size(); i++) {
130 jac.col(i) = (dres-res0)/delta;
135 <<
"Analytical Jacobian: " << std::endl
137 << std::endl << std::endl
138 <<
"Numerical Jacobian: " << std::endl
140 << std::endl << std::endl;
virtual ~NonlinearImplicitAssemblyElemOperations()
void check_element_numerical_jacobian(RealVectorX &sol)
a helper function to evaluate the numerical Jacobian and compare it with the analytical Jacobian...
bool compare_matrix(const RealMatrixX &m0, const RealMatrixX &m, const Real tol)
virtual void set_elem_solution(const RealVectorX &sol)
sets the element solution
virtual void elem_calculations(bool if_jac, RealVectorX &vec, RealMatrixX &mat)=0
performs the element calculations over elem, and returns the element vector and matrix quantities in ...
Matrix< Real, Dynamic, Dynamic > RealMatrixX
Matrix< Real, Dynamic, 1 > RealVectorX
bool is_numerical_zero(const Real v, const Real eps)
NonlinearImplicitAssemblyElemOperations()
bool compare(const Real v1, const Real v2, const Real tol)