|
OOFEM 3.0
|
Contact search algorithm based on the sweep-and-prune strategy. More...
#include <contactsearchsweepandprune.h>
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< AABB > | aabbs |
| bool | isInitialized |
| Protected Attributes inherited from oofem::ContactSearchAlgorithm_Surface2FESurface | |
| FEContactSurface * | slaveContactSurface |
| FEContactSurface * | masterContactSurface |
| int | surface_dimension |
| Protected Attributes inherited from oofem::ContactSearchAlgorithm | |
| Domain * | domain |
| std::vector< std::unique_ptr< ContactPair > > | contactPairs |
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.
| using oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::IJ = std::pair<unsigned int, unsigned int> |
Definition at line 81 of file contactsearchsweepandprune.h.
| using oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::SetIJ = std::set<IJ> |
Definition at line 82 of file contactsearchsweepandprune.h.
| 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.
| scs | Pointer to the slave FE contact surface. |
| mcs | Pointer to the master FE contact surface. |
| d | Pointer to the associated domain. |
Definition at line 40 of file contactsearchsweepandprune.C.
References oofem::ContactSearchAlgorithm_Surface2FESurface_3d::ContactSearchAlgorithm_Surface2FESurface_3d(), and isInitialized.
|
inline |
Definition at line 103 of file contactsearchsweepandprune.h.
|
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.
| ij | Pair identifier (e.g. indices of slave/master entities). |
Definition at line 190 of file contactsearchsweepandprune.C.
References potentialPairs.
Referenced by initialize(), and solveInversion().
|
inlinestaticprotected |
Utility: checks whether a pair identifier is contained in a set.
ij is present in set, false otherwise. Definition at line 186 of file contactsearchsweepandprune.h.
|
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.
| ij | Pair identifier (e.g. indices of slave/master entities). |
Definition at line 196 of file contactsearchsweepandprune.C.
References potentialPairs.
Referenced by solveInversion().
|
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().
|
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().
|
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.
| axis | Axis index on which the inversion occurred (0=x, 1=y, 2=z). |
| b1 | First bound involved in the inversion. |
| b2 | Second 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().
|
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().
|
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().
|
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.
| tStep | Current 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().
|
protected |
Definition at line 87 of file contactsearchsweepandprune.h.
Referenced by initialize(), updateAABBs(), and updateBoundss().
|
protected |
Definition at line 86 of file contactsearchsweepandprune.h.
Referenced by initialize(), insertionSort(), and updateBoundss().
|
protected |
Definition at line 88 of file contactsearchsweepandprune.h.
Referenced by ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune(), initialize(), and updateContactPairs().
|
protected |
Definition at line 84 of file contactsearchsweepandprune.h.
Referenced by addPotentialPair(), deletePotentialPair(), and updateContactPairs().
|
protected |
Definition at line 85 of file contactsearchsweepandprune.h.
Referenced by initialize(), and solveInversion().