Main Page   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

multiscatter3.C

Go to the documentation of this file.
00001 
00002 #include "sigma3.h"
00003 
00004 void initialize_processors(int nproc, int debug){}      // Dummy functions
00005 void terminate_processors(int debug){}
00006 
00007 // multiscatter3: Perform a specified number of scattering experiments
00008 //                in a given impact parameter range, accumulating statistics
00009 //                as we go.  Return the total number of hits in this range.
00010 
00011 int multiscatter3(scatter_profile & prof, sigma_out & out,
00012                   real rho_sq_min, real rho_sq_max, int rho_zone,
00013                   real dt_snap, real snap_cube_size,
00014                   real cpu_time_check, real cpu_init, real &cpu_save,
00015                   int& scatt_total, real& cpu_total, stat_fp acc_stats,
00016                   int debug, int scatter_summary_flag)
00017 {
00018     int total_hits = 0;
00019 
00020     for (int trial = 0; trial < out.trials_per_zone; trial++) {
00021         
00022         int scatter_summary = scatter_summary_flag;
00023 
00024         // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00025 
00026         // Get the next scattering.
00027 
00028         // The function single_scatter_init will randomize the angles
00029         // in the same way as the standalone tool scatter3.  Save the
00030         // random counter n_rand in case we want a one-line summary below.
00031 
00032         initial_state3 init;
00033         int n_rand;
00034 
00035         single_scatter_init(prof, rho_sq_min, rho_sq_max, init, n_rand,
00036                             scatter_summary_flag, dt_snap, snap_cube_size);
00037 
00038         // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00039 
00040         // Perform the scattering, keeping track of the outcome.
00041 
00042         intermediate_state3 inter;
00043         final_state3 final;
00044 
00045         real cpu_scatter = cpu_time();
00046         int single_result = single_scatter(init, inter, final,
00047                                            cpu_time_check,
00048                                            dt_snap, snap_cube_size);
00049         total_hits += single_result;
00050         cpu_scatter = cpu_time() - cpu_scatter;
00051 
00052         scatt_total++;
00053         cpu_total += cpu_scatter;
00054 
00055         // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00056 
00057         // Hand-holding: check the CPU time.  Note that the printed
00058         // CPU time is the time since this routine was entered.
00059 
00060         if (cpu_time() - cpu_save > cpu_time_check) {
00061             cpu_save = cpu_time();
00062             cerr << "\nsigma3:  CPU time = " << cpu_save - cpu_init
00063                  << ",  " << out.total_trials + 1 << " trials,  "
00064                  << out.n_hit_tot + single_result
00065                  << " hits,  i_max = " << out.i_max
00066                  << endl << flush;
00067         }
00068 
00069         if (abs(debug) > 2) {
00070             int p = cerr.precision(STD_PRECISION);
00071             cerr << "single_scatter: rho_max^2 = " << rho_sq_max
00072                  << " ; returning with n_hit = " << single_result
00073                  << " and n_hit_tot = " << out.n_hit_tot + single_result
00074                  << endl;
00075             cerr.precision(p);
00076         }
00077 
00078         if (final.descriptor == error) {
00079             if (scatter_summary == 0)
00080                 summarize_scattering_initial(init, n_rand,
00081                                              dt_snap, snap_cube_size);
00082             scatter_summary = 2;
00083         }
00084 
00085         if (scatter_summary > 0)
00086             summarize_scattering_final(inter, final,
00087                                        scatter_summary, cpu_scatter);
00088 
00089         // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00090 
00091         // Accumulate statistics on the results.
00092 
00093         single_scatter_stats(prof, init, inter, final, rho_zone,
00094                              out, acc_stats, single_result);
00095     }
00096 
00097     return total_hits;
00098 
00099 }
00100 

Generated at Sun Feb 24 09:57:10 2002 for STARLAB by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001