PeriDyno
0.9.2
Loading...
Searching...
No Matches
peridyno
src
Dynamics
Cuda
ParticleSystem
CubeSampler.cpp
Go to the documentation of this file.
1
#include "
CubeSampler.h
"
2
3
#include "
GLPointVisualModule.h
"
4
5
namespace
dyno
6
{
7
template
<
typename
TDataType>
8
CubeSampler<TDataType>::CubeSampler
()
9
:
Sampler
<
TDataType
>()
10
{
11
this->
varSamplingDistance
()->setRange(0.001, 1.0);
12
}
13
14
template
<
typename
TDataType>
15
void
CubeSampler<TDataType>::resetStates
()
16
{
17
auto
box
= this->
inCube
()->getData();
18
19
Coord
u =
box
.u;
20
Coord
v =
box
.v;
21
Coord
w
=
box
.w;
22
23
Coord
ext
=
box
.extent;
24
Coord
center =
box
.center;
25
26
Real
s = std::max(
Real
(0.001), this->
varSamplingDistance
()->getData());
27
28
int
nx =
ext
[0] / s;
29
int
ny =
ext
[1] / s;
30
int
nz =
ext
[2] / s;
31
32
std::vector<Coord> points;
33
for
(
int
i = -nx; i <= nx; i++)
34
{
35
for
(
int
j = -ny; j <= ny; j++)
36
{
37
for
(
int
k = -nz; k <= nz; k++)
38
{
39
Coord
p
= center + (i * s) * u + (j * s) * v + (k * s) *
w
;
40
points.push_back(
p
);
41
}
42
}
43
}
44
45
auto
ptSet
= this->
statePointSet
()->getDataPtr();
46
47
ptSet
->setPoints(points);
48
49
points.clear();
50
}
51
52
DEFINE_CLASS
(
CubeSampler
);
53
}
CubeSampler.h
GLPointVisualModule.h
DEFINE_CLASS
#define DEFINE_CLASS(name)
Definition
Object.h:140
w
QWindow * w
Definition
QtImGui.cpp:152
Real
double Real
Definition
Typedef.inl:23
dyno::ArrayMap
Definition
ArrayMap.h:25
dyno::CubeSampler
Definition
CubeSampler.h:24
dyno::CubeSampler::resetStates
void resetStates() override
Definition
CubeSampler.cpp:15
dyno::CubeSampler::CubeSampler
CubeSampler()
Definition
CubeSampler.cpp:8
dyno::CubeSampler::Real
TDataType::Real Real
Definition
CubeSampler.h:28
dyno::CubeSampler::Coord
TDataType::Coord Coord
Definition
CubeSampler.h:29
dyno::Sampler
Definition
Sampler.h:27
dyno
This is an implementation of AdditiveCCD based on peridyno.
Definition
Array.h:24
dyno::DArrayMap
ArrayMap< T, DeviceType::GPU > DArrayMap
Definition
ArrayMap.inl:80
Generated by
1.9.8