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

Contact search algorithm based on the sweep-and-prune strategy. More...

#include <contactsearchsweepandprune.h>

Inheritance diagram for oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune:
Collaboration diagram for oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune:

Public Types

using IJ = std::pair<unsigned int, unsigned int>
using SetIJ = std::set<IJ>

Public Member Functions

 ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune (FEContactSurface *scs, FEContactSurface *mcs, Domain *d)
 Constructs a 3D surface-to-surface contact search algorithm using sweep-and-prune.
 ~ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune ()
void updateContactPairs (TimeStep *tStep) override
 Updates the list of contact pairs using sweep-and-prune broad-phase detection.
Public Member Functions inherited from oofem::ContactSearchAlgorithm_Surface2FESurface_3d
 ContactSearchAlgorithm_Surface2FESurface_3d (FEContactSurface *scs, FEContactSurface *mcs, Domain *d)
 ~ContactSearchAlgorithm_Surface2FESurface_3d ()
Public Member Functions inherited from oofem::ContactSearchAlgorithm_Surface2FESurface
 ContactSearchAlgorithm_Surface2FESurface (FEContactSurface *scs, FEContactSurface *mcs, Domain *d, int sd)
 ~ContactSearchAlgorithm_Surface2FESurface ()
void createContactPairs () override
 Creates initial contact pairs based on the current configuration.
Public Member Functions inherited from oofem::ContactSearchAlgorithm
 ContactSearchAlgorithm (Domain *d)
 ~ContactSearchAlgorithm ()
std::vector< std::unique_ptr< ContactPair > > & getContactPairs ()
 Returns the internally stored list of contact pairs.
const std::vector< std::unique_ptr< ContactPair > > & getContactPairs () const
 Returns the internally stored list of contact pairs (const overload).

Protected Member Functions

void initialize ()
 Initializes internal data structures for sweep-and-prune.
void updateAABBs ()
 Recomputes AABBs used by the search algorithm.
void updateBoundss ()
 Updates per-axis bound (endpoint) arrays from current AABBs.
void insertionSort ()
 Performs incremental sorting of bounds using insertion sort.
void addPotentialPair (IJ)
 Adds a candidate pair to the set of potential contact pairs.
void deletePotentialPair (IJ)
 Removes a candidate pair from the set of potential contact pairs.
void solveInversion (int axis, const Bound &b1, const Bound &b2)
 Handles a bound inversion event detected during sorting on a given axis.

Static Protected Member Functions

static bool contains (const SetIJ &set, IJ ij)
 Utility: checks whether a pair identifier is contained in a set.

Protected Attributes

SetIJ potentialPairs
std::array< SetIJ, 3 > potentialPairsPerAxes
std::array< std::vector< Bound >, 3 > boundss
std::vector< AABBaabbs
bool isInitialized
Protected Attributes inherited from oofem::ContactSearchAlgorithm_Surface2FESurface
FEContactSurfaceslaveContactSurface
FEContactSurfacemasterContactSurface
int surface_dimension
Protected Attributes inherited from oofem::ContactSearchAlgorithm
Domaindomain
std::vector< std::unique_ptr< ContactPair > > contactPairs

Detailed Description

Contact search algorithm based on the sweep-and-prune strategy.

The ContactSearchSweepAndPrune class implements a contact detection algorithm using the sweep-and-prune method. The algorithm projects bounding volumes of contact surfaces or contact entities onto one or more coordinate axes and efficiently identifies potentially intersecting pairs by sorting and sweeping these projections.

This approach is particularly efficient for problems with a large number of contact entities and relatively small changes in their spatial configuration between consecutive time steps, as it exploits temporal coherence of the motion.

The class is intended to be used as a concrete implementation of the ContactSearch interface and provides candidate contact pairs that can be further processed by contact evaluation and enforcement algorithms.

Definition at line 78 of file contactsearchsweepandprune.h.

Member Typedef Documentation

◆ IJ

using oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::IJ = std::pair<unsigned int, unsigned int>

Definition at line 81 of file contactsearchsweepandprune.h.

◆ SetIJ

Constructor & Destructor Documentation

◆ ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune()

oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune ( FEContactSurface * scs,
FEContactSurface * mcs,
Domain * d )

Constructs a 3D surface-to-surface contact search algorithm using sweep-and-prune.

Initializes the search algorithm for a given slave and master FE contact surface within the provided computational domain. The algorithm will use axis-aligned bounding boxes (AABBs) and per-axis endpoint sorting to efficiently identify potential contact candidate pairs.

Parameters
scsPointer to the slave FE contact surface.
mcsPointer to the master FE contact surface.
dPointer to the associated domain.

Definition at line 40 of file contactsearchsweepandprune.C.

References oofem::ContactSearchAlgorithm_Surface2FESurface_3d::ContactSearchAlgorithm_Surface2FESurface_3d(), and isInitialized.

◆ ~ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune()

oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::~ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune ( )
inline

Definition at line 103 of file contactsearchsweepandprune.h.

Member Function Documentation

◆ addPotentialPair()

void oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::addPotentialPair ( IJ ij)
protected

Adds a candidate pair to the set of potential contact pairs.

Inserts the pair identifier into the global potential-pair set and/or updates auxiliary per-axis sets. A pair is typically promoted to a global potential pair once overlap has been detected consistently across axes.

Parameters
ijPair identifier (e.g. indices of slave/master entities).

Definition at line 190 of file contactsearchsweepandprune.C.

References potentialPairs.

Referenced by initialize(), and solveInversion().

◆ contains()

bool oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::contains ( const SetIJ & set,
IJ ij )
inlinestaticprotected

Utility: checks whether a pair identifier is contained in a set.

Parameters
setSet of pair identifiers.
ijPair identifier to check.
Returns
True if ij is present in set, false otherwise.

Definition at line 186 of file contactsearchsweepandprune.h.

◆ deletePotentialPair()

void oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::deletePotentialPair ( IJ ij)
protected

Removes a candidate pair from the set of potential contact pairs.

Deletes the pair identifier from the global potential-pair set and/or updates auxiliary per-axis sets when overlap is no longer present.

Parameters
ijPair identifier (e.g. indices of slave/master entities).

Definition at line 196 of file contactsearchsweepandprune.C.

References potentialPairs.

Referenced by solveInversion().

◆ initialize()

void oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::initialize ( )
protected

Initializes internal data structures for sweep-and-prune.

Builds initial AABBs and per-axis bound lists, and initializes the sets tracking potential pairs. Typically called on the first update before incremental sorting is applied.

Definition at line 50 of file contactsearchsweepandprune.C.

References aabbs, addPotentialPair(), boundss, oofem::ContactSearchAlgorithm::contactPairs, contains(), isInitialized, oofem::ContactSearchAlgorithm_Surface2FESurface::masterContactSurface, potentialPairsPerAxes, and updateAABBs().

Referenced by updateContactPairs().

◆ insertionSort()

void oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::insertionSort ( )
protected

Performs incremental sorting of bounds using insertion sort.

Applies insertion sort to the per-axis bound arrays to exploit temporal coherence (small changes between time steps). During sorting, inversions (swapped endpoints) are detected and handled to update the set of potential overlapping pairs.

Definition at line 173 of file contactsearchsweepandprune.C.

References boundss, solveInversion(), and oofem::Bound::value.

Referenced by updateContactPairs().

◆ solveInversion()

void oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::solveInversion ( int axis,
const Bound & b1,
const Bound & b2 )
protected

Handles a bound inversion event detected during sorting on a given axis.

When two neighboring bounds swap order during incremental sorting, the overlap status of the corresponding entities along the given axis may change. This method updates the per-axis potential-pair bookkeeping (and possibly the global set) based on whether the inversion creates or destroys an overlap interval.

Parameters
axisAxis index on which the inversion occurred (0=x, 1=y, 2=z).
b1First bound involved in the inversion.
b2Second bound involved in the inversion.

Definition at line 202 of file contactsearchsweepandprune.C.

References addPotentialPair(), contains(), deletePotentialPair(), oofem::Bound::id, oofem::Bound::isMin, oofem::Bound::isSlave, and potentialPairsPerAxes.

Referenced by insertionSort().

◆ updateAABBs()

void oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::updateAABBs ( )
protected

Recomputes AABBs used by the search algorithm.

Updates the axis-aligned bounding boxes of the contact entities participating in the search (typically the slave entities, and/or both sides depending on implementation details). These AABBs are the input to the sweep-and-prune endpoint generation.

Definition at line 132 of file contactsearchsweepandprune.C.

References aabbs, oofem::ContactSearchAlgorithm::contactPairs, and oofem::ContactSearchAlgorithm_Surface2FESurface::masterContactSurface.

Referenced by initialize(), and updateBoundss().

◆ updateBoundss()

void oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::updateBoundss ( )
protected

Updates per-axis bound (endpoint) arrays from current AABBs.

Rebuilds the arrays of min/max endpoints (bounds) for each coordinate axis from the current AABBs. These bound arrays are then processed by sorting (initially or incrementally) to detect overlaps efficiently.

Definition at line 153 of file contactsearchsweepandprune.C.

References aabbs, boundss, and updateAABBs().

Referenced by updateContactPairs().

◆ updateContactPairs()

void oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::updateContactPairs ( TimeStep * tStep)
overridevirtual

Updates the list of contact pairs using sweep-and-prune broad-phase detection.

Updates internal geometric data (AABBs and axis bounds) for the current time step, performs the sweep-and-prune procedure to obtain candidate master–slave pairs, and updates the internally stored set of potential pairs used for contact evaluation.

Parameters
tStepCurrent time step.

Reimplemented from oofem::ContactSearchAlgorithm_Surface2FESurface_3d.

Definition at line 250 of file contactsearchsweepandprune.C.

References oofem::ContactSearchAlgorithm::contactPairs, initialize(), insertionSort(), isInitialized, oofem::ContactSearchAlgorithm_Surface2FESurface::masterContactSurface, potentialPairs, and updateBoundss().

Member Data Documentation

◆ aabbs

std::vector<AABB> oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::aabbs
protected

Definition at line 87 of file contactsearchsweepandprune.h.

Referenced by initialize(), updateAABBs(), and updateBoundss().

◆ boundss

std::array<std::vector<Bound>,3> oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::boundss
protected

Definition at line 86 of file contactsearchsweepandprune.h.

Referenced by initialize(), insertionSort(), and updateBoundss().

◆ isInitialized

bool oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::isInitialized
protected

◆ potentialPairs

SetIJ oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::potentialPairs
protected

◆ potentialPairsPerAxes

std::array<SetIJ,3> oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::potentialPairsPerAxes
protected

Definition at line 85 of file contactsearchsweepandprune.h.

Referenced by initialize(), and solveInversion().


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