Game Development Reference
In-Depth Information
7.3 Data Management without Duplication
The motion of particles causes a flow of particles between subdomains; some
particles go to and some particles come from an adjacent subdomain. The ghost
particles at a time step can change dynamically, so efficient management of parti-
cles is necessary.
As discussed above, we have employed peer-to-peer-typemanagement of par-
ticle data. Although we chose it, there are still several other choices for how to
manage data. The easiest way is as follows: each processor has the data of all
the particles (using the same index for each particle) and updates the data of the
particles belonging to its particular subdomain. However, this is not memory effi-
cient, because all the processors have to have all the particle data. In the following
subsections, we are going to describe a method in which a processor only keeps
the data of particles in its own subdomain. Therefore, there is no processor that
holds the data of all the particles.
7.3.1 Sending Data
As discussed above, data from a neighboring processor is necessary for the com-
putation of particles at a boundary of a subdomain. Also, particles that move
out of a subdomain have to be passed to an adjacent processor. Therefore, the
particles that have to be sent to an adjacent processor are the particles that move
from their subdomain to an adjacent subdomain and also the ghost particles in
the subdomain. Let x i be the x -coordinate of particle i at time t calculated by
processor p 0 , which calculates subdomain C 0 . Particle i is in the subdomain of
p 0 if x i <m . The particles that move out from C 0 to C 1 are
EP t t
0
m<x t t
i
,x i
1 =
{
i
|
m
}
.
(7.1)
The ghost particles of p 1 in the subdomain of C 0 that come from p 0 are
GP t t
0 1
g<x t t
i
m, x i
=
{
i
|
m
m
}
.
(7.2)
C 0
G 0→1
t+∆t
GP 0→1
EP 0→1
t+∆t
Figure 7.3. Particles sent from p 0 to p 1 .