int main(int argc, char **argv) {
  float a1, a2, da, a;
  int i;

  if (argc < 6) {
    printf("Usage: %s scale1 scale2 Om h halolist1 [halolist2 ...]\n", argv[0]);
    exit(1);
  }

  /* Init cosmology and timescales */
  a1 = atof(argv[1]);
  a2 = atof(argv[2]);
  Om = atof(argv[3]);
  if (!Om) Om = 0.27;
  Ol = 1.0 - Om;
  h0 = atof(argv[4]);
  if (!h0) h0 = 0.705;
  init_cosmology(Om, Ol, h0);
  init_time_table(Om, h0);
  gen_ff_cache();

  num_halos = 0;
  max_mvir = 0;
  for (i=5; i<argc; i++) load_halos(argv[i], a1);
  halo_tree = fast3tree_init(0, 0);

  print_halo(-1);
  da = (a2-a1)/((double)NUM_TIMESTEPS);
  do_timestep(0, a1, a1+da, 1); //First step
  for (i=1; i<NUM_TIMESTEPS; i++) {
    a = a1+i*da;
    do_timestep(a-da, a, a+da, 0);
  }
  do_timestep(a, a+da, 0, -1); //Last step

  //print_halos();
  return 0;
}
Example #2
0
int main() {

    int np = 9; /* number of points on the sheet */
    double dt = .005;
    int step = 0;
    double time = 0.0;
    double *de, *x, *y, *gamma;
    double c[4];
/*     int j; */
/*     double sumg; */
    char fname[30];
    int dump_num = 0;
    double dump_time = 1;
/*     double max; */
/*     double sum; */
/*     FILE *dump; */
/*     double mindist = SQR(.5/np); */
/*     double maxdist = SQR(1.5/np); */


    get_physical_params(c);

    de = vector(np);
    x = vector(np);
    y = vector(np);
    gamma = vector(np);

    init_sheet(de, x, y, gamma, np, 2.0*c[3]);
    
/*     getchar(); */



/*     dump = fopen("max2.dat", "w"); */

    while(1) {
	
	if(time >= dump_time * dump_num) {
	    sprintf(fname, "sheet_%03i.dat", dump_num);
	    dump_data(de, x, y, gamma, np, c, time, dt, fname);
	    dump_num++;
	}

	step++;
	time += dt;

	/*printf("\x1B[2J");*/
/*	printf("****  ");*/
/* 	printf("Step: %5i    Time: %8.5f (%8.5f s)   (dt = %9.4g)\n", */
/* 	       step, time, realtime, dt); */
/*	printf("  *****\n");*/

/* 	printf("Gamma before step:\t%f\n", integral(gamma,de,np)-1.0); */
	dt = do_timestep(de, &x, &y, &gamma, c, np, dt);

/* 	printf("Gamma before trim:\t%f\n", integral(gamma,de,np)-1.0); */
/* 	np = trim_distances(&de, &x, &y, &gamma, mindist, maxdist, np); */
/* 	printf("Gamma after (%i):\t%f\n\n", np,integral(gamma,de,np)-1.0); */

/* 	printf("Smooth x: "); */
/* 	fourier_smooth(x, np); */
/* 	printf("Smooth y: "); */
/* 	fourier_smooth(y, np); */

/* 	sum = integral(gamma,de,np)-1.0; */
/* 	if(fabs(sum) > 1e-12) { */
/* 	    printf("Step: %i   Gamma: %e\n", step, sum); */
/* 	    getchar(); */
/* 	} */
/* 	getchar(); */
/* 	sumg = 0.0; */
/* 	for(j = 0; j < np; j++) */
/* 	    sumg += gamma[j]*de[j]; */

/* 	printf("np: %3i\nSum g: %9.5e\n", np, sumg-1); */

/* 	max = dump_data(x, y, gamma, np, "sheet2.dat"); */
/* 	fprintf(dump, "%f\t%f\n", realtime, max); */
/* 	getchar(); */
 	
    }
/*     fclose(dump); */

    return 0;
}