Main Page   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

add_plummer.C

Go to the documentation of this file.
00001 
00002        //=======================================================//    _\|/_
00003       //  __  _____           ___                    ___       //      /|\ ~
00004      //  /      |      ^     |   \  |         ^     |   \     //          _\|/_
00005     //   \__    |     / \    |___/  |        / \    |___/    //            /|\ ~
00006    //       \   |    /___\   |  \   |       /___\   |   \   // _\|/_
00007   //     ___/   |   /     \  |   \  |____  /     \  |___/  //   /|\ ~
00008  //                                                       //            _\|/_
00009 //=======================================================//              /|\ ~
00010 
00020 
00021 //   version 1:  Aug/Sep 2001   Steve McMillan
00022 
00023 // This function is just a special case of add_power_law, and is now
00024 // handled as such.
00025 
00026 #include "dyn.h"
00027 
00028 #ifndef TOOLBOX
00029 
00030 void add_plummer(dyn *b,
00031                  real coeff, real scale,
00032                  vector center,                 // default = (0, 0, 0)
00033                  bool n_flag,                   // default = false
00034                  bool verbose)                  // default = false
00035 {
00036     add_power_law(b, coeff, 0, scale, center, n_flag, verbose, false);
00037 }
00038 
00039 #else
00040 
00041 main(int argc, char *argv[])
00042 {
00043     bool c_flag = false;
00044     char *comment;              // comment string
00045 
00046     real mass = 1, scale = 1;
00047     vector center = 0;
00048 
00049     bool n_flag = false;
00050 
00051     check_help();
00052 
00053     extern char *poptarg;
00054     extern char *poparr[];
00055     int c;
00056     char* param_string = "a:c:C:::M:nR:";
00057 
00058     dyn *b = get_dyn(cin);
00059     if (b == NULL) err_exit("Can't read input snapshot");
00060 
00061     b->log_history(argc, argv);
00062 
00063     // Parse the argument list:
00064 
00065     while ((c = pgetopt(argc, argv, param_string)) != -1) {
00066         switch (c) {
00067             case 'c':   c_flag = TRUE;
00068                         comment = poptarg;
00069                         break;
00070             case 'C':   center = vector(atof(poparr[0]),
00071                                         atof(poparr[1]),
00072                                         atof(poparr[2]));
00073                         break;
00074             case 'M':   mass = atof(poptarg);
00075                         break;
00076             case 'a':
00077             case 'R':   scale = atof(poptarg);
00078                         break;
00079 
00080             case 'n':   n_flag = true;
00081                         break;
00082 
00083             default:
00084             case '?':   params_to_usage(cerr, argv[0], param_string);
00085                         get_help();
00086                         return false;
00087         }
00088     }
00089 
00090     add_plummer(b, mass, scale, center, n_flag, true);
00091     put_node(cout, *b);
00092 }
00093 
00094 #endif

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