Main Page   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

c_interface.C

Go to the documentation of this file.
00001 
00002 // Interface to let C routines use (C++) Starlab scattering routines.
00003 
00004 #include "scatter3.h"
00005 
00006 extern "C" {
00007 
00008     /* --------- Initialize, return CPU time: --------- */
00009 
00010     void c_cpu_init()
00011         {cpu_init();}
00012 
00013     real c_cpu_time()
00014         {return cpu_time();}
00015 
00016 
00017     /* --------- Initialize, return, print random numbers: --------- */
00018 
00019     int c_srandinter(int seed, int n_rand)
00020         {return srandinter(seed, n_rand);}
00021 
00022     real c_randinter(real a, real b)
00023         {return randinter(a, b);}
00024 
00025     void c_print_initial_random_parameters() {
00026         cerr << "Random seed = " << get_initial_seed()
00027              << "  n_rand = " << get_n_rand() << flush;
00028     }
00029 
00030 
00031     /* --------- Simple command-line parsing: --------- */
00032 
00033     int c_pgetopt(int argc, char** argv, char* param_string) /* CL parsing */
00034         {return pgetopt(argc, argv, param_string);}
00035 
00036 
00037     /* --------- Initialize standard initial state for scattering: --------- */
00038 
00039     void c_make_standard_init(initial_state3* init)
00040         {make_standard_init(*init);}
00041 
00042     void c_initialize_angles(initial_state3* init,
00043                         int planar_flag, bool psi_flag, real psi) {
00044         randomize_angles(init->phase);
00045         if (planar_flag == 1) {
00046             init->phase.cos_theta = 1;                  // Planar prograde
00047             if (psi_flag) init->phase.psi = psi * M_PI / 180.0;
00048         } else if (planar_flag == -1) {
00049             init->phase.cos_theta = -1;                 // Planar retrograde
00050             if (psi_flag) init->phase.psi = psi * M_PI / 180.0;
00051         }
00052     }
00053 
00054 
00055     /* --------- Print information on scattering: --------- */
00056 
00057     void c_print_scatter3_info(initial_state3* init,
00058                                intermediate_state3* inter,
00059                                final_state3* final,
00060                                bool Q_flag, bool q_flag, bool b_flag,
00061                                real cpu) {
00062         cerr << ":  ";
00063         print_scatter3_outcome(*inter, *final, cerr);
00064         if (Q_flag) print_scatter3_summary(*inter, *final, cpu, cerr);
00065         if (!q_flag) print_scatter3_report(*init, *inter, *final,
00066                                            cpu, b_flag, cerr);
00067     }
00068 
00069     void c_print_intermediate_descriptor(intermediate_descriptor3 descriptor)
00070         {cout << state_string(descriptor) << endl;}
00071 
00072     void c_print_final_descriptor(final_descriptor3 descriptor)
00073         {cout << state_string(descriptor) << endl;}
00074 
00075 
00076     /* --------- Perform a scattering experiment: --------- */
00077 
00078     void c_scatter3(initial_state3* init,
00079                     intermediate_state3* inter,
00080                     final_state3* final,
00081                     real cpu_time_check,
00082                     real dt_out,
00083                     real dt_snap,
00084                     real snap_cube_size) {
00085         scatter3(*init, *inter, *final, cpu_time_check,
00086                  dt_out, dt_snap, snap_cube_size);
00087     }
00088 }
00089 
00090         

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