Example #1
0
int main(int argc, char ** argv)
{
  // Init FlowVR environment :
  if (SetupFlowVR() != 0)
    return -1;

  // Set up data structures and variables :
  primeNumbersMaxCount = 1000000;
  tPrimeNumbers = new unsigned int[primeNumbersMaxCount];
  tPrimesCoordinatesOnSpiral = new float [primeNumbersMaxCount*2]; // Coordinates are stored by pairs
  primeNumbersCount = 0;
  greatestPrimeNumber = 0;
  pKeysPressed = 0;
  keysPressedCount = 0;
  lastIterationComputeTime = -1;
  iterationCounterComputes = iterationCounterVisu = iterationCounterCapture = 0;

  // Initialize GLUT :
  glutInit(&argc, argv);
  OpenGlutWindow(150, 10, 800, 600);

  // Main execution loop :
  glutMainLoop();

  return 0;
}
Example #2
0
int main(int argc, char ** argv)
{
	glutInit(&argc, argv);

	if (argc != 1 && argc != 6) {
		fprintf(stderr, "usage : %s N dt diff visc force source\n", argv[0]);
		fprintf(stderr, "where:\n"); \
			fprintf(stderr, "\t N      : grid resolution\n");
		fprintf(stderr, "\t dt     : time step\n");
		fprintf(stderr, "\t diff   : diffusion rate of the density\n");
		fprintf(stderr, "\t visc   : viscosity of the fluid\n");
		fprintf(stderr, "\t force  : scales the mouse movement that generate a force\n");
		fprintf(stderr, "\t source : amount of density that will be deposited\n");
		exit(1);
	}

	if (argc == 1) {
		N = 64;
		dt = 0.1f;
		diff = 0.0001f;
		visc = 0.0f;
		force = 5.0f;
		source = 100.0f;
		fprintf(stderr, "Using defaults : N=%d dt=%g diff=%g visc=%g force = %g source=%g\n",
			N, dt, diff, visc, force, source);
	}
	else {
		N = atoi(argv[1]);
		dt = atof(argv[2]);
		diff = atof(argv[3]);
		visc = atof(argv[4]);
		force = atof(argv[5]);
		source = atof(argv[6]);
	}

	printf("\n\nHow to use this demo:\n\n");
	printf("\t Add densities with the right mouse button\n");
	printf("\t Add velocities with the left mouse button and dragging the mouse\n");
	printf("\t Toggle density/velocity display with the 'v' key\n");
	printf("\t Toggle retro mode by pressing the 'p' key\n");
	printf("\t Clear the simulation by pressing the 'c' key\n");
	printf("\t Quit by pressing the 'q' key\n");

	dvel = false;
	pixel = false;
	
	solver.Init(N, dt, diff, visc);

	if (!solver.AllocateData()) exit(1);

	win_x = 512;
	win_y = 512;
	OpenGlutWindow();

	glutMainLoop();

	exit(0);
}
Example #3
0
int main(int argc, char ** argv)
{

  srand(time(NULL));

  // Init FlowVR environment :
  if (SetupFlowVR() != 0)
    return -1;

  // Set up data structures and variables :
  primeNumbersMaxCount = 1000000;
  tPrimeNumbers = new unsigned int[primeNumbersMaxCount];
  tPrimesCoordinatesOnSpiral = new float [primeNumbersMaxCount*2]; // Coordinates are stored by pairs
  primeNumbersCount = 0;
  greatestPrimeNumber = 0;
  pKeysPressed = 0;
  keysPressedCount = 0;
  lastIterationComputeTime = -1;
  iterationCounterComputes = iterationCounterVisu = iterationCounterCapture = 0;
  previousNbPositions = 0;
  ox = 5.0;
  oy = 5.0;
  oz = 0.0;
  dx = 790.0;
  dy = 590.0;
  dz = 500.0;
  cx = ox + dx / 2.0;
  cy = oy + dy / 2.0;
  cz = oz + dz / 2.0;


  // Initialize GLUT :
  glutInit(&argc, argv);
  OpenGlutWindow(150, 10, 800, 600);

  // Main execution loop :
  glutMainLoop();

  return 0;
}
Example #4
0
int main(int argc, char **argv)
{
	glutInit(&argc, argv);

	if (argc != 1 && argc != 8)
	{
		fprintf(stderr, "usage : %s GridSize Dt Diff Visc Force Source\n", argv[0]);
		fprintf(stderr, "where:\n");
		fprintf(stderr, "\t GridSize : Grid width/height\n");
		fprintf(stderr, "\t Dt       : Time step\n");
		fprintf(stderr, "\t Diff     : Diffusion rate of the density\n");
		fprintf(stderr, "\t Visc     : Viscosity of the fluid\n");
		fprintf(stderr, "\t Force    : Scales the mouse movement that generate a force\n");
		fprintf(stderr, "\t Source   : Amount of density that will be deposited\n");
		fprintf(stderr, "\t Temp     : The temperature of the fluid\n");
		exit(1);
	}

	InitValues();

	if (argc == 1)
	{
		fprintf(stderr, "Using defaults : GridSize=%d Dt=%g Diff=%g Visc=%g Force=%g Source=%g Temp=%g\n",
					  GridSize, Dt, Diff, Visc, Force, Source, Temp);
	}
	else
	{
		GridSize = atoi(argv[1]);
		TotalGridCells = GridSize * GridSize;
		Dt = atof(argv[2]);
		Diff = atof(argv[3]);
		Visc = atof(argv[4]);
		Force = atof(argv[5]);
		Source = atof(argv[6]);
		Temp = atof(argv[7]);
	}

	printf("\n\nHow to use this demo:\n\n");
	printf("\t Add density and temperature with the right mouse button\n");
	printf("\t Change color of density being by toggling the r, g, and b keys\n");
	printf("\t Add velocities with the left mouse button and dragging the mouse\n");
	printf("\t Toggle density/velocity display with the 'v' key\n");
	printf("\t Clear the simulation by pressing the 'c' key\n");
	printf("\t Quit by pressing the 'q' key\n");
	fflush(stdout);

	if (!AllocateData())
	{
		exit(1);
	}

	ClearData();

	WinX = 512;
	WinY = 512;
	OpenGlutWindow();

	glutMainLoop();

	exit(0);
}