PeriDyno
1.0.0
Toggle main menu visibility
Main Page
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
Variables
b
c
d
e
g
h
i
k
m
p
q
r
s
t
z
Typedefs
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
Enumerations
b
c
d
e
f
g
i
l
m
n
o
p
q
r
s
t
v
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
h
i
j
m
n
o
p
q
r
s
t
v
Enumerations
Enumerator
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
u
w
x
y
Related Symbols
Files
File List
File Members
All
_
a
b
c
d
e
f
g
i
l
m
n
o
p
q
r
s
t
u
v
w
x
Functions
_
a
b
c
d
f
g
i
l
m
o
p
q
s
t
v
w
x
Variables
Typedefs
Enumerations
Enumerator
g
v
w
Macros
_
a
b
c
d
e
f
g
i
l
m
n
o
p
q
r
s
t
u
v
w
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Loading...
Searching...
No Matches
D:
Peridyno
peridyno
src
Core
STL
Set.inl
Go to the documentation of this file.
1
#include "
STLMacro.h
"
2
#include "
Math/SimpleMath.h
"
3
#include <glm/glm.hpp>
4
5
namespace
dyno
6
{
7
template
<
typename
T>
8
DYN_FUNC
Set<T>::Set
()
9
:
STLBuffer
<
T
>()
10
{
11
}
8
DYN_FUNC
Set<T>::Set
() {
…
}
12
13
template
<
typename
T>
14
DYN_FUNC
T
*
Set<T>::find
(
T
val)
15
{
16
int
ind =
leftBound
(val,
m_startLoc
,
m_size
);
17
18
return
ind >=
m_size
||
m_startLoc
[ind] != val ? nullptr :
m_startLoc
+ ind;
19
}
14
DYN_FUNC
T
*
Set<T>::find
(
T
val) {
…
}
20
21
22
template
<
typename
T>
23
DYN_FUNC
T
*
Set<T>::insert
(
T
val)
24
{
25
//return nullptr if the data buffer is full
26
if
(
m_size
>=
m_maxSize
)
return
nullptr
;
27
28
//return the index of the first element that is equal to or greater than val
29
int
ind =
leftBound
(val,
m_startLoc
,
m_size
);
30
31
if
(ind ==
m_size
)
32
{
33
m_startLoc
[ind] = val;
34
m_size
++;
35
36
return
m_startLoc
+ ind;
37
};
38
39
//return the original address if val is found
40
if
(
m_startLoc
[ind] == val)
41
return
m_startLoc
+ ind;
42
else
43
{
44
//if found, move all element backward
45
for
(
size_t
j =
m_size
; j > ind; j--)
46
{
47
m_startLoc
[j] =
m_startLoc
[j - 1];
48
}
49
50
//insert val into location ind.
51
m_startLoc
[ind] = val;
52
m_size
++;
53
54
return
m_startLoc
+ ind;
55
}
56
}
23
DYN_FUNC
T
*
Set<T>::insert
(
T
val) {
…
}
57
58
template
<
typename
T>
59
DYN_FUNC
void
Set<T>::clear
()
60
{
61
m_size
= 0;
62
}
59
DYN_FUNC
void
Set<T>::clear
() {
…
}
63
64
template
<
typename
T>
65
DYN_FUNC
uint
Set<T>::size
()
66
{
67
return
m_size
;
68
}
65
DYN_FUNC
uint
Set<T>::size
() {
…
}
69
70
template
<
typename
T>
71
DYN_FUNC
uint
Set<T>::count
(
T
val)
72
{
73
return
find
(val) ? 1 : 0;
74
}
71
DYN_FUNC
uint
Set<T>::count
(
T
val) {
…
}
75
76
template
<
typename
T>
77
DYN_FUNC
bool
Set<T>::empty
()
78
{
79
return
m_startLoc
==
nullptr
;
80
}
77
DYN_FUNC
bool
Set<T>::empty
() {
…
}
81
}
82
STLMacro.h
SimpleMath.h
dyno::STLBuffer::STLBuffer
DYN_FUNC STLBuffer()
Definition
STLBuffer.h:19
dyno::STLBuffer::m_maxSize
uint m_maxSize
Definition
STLBuffer.h:36
dyno::STLBuffer::m_startLoc
T * m_startLoc
Definition
STLBuffer.h:38
dyno::Set::find
DYN_FUNC T * find(T val)
Definition
Set.inl:14
dyno::Set::count
DYN_FUNC uint count(T val)
Definition
Set.inl:71
dyno::Set::size
DYN_FUNC uint size()
Definition
Set.inl:65
dyno::Set::m_size
uint m_size
Definition
Set.h:47
dyno::Set::Set
DYN_FUNC Set()
Definition
Set.inl:8
dyno::Set::empty
DYN_FUNC bool empty()
Definition
Set.inl:77
dyno::Set::insert
DYN_FUNC T * insert(T val)
Definition
Set.inl:23
dyno::Set::clear
DYN_FUNC void clear()
Definition
Set.inl:59
T
#define T(t)
dyno
This is an implementation of AdditiveCCD based on peridyno.
Definition
Array.h:25
dyno::leftBound
DYN_FUNC int leftBound(T target, T *startLoc, uint maxSize)
Find the left bound of a target with a binary search algorithm.
Definition
STLMacro.h:22
dyno::uint
unsigned int uint
Definition
VkProgram.h:14
Generated by
1.13.2