13 #include "MooseVariable.h"
15 #include "libmesh/petsc_macro.h"
16 #include "libmesh/petsc_matrix.h"
24 InputParameters params = validParams<NodeFaceConstraint>();
31 #if defined(LIBMESH_HAVE_PETSC) && !PETSC_VERSION_LESS_THAN(3, 3, 0)
32 _connected_dof_indices.clear();
40 PetscMatrix<Number> * petsc_jacobian =
dynamic_cast<PetscMatrix<Number> *
>(_jacobian);
41 mooseAssert(petsc_jacobian,
"Expected a PETSc matrix");
42 Mat jac = petsc_jacobian->mat();
45 const PetscInt * cols;
46 ierr = MatGetRow(jac, static_cast<PetscInt>(_var.nodalDofIndex()), &ncols, &cols, PETSC_NULL);
47 CHKERRABORT(_communicator.get(), ierr);
51 libMesh::out <<
"_connected_dof_indices: adding " << ncols <<
" dofs from Jacobian row["
52 << _var.nodalDofIndex() <<
"] = [";
54 for (PetscInt i = 0; i < ncols; ++i)
58 libMesh::out << cols[i] <<
" ";
60 _connected_dof_indices.push_back(cols[i]);
64 libMesh::out <<
"]\n";
66 ierr = MatRestoreRow(jac, static_cast<PetscInt>(_var.nodalDofIndex()), &ncols, &cols, PETSC_NULL);
67 CHKERRABORT(_communicator.get(), ierr);
69 NodeFaceConstraint::getConnectedDofIndices();