Main Page   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

reset_counters.C

Go to the documentation of this file.
00001 
00002        //=======================================================//    _\|/_
00003       //  __  _____           ___                    ___       //      /|\ ~
00004      //  /      |      ^     |   \  |         ^     |   \     //          _\|/_
00005     //   \__    |     / \    |___/  |        / \    |___/    //            /|\ ~
00006    //       \   |    /___\   |  \   |       /___\   |   \   // _\|/_
00007   //     ___/   |   /     \  |   \  |____  /     \  |___/  //   /|\ ~
00008  //                                                       //            _\|/_
00009 //=======================================================//              /|\ ~
00010 
00014 
00015 // Externally visible function:
00016 //
00017 //      void reset_counters
00018 
00019 #include "hdyn.h"
00020 
00021 #ifndef TOOLBOX
00022 
00023 void reset_counters(hdyn *bi)
00024 {
00025     bi->inc_steps(-bi->get_steps());            // only have inc and get...
00026     bi->inc_direct_force(-bi->get_direct_force());
00027     bi->inc_indirect_force(-bi->get_indirect_force());
00028 }
00029 
00030 #else
00031 
00032 main(int argc, char ** argv)
00033 {
00034     bool  c_flag = FALSE;
00035     char  *comment;
00036 
00037     check_help();
00038 
00039     extern char *poptarg;
00040     int c;
00041     char* param_string = "c:";
00042 
00043     while ((c = pgetopt(argc, argv, param_string)) != -1)
00044         switch(c) {
00045 
00046             case 'c': c_flag = TRUE;
00047                       comment = poptarg;
00048                       break;
00049             case '?': params_to_usage(cerr, argv[0], param_string);
00050                       get_help();
00051                       exit(1);
00052         }
00053 
00054     hdyn *b;
00055 
00056     while (b = get_hdyn(cin)) {
00057 
00058         if (c_flag == TRUE)
00059             b->log_comment(comment);
00060         b->log_history(argc, argv);
00061 
00062         for_all_nodes(hdyn, b, bi)
00063             reset_counters(bi);
00064         put_dyn(cout, *b);      
00065         delete b;
00066     }
00067 }
00068 
00069 #endif

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