Main Page   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

multiscatter_MPI.C

Go to the documentation of this file.
00001 
00002 #include "sigma_MPI.h"
00003 
00004 void initialize_processors(int nproc, int debug){}      // Dummy functions
00005 void terminate_processors(int debug){}
00006 
00007 // multiscatter:  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 
00012 local void pp(sdyn* b, ostream & s, int level = 0) {
00013 
00014     s.precision(4);
00015 
00016     for (int i = 0; i < 2*level; i++) s << " ";
00017 
00018     if(b != b->get_root()) {
00019       b->pretty_print_node(s);
00020       s << " \t"<< b->get_mass() << " \t"
00021                 << b->get_pos() << " (r= " << abs(b->get_pos()) << ")   " 
00022                 << b->get_vel() << " (v= " << abs(b->get_vel()) << ")" << endl;
00023       //        << "r= " << abs(b->get_pos()) << "    " 
00024       //        << "v= " << abs(b->get_vel()) << endl;
00025     }
00026 
00027     for (sdyn * daughter = b->get_oldest_daughter();
00028          daughter != NULL;
00029          daughter = daughter->get_younger_sister())
00030         pp(daughter, s, level + 1);     
00031 }
00032 
00033 // Adjusted for n-body scattering experiments.
00034 
00035 int  multiscatter(sigma_out &out, 
00036                   sigma_input &input, 
00037                   MPI_Datatype inputtype,
00038                   scatter_exp &experiment, 
00039                   MPI_Datatype scatter_exp_type,
00040                   real &cpu_save, int& scatt_total, real& cpu_total) { 
00041 
00042 
00043   real eta = input.eta;
00044   real delta_t = input.delta_t;
00045   real dt_out = input.dt_out;
00046   real dt_snap = input.dt_snap;
00047   real ttf = input.tidal_tol_factor;
00048   real snap_cube_size = input.snap_cube_size;
00049   real cpu_time_check = input.cpu_time_check;  
00050   int debug = input.debug;
00051   int scatter_summary_flag = false;
00052 
00053   int total_hits = 0;
00054 
00055   int single_result = 0;
00056 
00057   real cpu_init = 0;
00058   total_hits += master_process(out, input, inputtype,
00059                                experiment, scatter_exp_type);
00060 
00061   cpu_total += cpu_time() - cpu_init;
00062 
00063   scatt_total++;
00064 
00065         // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00066 
00067         // Hand-holding: check the CPU time.  Note that the printed
00068         // CPU time is the time since this routine was entered.
00069 
00070   //      real cpu_init = 0;
00071         if (cpu_time() - cpu_save > cpu_time_check) {
00072             cpu_save = cpu_time();
00073             cerr << "\nsigma:  CPU time = " << cpu_save - cpu_init
00074                  << ",  " << out.total_trials + 1 << " trials,  "
00075                  << out.n_hit_tot + single_result
00076                  << " hits,  i_max = " << out.i_max
00077                  << endl << flush;
00078         }
00079 
00080         if (abs(input.debug) > 2) {
00081             cerr.precision(6);
00082             cerr << "single_scatter: rho_max^2 = " << input.rho_sq_max
00083                  << " ; returning with n_hit = " << single_result
00084                  << " and n_hit_tot = " << out.n_hit_tot + single_result
00085                  << endl;
00086         }
00087 
00088         // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00089 
00090         // Accumulate statistics on the results.
00091         //      single_scatter_stats(&experiment, out); //, acc_stats);
00092 
00093     return total_hits;
00094 
00095 }
00096 
00097 
00098 

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