00001
00005
00006
00007
00008
00009
00010
00011
00012 #include "stdinc.h"
00013 #include "sdyn.h"
00014 #include "string.h"
00015 #ifdef USE_MPI
00016 #include "mpi++.h"
00017 #else
00018 #include "localmpi++.h"
00019 #endif
00020
00021
00022
00023
00024 #ifndef _SCATTER_EXP
00025 # define _SCATTER_EXP
00026
00027 #define N_RHO_ZONE_MAX 20 // Number of scatter annuli
00028 #define N_STEP_BIN 10 // Number of time-step bins
00029 #define N_OSC_BIN 15 // Number of oscillation bins
00030
00031 #if 0
00032 enum scatter_discriptor {preservation=0,
00033 exchange, ionization, collision,
00034 single, binary, triple,
00035 unknown, error, stopped,
00036 number_of_scatter_discriptors};
00037 #endif
00038
00039 enum scatter_discriptor {preservation=0,
00040 exchange, exchange_ionization,
00041 single_ionization, multiple_ionization,
00042 total_ionization,
00043 collision_binary, collision_ionization,
00044 stable_triple, stable_higher_order,
00045 two_body_collision, multiple_body_collision,
00046 unknown, error, stopped,
00047 not_specified,
00048 number_of_scatter_discriptors};
00049
00050 #if 0
00051 struct scatter_experiment_summary {
00052
00053 char final_form[255];
00054 real energy_error;
00055 scatter_discriptor sd;
00056 int stop;
00057 int final_bound;
00058 int n_changes;
00059 };
00060 #endif
00061
00062 class scatter_exp {
00063 protected:
00064
00065 char initial_form[255];
00066 char final_form[255];
00067
00068 real time;
00069 real energy_error;
00070 real sigma;
00071 real sigma_err_sq;
00072
00073 scatter_discriptor sd;
00074
00075 int n_star;
00076 int n_steps;
00077 int form_changes;
00078
00079 int n_found;
00080 int id_scenario;
00081
00082 int n_zone;
00083 int n_hits[N_RHO_ZONE_MAX];
00084 int n_hit[N_RHO_ZONE_MAX];
00085
00086 int step_counter[N_STEP_BIN];
00087 int osc_counter[N_OSC_BIN];
00088
00089 int n_initial;
00090 int n_final;
00091 int n_coll;
00092
00093 int final_bound;
00094 int resonance;
00095 int stop;
00096
00097 #if 0
00098 bool final_bound;
00099 bool resonance;
00100 bool stop;
00101 #endif
00102
00103 public:
00104 scatter_exp() {
00105 initialize_to_zero();
00106 }
00107 scatter_exp(const scatter_exp &exp) {
00108
00109 time = exp.time;
00110 final_bound = exp.final_bound;
00111 n_coll = exp.n_coll;
00112 sd = exp.sd;
00113 n_star = exp.n_star;
00114 n_zone = exp.n_zone;
00115 energy_error = exp.energy_error;
00116 form_changes = exp.form_changes;
00117 resonance = exp.resonance;
00118 stop = exp.stop;
00119 int i;
00120 for(i=0; i< N_OSC_BIN; i++)
00121 osc_counter[i] = exp.osc_counter[i];
00122 for(i=0; i< N_STEP_BIN; i++)
00123 step_counter[i] = exp.step_counter[i];
00124
00125 for(i=0; i< N_RHO_ZONE_MAX; i++) {
00126 n_hits[i] = exp.n_hits[i];
00127 n_hit[i] = exp.n_hit[i];
00128 }
00129
00130
00131 strcpy(&initial_form[0], &exp.initial_form[0]);
00132
00133 strcpy(&final_form[0], &exp.final_form[0]);
00134 n_initial = exp.n_initial;
00135 n_final = exp.n_final;
00136 id_scenario = exp.id_scenario;
00137 n_found = exp.n_found;
00138 sigma_err_sq = exp.sigma_err_sq;
00139 sigma = exp.sigma;
00140 }
00141 scatter_exp(istream &s) {
00142 initialize_to_zero();
00143
00144 int id;
00145
00146
00147
00148 char iform[255];
00149 char fform[255];
00150 s >> id >> iform >> fform;
00151
00152 set_id_scenario(id);
00153 set_final_form(fform);
00154 set_initial_form(iform);
00155 }
00156
00157 ~scatter_exp() {
00158
00159
00160 }
00161
00162 void initialize_to_zero();
00163
00164 void set_nstar(int n) {n_star = n;}
00165 int get_nstar() {return n_star;}
00166 int get_n_found() {return n_found;}
00167 void set_n_found(int nf) {n_found = nf;}
00168 void inc_n_found() {n_found++;}
00169 int get_id_scenario() {return id_scenario;}
00170 void set_id_scenario(int id) { id_scenario = id;}
00171
00172 void set_n_coll(int n) {n_coll = n;}
00173 int get_n_coll() {return n_coll;}
00174
00175 void set_final_bound(bool fb) {final_bound = fb;}
00176 bool get_final_bound() {return final_bound;}
00177
00178 char *get_initial_form() {return &initial_form[0];}
00179 void set_initial_form(char *nf) {strcpy(&initial_form[0], nf);}
00180 char *get_final_form() {return final_form;}
00181 void set_final_form(char *nf) {strcpy(&final_form[0], nf);}
00182 int get_n_initial() {return n_initial;}
00183 void set_n_initial(int n) {n_initial = n;}
00184 int get_n_final() {return n_final;}
00185 void set_n_final(int n) {n_final = n;}
00186 void set_nzone(int z) {n_zone = z;}
00187 int get_nzone() {return n_zone;}
00188
00189 real get_time() {return time;}
00190 real *get_time_ptr() {return &time;}
00191 void set_energy_error(real e) {energy_error = e;}
00192 real get_energy_error() {return energy_error;}
00193
00194 void set_n_steps(int n) {n_steps = n;}
00195 int get_n_steps() {return n_steps;}
00196 int get_form_changes() {return form_changes;}
00197 void inc_form_changes() {form_changes++;}
00198
00199
00200 void set_scatter_discriptor(scatter_discriptor s) {sd = s;}
00201 scatter_discriptor get_scatter_discriptor() {return sd;}
00202 scatter_discriptor *get_scatter_discriptor_ptr() {return &sd;}
00203 bool identical_to(scatter_exp *ha);
00204 void init_scatter_exp(sdyn* b);
00205 void final_scatter_exp(sdyn* b);
00206 void set_resonance(bool r) {resonance = r;}
00207 bool get_resonance() {return resonance;}
00208
00209 void set_stop(bool s) {stop = s;}
00210 bool get_stop() {return stop;}
00211
00212 real get_specific_sigma_err_sq(scatter_discriptor d);
00213 real get_specific_sigma(scatter_discriptor d);
00214 int get_specific_counts(scatter_discriptor d);
00215 int get_specific_counts(scatter_discriptor d, int i);
00216
00217
00218 void inc_sigma(real s) {sigma += s;}
00219 void inc_sigma_err_sq(real e2) {sigma_err_sq += e2;}
00220
00221 void inc_step_counter(int index) {step_counter[index]++;}
00222 int get_step_counter(int index) {return step_counter[index];}
00223 void inc_osc_counter(int index) {osc_counter[index]++;}
00224 int get_osc_counter(int index) {return osc_counter[index];}
00225
00226 void set_nhits(int i, int n) {n_hits[i] = n;}
00227 int get_nhits(int i) {return n_hits[i];}
00228 void inc_n_hits(int i) {if(1) n_hits[i]++;}
00229 void inc_n_hit(int i) {if(1) n_hit[i]++;}
00230
00231 scatter_discriptor classify_scatter();
00232
00233 int count_character_in_string(char string[], char search);
00234 int count_character_in_string(char string[], char search[], int n_char);
00235 int count_multiplicity();
00236
00237 bool check_for_exchange();
00238
00239 friend ostream& operator<<(ostream& s, scatter_exp&);
00240 bool operator == (scatter_exp& ha) const;
00241 bool operator != (scatter_exp& ha) const;
00242
00243 MPI_Datatype initialize_data_structures_MPI();
00244 };
00245
00246 scatter_exp* read_scatter_exp(istream& s);
00247
00248 #endif