Esempio n. 1
0
void iterate(void) {
  integrate_particles();
  t += dt;
  check_boundaries();
  //printf("t = %f\n", t);
  display();

  collisions_search();
  collisions_resolve();
  problem_inloop();
  problem_output();
  while(t >= tmax && tmax != 0.0) {
    problem_finish();
    exit(0);
  }
}
Esempio n. 2
0
File: main.c Progetto: ridlo/sphiral
void iterate(){    
    // Main Loop
        
    // A 'DKD'-like integrator will do the first 'D' part
    integrator_part1();
    
    // Check for root crossings
    boundaries_check();
    
    // Update acceleration
    // gravity, pressure, artificial viscosity, external
    force_calc_acceleration();
    
    // Other input additional force
    // if(problem_additional_forces) problem_additional_forces();

    // Other input additional inloop-problem
    problem_inloop();
    
    // move particle
    integrator_part2();

    // Check for root crossings again
    // boundaries_check();
    // boundaries_collision();
    
    count_step++;
    
    // output from iteration
    problem_output();
    
    if ((t>=tmax && tmax != 0.0) || exit_simulation == 1){
        problem_finish();
        struct timeval tim;
        gettimeofday(&tim, NULL);
        double timing_final = tim.tv_sec+(tim.tv_usec/1000000.0);
        printf("\nComputation finished. Total runtime: %f s\n", timing_final - timing_initial);

        exit(0);
    }

}