You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<li>For each of the particles that belong to my chare: change its <i>x</i> and <i>y</i> coordinate by a small random amount.</li>
59
-
<li>Move all the particles that do not belong to a chare's bounding box to their correct homes. Since the movement is small, this will mean communication to the eight near neighbor chares. Some of these messages may contain no particles.</li>
58
+
<li>For each of the particles that belong to my chare: change its <i>x</i> and <i>y</i> coordinate by a small random amount.
59
+
If this change causes the particle to move to an invalid coordinate, keep the particle in its original position.</li>
60
+
<li>Move all the particles that do not belong to a chare's bounding box to their correct homes.
61
+
Since the movement is small, this will mean communication to the eight near neighbor chares. Some of these messages may contain no particles.
62
+
For both efficiency and ease of implementation, all communication with neighbor chares should happen at the end of an iteration rather than after each particle.</li>
60
63
<li><code>if(iteration%10 == 0)</code></li>
61
64
<ul>
62
65
<li>Do reductions to calculate average and max number of particles</li>
63
66
</ul>
64
67
</ul>
65
68
<code>}</code>
69
+
</ul>
70
+
71
+
<p><u>Instructor's Note</u>: This exercise can be implemented in several ways, feel free to choose from the variations below or create your own based on your learning objectives:</p>
72
+
<ul>
73
+
<li>Choose to move the particle along either the <i>x</i><i>or</i><i>y</i> axis using an additional random variable, which simplifies communication as there are now only four neighbor chares.</li>
74
+
<li>If a movement causes a particle to move to an invalid coordinate, move in the opposite direction instead.</li>
0 commit comments