/*--------------------------------------------------------------------*/
int main(int argc, char **argv) {
/*--------------------------------------------------------------------*/
  double cpu1;

  MPI_Init(&argc,&argv); /* Initialize the MPI environment */
  MPI_Comm_rank(MPI_COMM_WORLD, &sid);  /* My processor ID */
  /* Vector index of this processor */
  vid[0] = sid/(vproc[1]*vproc[2]);
  vid[1] = (sid/vproc[2])%vproc[1];
  vid[2] = sid%vproc[2];

  init_params();
  set_topology(); 
  init_conf();
  atom_copy();
  compute_accel(); /* Computes initial accelerations */ 

  cpu1 = MPI_Wtime();
  for (stepCount=1; stepCount<=StepLimit; stepCount++) {
    single_step(); 
    if (stepCount%StepAvg == 0) eval_props();
  }
  cpu = MPI_Wtime() - cpu1;
  if (sid == 0) printf("CPU & COMT = %le %le\n",cpu,comt);

  MPI_Finalize(); /* Clean up the MPI environment */
}
Beispiel #2
0
/* construcorul clasei 'Rubik' care creeaza un nou cub rubik */
Rubik::Rubik() {
	cs = new CoordinateSystem3d();
	WorldDrawer3d::cs_used.push_back(cs);
	layers.resize(MOVING_LAYERS);
	faces.resize(MOVING_LAYERS);
	rubik.resize(3*MOVING_LAYERS);
	colors.resize(6);

	set_points();
	set_topology();
	set_layers();
	
	draw_faces();

	int count = 0;
	for (int i = -1; i <= 1; i++) {
		for (int j = -1; j <= 1; j++) {
			for (int k = -1; k <= 1; k++) {
				Object3d *o;
				o = new Object3d(points, topology);
				o->setcolor(0,0,0);
				o->color = -1;
				rubik[count].push_back(o);

				for (int l = 0; l < rubik[count].size(); l++) {
					rubik[count][l]->translate(4.5*i, 4.5*j, 4.5*k);
					cs->objectAdd(rubik[count][l]);
				}
				count++;
			}
		}
	}
}