OOFEM
3.0
Loading...
Searching...
No Matches
src
core
Contact
contactsearchsweepandprune.h
Go to the documentation of this file.
1
/*
2
*
3
* ##### ##### ###### ###### ### ###
4
* ## ## ## ## ## ## ## ### ##
5
* ## ## ## ## #### #### ## # ##
6
* ## ## ## ## ## ## ## ##
7
* ## ## ## ## ## ## ## ##
8
* ##### ##### ## ###### ## ##
9
*
10
*
11
* OOFEM : Object Oriented Finite Element Code
12
*
13
* Copyright (C) 1993 - 2025 Borek Patzak
14
*
15
*
16
*
17
* Czech Technical University, Faculty of Civil Engineering,
18
* Department of Structural Mechanics, 166 29 Prague, Czech Republic
19
*
20
* This library is free software; you can redistribute it and/or
21
* modify it under the terms of the GNU Lesser General Public
22
* License as published by the Free Software Foundation; either
23
* version 2.1 of the License, or (at your option) any later version.
24
*
25
* This program is distributed in the hope that it will be useful,
26
* but WITHOUT ANY WARRANTY; without even the implied warranty of
27
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28
* Lesser General Public License for more details.
29
*
30
* You should have received a copy of the GNU Lesser General Public
31
* License along with this library; if not, write to the Free Software
32
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33
*/
34
35
#ifndef contactsearchsweepandprune_h
36
#define contactsearchsweepandprune_h
37
38
#include "
contactsearch.h
"
39
#include "
contactelement.h
"
40
#include "
contactpair.h
"
41
#include "
aabb.h
"
42
#include <memory>
43
#include <map>
44
#include <set>
45
#include <tuple>
46
#include <array>
47
#include <utility>
48
namespace
oofem
{
49
50
struct
Bound
{
51
public
:
52
double
value
;
53
unsigned
int
id
;
54
bool
isSlave
;
55
bool
isMin
;
56
};
57
58
77
78
class
ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune
:
public
ContactSearchAlgorithm_Surface2FESurface_3d
79
{
80
public
:
81
using
IJ
= std::pair<unsigned int, unsigned int>;
82
using
SetIJ
= std::set<IJ>;
83
protected
:
84
SetIJ
potentialPairs
;
85
std::array<SetIJ,3>
potentialPairsPerAxes
;
86
std::array<std::vector<Bound>,3>
boundss
;
87
std::vector<AABB>
aabbs
;
88
bool
isInitialized
;
89
public
:
102
ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune
(
FEContactSurface
*scs,
FEContactSurface
*mcs,
Domain
*d);
103
~ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune
(){;}
113
void
updateContactPairs
(
TimeStep
*tStep)
override
;
114
protected
:
122
void
initialize
();
131
void
updateAABBs
();
139
void
updateBoundss
();
147
void
insertionSort
();
157
void
addPotentialPair
(
IJ
);
166
void
deletePotentialPair
(
IJ
);
179
void
solveInversion
(
int
axis,
const
Bound
& b1,
const
Bound
& b2);
186
static
bool
contains
(
const
SetIJ
& set,
IJ
ij) {
187
// return set.contains(ij); // C++20
188
return
set.find(ij) != set.end();
189
}
190
};
191
192
}
// end namespace oofem
193
#endif
//contactsearchsweepandprune_h
aabb.h
oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::contains
static bool contains(const SetIJ &set, IJ ij)
Utility: checks whether a pair identifier is contained in a set.
Definition
contactsearchsweepandprune.h:186
oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::updateContactPairs
void updateContactPairs(TimeStep *tStep) override
Updates the list of contact pairs using sweep-and-prune broad-phase detection.
Definition
contactsearchsweepandprune.C:250
oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::solveInversion
void solveInversion(int axis, const Bound &b1, const Bound &b2)
Handles a bound inversion event detected during sorting on a given axis.
Definition
contactsearchsweepandprune.C:202
oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::~ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune
~ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune()
Definition
contactsearchsweepandprune.h:103
oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::addPotentialPair
void addPotentialPair(IJ)
Adds a candidate pair to the set of potential contact pairs.
Definition
contactsearchsweepandprune.C:190
oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::boundss
std::array< std::vector< Bound >, 3 > boundss
Definition
contactsearchsweepandprune.h:86
oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::SetIJ
std::set< IJ > SetIJ
Definition
contactsearchsweepandprune.h:82
oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::aabbs
std::vector< AABB > aabbs
Definition
contactsearchsweepandprune.h:87
oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::insertionSort
void insertionSort()
Performs incremental sorting of bounds using insertion sort.
Definition
contactsearchsweepandprune.C:173
oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::IJ
std::pair< unsigned int, unsigned int > IJ
Definition
contactsearchsweepandprune.h:81
oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::deletePotentialPair
void deletePotentialPair(IJ)
Removes a candidate pair from the set of potential contact pairs.
Definition
contactsearchsweepandprune.C:196
oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::initialize
void initialize()
Initializes internal data structures for sweep-and-prune.
Definition
contactsearchsweepandprune.C:50
oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::isInitialized
bool isInitialized
Definition
contactsearchsweepandprune.h:88
oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::updateBoundss
void updateBoundss()
Updates per-axis bound (endpoint) arrays from current AABBs.
Definition
contactsearchsweepandprune.C:153
oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::potentialPairs
SetIJ potentialPairs
Definition
contactsearchsweepandprune.h:84
oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::updateAABBs
void updateAABBs()
Recomputes AABBs used by the search algorithm.
Definition
contactsearchsweepandprune.C:132
oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::potentialPairsPerAxes
std::array< SetIJ, 3 > potentialPairsPerAxes
Definition
contactsearchsweepandprune.h:85
oofem::ContactSearchAlgorithm_Surface2FESurface_3d_SweepAndPrune::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.
Definition
contactsearchsweepandprune.C:40
oofem::ContactSearchAlgorithm_Surface2FESurface_3d::ContactSearchAlgorithm_Surface2FESurface_3d
ContactSearchAlgorithm_Surface2FESurface_3d(FEContactSurface *scs, FEContactSurface *mcs, Domain *d)
Definition
contactsearch.C:72
oofem::Domain
Definition
domain.h:121
oofem::FEContactSurface
Abstract representation of a finite element contact surface.
Definition
fecontactsurface.h:87
oofem::TimeStep
Definition
timestep.h:82
contactelement.h
contactpair.h
contactsearch.h
oofem
Definition
additivemanufacturingproblem.C:83
oofem::Bound
Definition
contactsearchsweepandprune.h:50
oofem::Bound::isMin
bool isMin
Definition
contactsearchsweepandprune.h:55
oofem::Bound::id
unsigned int id
Definition
contactsearchsweepandprune.h:53
oofem::Bound::value
double value
Definition
contactsearchsweepandprune.h:52
oofem::Bound::isSlave
bool isSlave
Definition
contactsearchsweepandprune.h:54
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