www.mooseframework.org
Public Member Functions | List of all members
SparsityBasedContactConstraint Class Reference

#include <SparsityBasedContactConstraint.h>

Inheritance diagram for SparsityBasedContactConstraint:
[legend]

Public Member Functions

 SparsityBasedContactConstraint (const InputParameters &parameters)
 
virtual ~SparsityBasedContactConstraint ()
 
virtual Real computeQpSlaveValue ()
 
virtual Real computeQpResidual (Moose::ConstraintType)
 
virtual Real computeQpJacobian (Moose::ConstraintJacobianType)
 
virtual void getConnectedDofIndices ()
 Gets the indices for all dofs conected to the constraint Get indices for all the slave Jacobian columns, not only those based on the mesh connectivity. More...
 

Detailed Description

Definition at line 22 of file SparsityBasedContactConstraint.h.

Constructor & Destructor Documentation

◆ SparsityBasedContactConstraint()

SparsityBasedContactConstraint::SparsityBasedContactConstraint ( const InputParameters &  parameters)
inline

Definition at line 25 of file SparsityBasedContactConstraint.h.

26  : NodeFaceConstraint(parameters){};

◆ ~SparsityBasedContactConstraint()

virtual SparsityBasedContactConstraint::~SparsityBasedContactConstraint ( )
inlinevirtual

Definition at line 27 of file SparsityBasedContactConstraint.h.

27 {}

Member Function Documentation

◆ computeQpJacobian()

virtual Real SparsityBasedContactConstraint::computeQpJacobian ( Moose::ConstraintJacobianType  )
inlinevirtual

Reimplemented in GluedContactConstraint.

Definition at line 41 of file SparsityBasedContactConstraint.h.

42  {
43  mooseError("Unimplemented pure virtual method. SparsityBasedContactConstraint should only be "
44  "used as a base class");
45  return 0;
46  }

◆ computeQpResidual()

virtual Real SparsityBasedContactConstraint::computeQpResidual ( Moose::ConstraintType  )
inlinevirtual

Reimplemented in GluedContactConstraint.

Definition at line 35 of file SparsityBasedContactConstraint.h.

36  {
37  mooseError("Unimplemented pure virtual method. SparsityBasedContactConstraint should only be "
38  "used as a base class");
39  return 0;
40  }

◆ computeQpSlaveValue()

virtual Real SparsityBasedContactConstraint::computeQpSlaveValue ( )
inlinevirtual

Reimplemented in GluedContactConstraint.

Definition at line 29 of file SparsityBasedContactConstraint.h.

30  {
31  mooseError("Unimplemented pure virtual method. SparsityBasedContactConstraint should only be "
32  "used as a base class");
33  return 0;
34  }

◆ getConnectedDofIndices()

void SparsityBasedContactConstraint::getConnectedDofIndices ( )
virtual

Gets the indices for all dofs conected to the constraint Get indices for all the slave Jacobian columns, not only those based on the mesh connectivity.

Definition at line 29 of file SparsityBasedContactConstraint.C.

30 {
31 #if defined(LIBMESH_HAVE_PETSC) && !PETSC_VERSION_LESS_THAN(3, 3, 0)
32  _connected_dof_indices.clear();
33 
34  // An ugly hack: have to extract the row and look at it's sparsity structure, since otherwise I
35  // won't get the dofs connected to this row by virtue of intervariable coupling
36  // This is easier than sifting through all coupled variables, selecting those active on the
37  // current subdomain, dealing with the scalar variables, etc.
38  // Also, importantly, this will miss coupling to variables that might have introduced by prior
39  // constraints similar to this one!
40  PetscMatrix<Number> * petsc_jacobian = dynamic_cast<PetscMatrix<Number> *>(_jacobian);
41  mooseAssert(petsc_jacobian, "Expected a PETSc matrix");
42  Mat jac = petsc_jacobian->mat();
43  PetscErrorCode ierr;
44  PetscInt ncols;
45  const PetscInt * cols;
46  ierr = MatGetRow(jac, static_cast<PetscInt>(_var.nodalDofIndex()), &ncols, &cols, PETSC_NULL);
47  CHKERRABORT(_communicator.get(), ierr);
48  bool debug = false;
49  if (debug)
50  {
51  libMesh::out << "_connected_dof_indices: adding " << ncols << " dofs from Jacobian row["
52  << _var.nodalDofIndex() << "] = [";
53  }
54  for (PetscInt i = 0; i < ncols; ++i)
55  {
56  if (debug)
57  {
58  libMesh::out << cols[i] << " ";
59  }
60  _connected_dof_indices.push_back(cols[i]);
61  }
62  if (debug)
63  {
64  libMesh::out << "]\n";
65  }
66  ierr = MatRestoreRow(jac, static_cast<PetscInt>(_var.nodalDofIndex()), &ncols, &cols, PETSC_NULL);
67  CHKERRABORT(_communicator.get(), ierr);
68 #else
69  NodeFaceConstraint::getConnectedDofIndices();
70 #endif
71 }

The documentation for this class was generated from the following files: