OOFEM 3.0
Loading...
Searching...
No Matches
oofem::ContactPair Class Reference

Represents a contact interaction between a master and a slave contact point. More...

#include <contactpair.h>

Collaboration diagram for oofem::ContactPair:

Public Member Functions

 ContactPair (std::unique_ptr< ContactPoint > slave)
 Constructs a contact pair with an initialized slave contact point.
 ~ContactPair ()
virtual bool inContact ()
 Returns true if the pair is currently considered in contact.
virtual void computeNmatrix (FloatMatrix &answer)
 Computes the contact interpolation matrix (N-matrix) for this pair.
virtual void compute_dNdxi_matrices (std::vector< FloatMatrix > &answer)
 Computes derivatives of shape functions w.r.t. local surface parameters.
virtual void computeCurvature (FloatMatrix &G, TimeStep *tStep)
 Computes curvature-related quantities of the contact surface at the contact point.
ContactPointgiveMasterContactPoint ()
 Returns the master contact point (non-owning pointer).
ContactPointgiveSlaveContactPoint ()
 Returns the slave contact point (non-owning pointer).
void giveLocationArray (const IntArray &dofs, IntArray &loc, const UnknownNumberingScheme &ns) const
 Builds a location array for the pair based on selected DOFs.
double giveNormalGap ()
 Returns the current normal gap (signed separation) of the pair.
void setNormalGap (double ng)
 Sets the current normal gap (signed separation) of the pair.
const FloatArraygiveNormalVector () const
 Returns the current unit normal vector associated with the contact configuration.
const FloatArraygivePreviousNormalVector () const
 Returns the unit normal vector from the previous stored state.
const FloatArraygiveTangentVector (int i) const
 Returns the i-th current tangent vector at the contact point.
const FloatArraygivePreviousTangentVector (int i) const
 Returns the i-th tangent vector from the previous stored state.
std::vector< FloatArraygiveTangentVectors () const
 Returns all current tangent vectors (typically one or two, depending on surface dimension).
std::vector< FloatArraygivePreviousTangentVectors () const
 Returns the slave local coordinates used to parameterize the contact point.
const FloatArraygiveLocalCoordinates () const
 Returns the slave local coordinates used to parameterize the contact point.
void initContactPoint ()
 Initializes contact-point related quantities for the pair.
FloatArray computeContactPointDisplacement () const
 Computes displacement at the contact point.
void setNormalVector (const FloatArray &nv)
 Sets the current normal vector.
void setTangentVector1 (const FloatArray &tv1)
 Sets the first tangent vector.
void setTangentVector2 (const FloatArray &tv2)
 Sets the second tangent vector.
void setTempTractionVector (const FloatArray &tv)
 Sets a temporary traction vector (e.g., predictor or iteration-local value).
const FloatArraygiveTractionVector () const
 Returns the current traction vector associated with the contact constraint.
void setMasterContactPoint (std::unique_ptr< ContactPoint > m)
 Assigns a master contact point for this pair.
void setSlaveContactPoint (std::unique_ptr< ContactPoint > s)
 Assigns a slave contact point for this pair.
virtual void updateYourself (TimeStep *tStep)
 Updates internal state of the contact pair for the given time step.
void computeVectorOf (ValueModeType u, TimeStep *tStep, FloatArray &answer)
 Computes a vector quantity for the pair in a given value mode.
AABB computeSlaveAABB ()
 Computes an axis-aligned bounding box (AABB) for the slave side.

Protected Attributes

std::unique_ptr< ContactPointmaster
std::unique_ptr< ContactPointslave
double normal_gap = 0
FloatArray normalVector
FloatArray previousNormalVector
FloatArray tangentVector1
FloatArray previousTangentVector1
FloatArray tangentVector2
FloatArray previousTangentVector2
FloatArray referenceContactPointCoords
FloatArray tempReferenceContactPointCoords
FloatArray contactPointCoords
FloatArray previousContactPointCoords
bool referenceContactPointInit = false
FloatArray tractionVector
FloatArray tempTractionVector
double dXi
double temp_dXi

Detailed Description

Represents a contact interaction between a master and a slave contact point.

The ContactPair class encapsulates all data and operations associated with a single master–slave contact interaction in a contact mechanics formulation. It stores pointers to the corresponding master and slave ContactPoint objects and maintains the quantities required to evaluate contact constraints, such as normal gap, contact forces (tractions), and their temporary or incremental values.

The class provides functionality for:

  • Updating the contact state in time,
  • Computing contact-related vectors
  • Storing and accessing current and temporary traction vectors,
  • Computing an axis-aligned bounding box (AABB) for the slave side, typically used for contact search and detection algorithms.

A ContactPair does not own the global contact algorithm itself; instead, it serves as a lightweight container and evaluator for a single detected contact interaction, used by higher-level classes.

Definition at line 67 of file contactpair.h.

Constructor & Destructor Documentation

◆ ContactPair()

oofem::ContactPair::ContactPair ( std::unique_ptr< ContactPoint > slave)

Constructs a contact pair with an initialized slave contact point.

The master contact point is typically assigned later by a contact search/projection procedure once a suitable master entity has been found.

Definition at line 40 of file contactpair.C.

References slave, and tractionVector.

◆ ~ContactPair()

oofem::ContactPair::~ContactPair ( )
inline

Definition at line 102 of file contactpair.h.

Member Function Documentation

◆ compute_dNdxi_matrices()

void oofem::ContactPair::compute_dNdxi_matrices ( std::vector< FloatMatrix > & answer)
virtual

Computes derivatives of shape functions w.r.t. local surface parameters.

Typically used for tangent construction, curvature evaluation, and consistent linearization of contact constraints.

Parameters
answerOutput list of derivative matrices (one per local parameter).

Definition at line 119 of file contactpair.C.

References oofem::FloatMatrix::giveNumberOfColumns(), oofem::FloatMatrix::giveNumberOfRows(), master, oofem::FloatMatrix::resize(), oofem::FloatMatrix::setSubMatrix(), slave, oofem::FloatMatrix::times(), and oofem::FloatMatrix::zero().

Referenced by oofem::StructuralPenaltyContactBoundaryCondition::computeTangentFromContact().

◆ computeContactPointDisplacement()

FloatArray oofem::ContactPair::computeContactPointDisplacement ( ) const

Computes displacement at the contact point.

Useful for gap/penetration evaluation and traction update procedures.

Definition at line 213 of file contactpair.C.

References contactPointCoords, master, previousContactPointCoords, and oofem::FloatArray::times().

Referenced by oofem::StructuralPenaltyContactBoundaryCondition::computeTractions().

◆ computeCurvature()

void oofem::ContactPair::computeCurvature ( FloatMatrix & G,
TimeStep * tStep )
virtual

Computes curvature-related quantities of the contact surface at the contact point.

Parameters
GOutput curvature matrix/tensor representation.
tStepCurrent time step.

Definition at line 146 of file contactpair.C.

References master, and normalVector.

Referenced by oofem::StructuralPenaltyContactBoundaryCondition::computeTangentFromContact().

◆ computeNmatrix()

void oofem::ContactPair::computeNmatrix ( FloatMatrix & answer)
virtual

Computes the contact interpolation matrix (N-matrix) for this pair.

Used to map nodal/DOF quantities to the contact point (e.g., for assembling contact contributions). The exact definition depends on the underlying contact point types.

Parameters
answerOutput matrix.

Definition at line 97 of file contactpair.C.

References oofem::FloatMatrix::giveNumberOfColumns(), oofem::FloatMatrix::giveNumberOfRows(), master, oofem::FloatMatrix::resize(), oofem::FloatMatrix::setSubMatrix(), slave, and oofem::FloatMatrix::times().

Referenced by oofem::StructuralPenaltyContactBoundaryCondition::computeInternalForcesFromContact(), and oofem::StructuralPenaltyContactBoundaryCondition::computeTangentFromContact().

◆ computeSlaveAABB()

AABB oofem::ContactPair::computeSlaveAABB ( )

Computes an axis-aligned bounding box (AABB) for the slave side.

Typically used to accelerate contact search and broad-phase collision tests.

Returns
Bounding box enclosing the slave contact entity.

Definition at line 226 of file contactpair.C.

References oofem::AABB::max, oofem::AABB::min, slave, oofem::Vector::x, oofem::Vector::y, and oofem::Vector::z.

◆ computeVectorOf()

void oofem::ContactPair::computeVectorOf ( ValueModeType u,
TimeStep * tStep,
FloatArray & answer )

Computes a vector quantity for the pair in a given value mode.

This is a convenience wrapper to retrieve quantities such as displacements or other state vectors at the involved contact points.

Parameters
uRequested value mode/quantity selector.
tStepCurrent time step.
answerOutput vector.

Definition at line 201 of file contactpair.C.

References oofem::FloatArray::copySubVector(), oofem::FloatArray::giveSize(), master, and slave.

◆ giveLocalCoordinates()

const FloatArray & oofem::ContactPair::giveLocalCoordinates ( ) const
inline

Returns the slave local coordinates used to parameterize the contact point.

Definition at line 200 of file contactpair.h.

References slave.

◆ giveLocationArray()

void oofem::ContactPair::giveLocationArray ( const IntArray & dofs,
IntArray & loc,
const UnknownNumberingScheme & ns ) const

Builds a location array for the pair based on selected DOFs.

Used during assembly of contact contributions into the global system.

Parameters
dofsDOF mask/IDs to include.
locOutput location array.
nsNumbering scheme.

Definition at line 168 of file contactpair.C.

References oofem::IntArray::followedBy(), master, and slave.

Referenced by oofem::ContactBoundaryCondition::giveLocationArray().

◆ giveMasterContactPoint()

ContactPoint * oofem::ContactPair::giveMasterContactPoint ( )
inline

Returns the master contact point (non-owning pointer).

Definition at line 145 of file contactpair.h.

References master.

◆ giveNormalGap()

double oofem::ContactPair::giveNormalGap ( )
inline

◆ giveNormalVector()

const FloatArray & oofem::ContactPair::giveNormalVector ( ) const
inline

Returns the current unit normal vector associated with the contact configuration.

Definition at line 172 of file contactpair.h.

References normalVector.

Referenced by oofem::StructuralPenaltyContactBoundaryCondition::computeInternalForcesFromContact(), and oofem::StructuralPenaltyContactBoundaryCondition::computeTangentFromContact().

◆ givePreviousNormalVector()

const FloatArray & oofem::ContactPair::givePreviousNormalVector ( ) const
inline

Returns the unit normal vector from the previous stored state.

Definition at line 176 of file contactpair.h.

References previousNormalVector.

◆ givePreviousTangentVector()

const FloatArray & oofem::ContactPair::givePreviousTangentVector ( int i) const

Returns the i-th tangent vector from the previous stored state.

Parameters
iTangent index.

Definition at line 59 of file contactpair.C.

References OOFEM_ERROR, previousTangentVector1, previousTangentVector2, tangentVector1, and tangentVector2.

Referenced by givePreviousTangentVectors().

◆ givePreviousTangentVectors()

std::vector< FloatArray > oofem::ContactPair::givePreviousTangentVectors ( ) const

Returns the slave local coordinates used to parameterize the contact point.

Definition at line 88 of file contactpair.C.

References givePreviousTangentVector().

Referenced by oofem::StructuralPenaltyContactBoundaryCondition::computeTractions().

◆ giveSlaveContactPoint()

ContactPoint * oofem::ContactPair::giveSlaveContactPoint ( )
inline

Returns the slave contact point (non-owning pointer).

Definition at line 149 of file contactpair.h.

References slave.

◆ giveTangentVector()

const FloatArray & oofem::ContactPair::giveTangentVector ( int i) const

Returns the i-th current tangent vector at the contact point.

Parameters
iTangent index.

Definition at line 47 of file contactpair.C.

References OOFEM_ERROR, tangentVector1, and tangentVector2.

Referenced by giveTangentVectors().

◆ giveTangentVectors()

std::vector< FloatArray > oofem::ContactPair::giveTangentVectors ( ) const

◆ giveTractionVector()

const FloatArray & oofem::ContactPair::giveTractionVector ( ) const
inline

Returns the current traction vector associated with the contact constraint.

Definition at line 232 of file contactpair.h.

References tractionVector.

Referenced by oofem::StructuralPenaltyContactBoundaryCondition::computeTractions().

◆ inContact()

virtual bool oofem::ContactPair::inContact ( )
inlinevirtual

Returns true if the pair is currently considered in contact.

The default implementation delegates the decision to the master contact point (if available). If no master is assigned, the pair cannot be in contact.

Definition at line 110 of file contactpair.h.

References master.

Referenced by updateYourself().

◆ initContactPoint()

void oofem::ContactPair::initContactPoint ( )

Initializes contact-point related quantities for the pair.

Typically called after assigning master/slave points and before first evaluation.

Definition at line 154 of file contactpair.C.

References contactPointCoords, master, referenceContactPointCoords, referenceContactPointInit, and slave.

Referenced by oofem::StructuralPenaltyContactBoundaryCondition::computeInternalForcesFromContact(), and oofem::StructuralPenaltyContactBoundaryCondition::computeTangentFromContact().

◆ setMasterContactPoint()

void oofem::ContactPair::setMasterContactPoint ( std::unique_ptr< ContactPoint > m)
inline

Assigns a master contact point for this pair.

Definition at line 236 of file contactpair.h.

References master.

◆ setNormalGap()

void oofem::ContactPair::setNormalGap ( double ng)
inline

Sets the current normal gap (signed separation) of the pair.

Definition at line 167 of file contactpair.h.

◆ setNormalVector()

void oofem::ContactPair::setNormalVector ( const FloatArray & nv)
inline

Sets the current normal vector.

Definition at line 216 of file contactpair.h.

◆ setSlaveContactPoint()

void oofem::ContactPair::setSlaveContactPoint ( std::unique_ptr< ContactPoint > s)
inline

Assigns a slave contact point for this pair.

Definition at line 240 of file contactpair.h.

References slave.

◆ setTangentVector1()

void oofem::ContactPair::setTangentVector1 ( const FloatArray & tv1)
inline

Sets the first tangent vector.

Definition at line 220 of file contactpair.h.

◆ setTangentVector2()

void oofem::ContactPair::setTangentVector2 ( const FloatArray & tv2)
inline

Sets the second tangent vector.

Definition at line 224 of file contactpair.h.

◆ setTempTractionVector()

void oofem::ContactPair::setTempTractionVector ( const FloatArray & tv)
inline

Sets a temporary traction vector (e.g., predictor or iteration-local value).

Definition at line 228 of file contactpair.h.

Referenced by oofem::StructuralPenaltyContactBoundaryCondition::computeInternalForcesFromContact().

◆ updateYourself()

void oofem::ContactPair::updateYourself ( TimeStep * tStep)
virtual

Updates internal state of the contact pair for the given time step.

Typical responsibilities include storing previous normals/tangents, updating contact kinematics, and synchronizing traction/gap-related data.

Parameters
tStepCurrent time step.

Definition at line 180 of file contactpair.C.

References giveNormalGap(), inContact(), master, normalVector, previousContactPointCoords, previousNormalVector, previousTangentVector1, previousTangentVector2, referenceContactPointInit, tangentVector1, tangentVector2, tempTractionVector, and tractionVector.

Member Data Documentation

◆ contactPointCoords

FloatArray oofem::ContactPair::contactPointCoords
protected

Definition at line 82 of file contactpair.h.

Referenced by computeContactPointDisplacement(), and initContactPoint().

◆ dXi

double oofem::ContactPair::dXi
protected

Definition at line 90 of file contactpair.h.

◆ master

◆ normal_gap

double oofem::ContactPair::normal_gap = 0
protected

Definition at line 72 of file contactpair.h.

Referenced by giveNormalGap().

◆ normalVector

FloatArray oofem::ContactPair::normalVector
protected

Definition at line 73 of file contactpair.h.

Referenced by computeCurvature(), giveNormalVector(), and updateYourself().

◆ previousContactPointCoords

FloatArray oofem::ContactPair::previousContactPointCoords
protected

Definition at line 84 of file contactpair.h.

Referenced by computeContactPointDisplacement(), and updateYourself().

◆ previousNormalVector

FloatArray oofem::ContactPair::previousNormalVector
protected

Definition at line 74 of file contactpair.h.

Referenced by givePreviousNormalVector(), and updateYourself().

◆ previousTangentVector1

FloatArray oofem::ContactPair::previousTangentVector1
protected

Definition at line 76 of file contactpair.h.

Referenced by givePreviousTangentVector(), and updateYourself().

◆ previousTangentVector2

FloatArray oofem::ContactPair::previousTangentVector2
protected

Definition at line 78 of file contactpair.h.

Referenced by givePreviousTangentVector(), and updateYourself().

◆ referenceContactPointCoords

FloatArray oofem::ContactPair::referenceContactPointCoords
protected

Definition at line 80 of file contactpair.h.

Referenced by initContactPoint().

◆ referenceContactPointInit

bool oofem::ContactPair::referenceContactPointInit = false
protected

Definition at line 85 of file contactpair.h.

Referenced by initContactPoint(), and updateYourself().

◆ slave

◆ tangentVector1

FloatArray oofem::ContactPair::tangentVector1
protected

Definition at line 75 of file contactpair.h.

Referenced by givePreviousTangentVector(), giveTangentVector(), and updateYourself().

◆ tangentVector2

FloatArray oofem::ContactPair::tangentVector2
protected

Definition at line 77 of file contactpair.h.

Referenced by givePreviousTangentVector(), giveTangentVector(), and updateYourself().

◆ temp_dXi

double oofem::ContactPair::temp_dXi
protected

Definition at line 91 of file contactpair.h.

◆ tempReferenceContactPointCoords

FloatArray oofem::ContactPair::tempReferenceContactPointCoords
protected

Definition at line 81 of file contactpair.h.

◆ tempTractionVector

FloatArray oofem::ContactPair::tempTractionVector
protected

Definition at line 88 of file contactpair.h.

Referenced by updateYourself().

◆ tractionVector

FloatArray oofem::ContactPair::tractionVector
protected

Definition at line 87 of file contactpair.h.

Referenced by ContactPair(), giveTractionVector(), and updateYourself().


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

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011