#include <stdio.h>
#include <string.h>
#include "../common/progress.h"
using namespace af;
static void vortex(bool console)
{
double time_total = 10;
unsigned particles = 10000;
float revolutions = 5.0;
float xAx = 0.7f;
float yAx = 0.3f;
float zD = -0.0025f;
float zero = 0;
unsigned iter = 0;
while (progress(iter, t, time_total)) {
Z = Z + zD;
array TEMP = T + 2 *
af::Pi * revolutions * .00025 * (iter++);
X = xAx * Z *
cos(TEMP) + 0.5;
Y = yAx * Z *
sin(TEMP) + 0.5;
if (!console)
plot3(X, Z, Y);
}
}
int main(int argc, char* argv[])
{
int device = argc > 1 ? atoi(argv[1]) : 0;
bool console = argc > 2 ? argv[2][0] == '-' : false;
try {
printf("simulation of a vortex of particles\n");
vortex(console);
fprintf(stderr,
"%s\n", e.
what());
throw;
}
#ifdef WIN32 // pause in Windows
if (!console) {
printf("hit [enter]...");
fflush(stdout);
getchar();
}
#endif
return 0;
}