Main Page   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

sigma.h

Go to the documentation of this file.
00001        //=======================================================//    _\|/_
00002       //  __  _____           ___                    ___       //      /|\
00003      //  /      |      ^     |   \  |         ^     |   \     //          _\|/_
00004     //   \__    |     / \    |___/  |        / \    |___/    //            /|\
00005    //       \   |    /___\   |  \   |       /___\   |   \   // _\|/_
00006   //     ___/   |   /     \  |   \  |____  /     \  |___/  //   /|\     
00007  //                                                       //            _\|/_
00008 //=======================================================//              /|\
00009 
00010 /*
00011  *  sigma.h: definitions for determining cross sections
00012  *.............................................................................
00013  *    version 1:  March 1994   Piet Hut & Steve McMillan
00014  *    version 2:
00015  *.............................................................................
00016  *     This file includes:
00017  *  1) definition of state structures
00018  *       ....
00019  *.............................................................................
00020  */
00021 
00022 #ifndef  STARLAB_SIGMAN_H
00023 #  define  STARLAB_SIGMAN_H
00024 
00025 #include  "scatter.h"
00026 
00027 #define USE_specific_function
00028 #undef USE_specific_function
00029 
00030 #define ECC_TOL 2         // Factor by which initial binary periastron must
00031                           // exceed the sum of the component radii. 
00032 
00033 #define RHO_SQ_SCALE 0.5  // Inner disk of radius 1 will be uniformly sampled
00034 #define RHO_SQ_FACTOR 2   // Each new zone doubles the total area
00035 
00036 #define N_STEP_BIN 10     // Number of time-step bins
00037 #define N_OSC_BIN 15      // Number of oscillation bins
00038 
00039 // Structure describing the result of a series of scattering experiments:
00040 
00041 class sigma_input : public scatter_input {
00042   public:
00043 
00044   real  rho_sq_min;
00045   real  rho_sq_max;
00046   real  peri;
00047   real  pmass;
00048   real  tmass;
00049   real  max_trial_density;
00050   real  v_inf;
00051 
00052   //  int print_counts = FALSE;
00053   //  int intermediate_sigma = TRUE;
00054 
00055   sigma_input() : scatter_input() {
00056     v_inf = 1;
00057     rho_sq_min = rho_sq_max = -1;
00058     peri = -1;
00059     pmass = 0;
00060     tmass = 1;
00061     max_trial_density = 1;
00062   }
00063 
00064   friend ostream& operator<<(ostream& s, scatter_input&);
00065 #ifdef USE_MPI
00066   MPI_Datatype sigma_input::initialize_data_structures_MPI();
00067 #else
00068   MPI_Datatype sigma_input::initialize_data_structures_MPI() {
00069     MPI_Datatype dummy;
00070     return dummy;
00071 }
00072 #endif
00073 };
00074 
00075 typedef struct {
00076 
00077     // history
00078     scatter_hist *hi;
00079 
00080     // Binning:
00081     real rho_sq_init;           // squared radius of innermost rho zone
00082     real central_trial_density; // current density of trials in innermost zone
00083     int n_zone;                
00084 
00085 
00086     // Safety zone quantities:
00087 
00088     int  n_hit_tot;             // total number of hits
00089     int  n_hit[N_RHO_ZONE_MAX]; // number of hits per rho^2 zone
00090     int  i_max;                 // i value of the (empty) top zone
00091 
00092     // Diagnostics:
00093 
00094     int  total_trials;
00095     int  total_steps;
00096     int  max_steps;
00097 
00098     int  step_counter[N_STEP_BIN];
00099     int  osc_counter[N_OSC_BIN];
00100 
00101     // "Real" quantities of interest:
00102 
00103     real rho_max;               // maximum impact parameter (from i_max)
00104     int  trials_per_zone;
00105 
00106     int  n_hits[number_of_scatter_discriptors][N_RHO_ZONE_MAX]; 
00107     real sigma[number_of_scatter_discriptors];         
00108     real sigma_err_sq[number_of_scatter_discriptors]; 
00109 
00110     real sigma_total;
00111     real sigma_total_err_sq;
00112 
00113 } sigma_out;
00114 
00115 //-----------------------------------------------------------------------------
00116 
00117 #if 0
00118 
00119 // Standard framework for determining cross-sections:
00120 
00121 typedef  int  (*trial_fp)(initial_state3 &,
00122                           intermediate_state3 &,
00123                           final_state3 &,
00124                           real, real, real);
00125 typedef  void (*stat_fp)(scatter_profile &,
00126                          initial_state3 &,
00127                          intermediate_state3 &,
00128                          final_state3 &,
00129                          int,
00130                          sigma_out &);
00131 typedef  void (*print_fp)(real, sigma_out &, int);
00132 
00133 #endif
00134 
00135 void get_sigma(sigma_input &input, MPI_Datatype inputtype,
00136                scatter_exp &experiment, MPI_Datatype scatter_exp_type);
00137 #if 0
00138 void get_sigma(real max_dens, scatter_profile &, sigma_out &,
00139                real eta, real delta_t, real dt_out, 
00140                int debug=0, real cpu_time_check = VERY_LARGE_NUMBER,
00141                real dt_snap=VERY_LARGE_NUMBER, real snap_cube_size =0,
00142                int scatter_summary_level=0);
00143 #endif
00144 #if 0
00145 
00146 void get_sigma3(real, scatter_profile &, sigma_out &,
00147                 int, real, real, real, int,
00148                 trial_fp);
00149 void get_sigma3(real, scatter_profile &, sigma_out &,
00150                 int, real, real, real, int,
00151                 stat_fp);
00152 void get_sigma3(real, scatter_profile &, sigma_out &,
00153                 int, real, real, real, int,
00154                 print_fp);
00155 void get_sigma3(real, scatter_profile &, sigma_out &,
00156                 int, real, real, real, int,
00157                 trial_fp, stat_fp);
00158 void get_sigma3(real, scatter_profile &, sigma_out &,
00159                 int, real, real, real, int,
00160                 trial_fp, stat_fp, print_fp);
00161 #endif
00162 
00163 // Helpers:
00164 
00165 real zone_area(sigma_out&, int);
00166 real zone_density(sigma_out&, int);
00167 real zone_weight(sigma_out& out, scatter_exp* hi, int i);
00168                                         // (weight = 1/density, in fact)
00169 
00170 void print_profile(ostream&, scatter_profile&, int prec = 6);
00171 void make_standard_profile(scatter_profile &); // Set up a template profile
00172 //void prof_to_init(scatter_profile &, initial_state3 &);
00173 
00174 int  n_coll(sigma_out);
00175 
00176 void counts_to_sigma(sigma_out &);
00177 void print_all_sigma_counts(sigma_out &, ostream& s = cerr);
00178 void print_sigma(sigma_out &, real);
00179 void print_sigma_counts(sigma_out &);
00180 int specific_counts(scatter_exp *hi, scatter_discriptor discription);
00181 
00182 
00183 void print_sigma_array(sigma_out, real, int sqrt_flag = 0);
00184 void print_sigma_nonmergers(sigma_out, real);
00185 void print_sigma_mergers(sigma_out out, real);
00186 //void print_sigma_err_array(real[][N_FINAL], real);
00187 
00188 // For use in sigma3, rate3, etc:
00189 
00190 void summarize_scattering_initial(scatter_profile & prof,
00191                                   int n_rand,
00192                                   real dt_snap,
00193                                   real snap_cube_size);
00194 
00195 void summarize_scattering_final(scatter_exp exp,
00196                                 int level,
00197                                 real cpu);
00198 
00199 
00200 void single_scatter_init(sdyn *b, scatter_profile & prof,
00201                          real rho_sq_min, real rho_sq_max,
00202                          int & n_rand,
00203                          int scatter_summary,
00204                          real dt_snap, real snap_cube_size);
00205 
00206 int single_scatter(sdyn* b, scatter_input input, 
00207                    scatter_exp &experiment);
00208 
00209 int single_scatter(sdyn *b,
00210                    scatter_exp &experiment,
00211                    real eta, real delta_t, real dt_out,
00212                    real cpu_time_check,
00213                    real dt_snap,
00214                    real ttf,
00215                    real snap_cube_size,
00216                    int debug);
00217 
00218 
00219 void single_scatter_stats(scatter_exp* exp,
00220                           sigma_out & out);
00221 
00222 #if 0
00223 void single_scatter_stats(scatter_profile & prof,
00224                           scatter_exp* exp,
00225                           int rho_bin_index,
00226                           sigma_out & out,
00227                           //                      stat_fp acc_stats,
00228                           int result);
00229 #endif
00230 
00231 int  multiscatter(sigma_out &out, 
00232                   sigma_input &input, 
00233                   MPI_Datatype inputtype,
00234                   scatter_exp &experiment, 
00235                   MPI_Datatype scatter_exp_type,
00236                   real &cpu_save, int& scatt_total, real& cpu_total);
00237 
00238 int multiscatter(scatter_profile & prof, sigma_out & out,
00239                  //              real rho_sq_min, real rho_sq_max, 
00240                  real eta, real delta_t, real dt_out,
00241                  real dt_snap, real ttf, real snap_cube_size,
00242                  real cpu_time_check, real cpu_init, real &cpu_save,
00243                  int& scatt_total, real& cpu_total, 
00244                  // stat_fp acc_stats,
00245                  int debug, int scatter_summary_flag);
00246 
00247 sdyn* mkscat(int, char**, sigma_input&);
00248 sdyn* mkscat(char*,  sigma_input &input);
00249 
00250 // see in specific_function.C
00251 void print_scatter_specific_information(sdyn *b,
00252                                         sigma_input input, 
00253                                         scatter_exp experiment);
00254 
00255 #endif
00256 
00257 

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