00001
00002
00003 #include "program.h"
00004
00005 string Program::keywords[] = {
00006 "n:nbody=???\n number of bodies in the Nbody system",
00007 "s:seed=0\n an integer either in the range [1,2147483647], or \n"
00008 "0 which causes a seed to be chosen as the value of\n"
00009 "the UNIX clock in seconds; this guarantees that no two\n"
00010 "calls will give the same value for the seed if they\n"
00011 "are more than 2.0 seconds apart.",
00012 "m:mfrac=0.999\n Mass cutoff",
00013 "r:rfrac=22.8042468\n Radial cutoff",
00014 "c:comment=\n Optional comments added to output stream",
00015 "i iflag=f\n undocumented flag",
00016 "o oflag=f\n undocumented flag",
00017 NULL,
00018 };
00019
00020 string Program::version = "1.0 13-aug-96 PH";
00021
00022 string Program::usage = "make a Plummer model, with a spatial or mass cut-off";
00023
00024 string Program::description =
00025 "mkplummer builds a nbody system according to a Plummer model, in virial\n"
00026 "units (M=G=-4E=1, with E the total energy), and finite spatial extent\n"
00027 "which can be regulated by specifying mfrac or rfrac or using their default\n"
00028 "values.\n"
00029 " litt: S.J. Aarseth, M. Henon and R. Wielen (1974),\n"
00030 " Astron. and Astrophys. 37, p. 183.";
00031
00032 void starlab_main()
00033 {
00034
00035 string comment = 0;
00036 int n, seed, argc;
00037 char **argv;
00038 real mfrac, rfrac;
00039 bool i_flag, o_flag;
00040 char seedlog[128];
00041
00042 n = getiparam("nbody");
00043 if (hasvalue("comment")) comment = getparam("comment");
00044 mfrac = getrparam("mfrac");
00045 rfrac = getrparam("rfrac");
00046
00047 seed = srandinter(getiparam("seed"));
00048
00049 i_flag = getflag("iflag");
00050 o_flag = getflag("oflag");
00051
00052
00053
00054 argc = get_argc();
00055 argv = get_argv();
00056 cout << "argc=" << argc << endl;
00057 for (int i=0; i<argc; i++)
00058 cout << "argv[" << i << "] = " << argv[i] << endl;
00059
00060
00061 if (o_flag) cerr << "mkplummer: random seed = " << seed << endl;
00062 sprintf(seedlog, " random number generator seed = %d",seed);
00063 cout << "COMMENT:" << seedlog << endl;
00064 cout << "nbody = " << n << endl;
00065 cout << "mfrac = " << mfrac <<endl;
00066 }
00067