Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

vmdmain.C

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr
00003  *cr            (C) Copyright 1995-2019 The Board of Trustees of the
00004  *cr                        University of Illinois
00005  *cr                         All Rights Reserved
00006  *cr
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  * RCS INFORMATION:
00011  *
00012  *      $RCSfile: vmdmain.C,v $
00013  *      $Author: johns $        $Locker:  $             $State: Exp $
00014  *      $Revision: 1.18 $       $Date: 2019/01/17 21:21:03 $
00015  *
00016  ***************************************************************************
00017  * DESCRIPTION:
00018  *
00019  * Main program.
00020  *
00021  ***************************************************************************/
00022 #include "vmd.h"
00023 #include "ProfileHooks.h"
00024 
00025 #if defined(ANDROID)
00026 int VMDmain(int argc, char **argv) {
00027 #else
00028 int main(int argc, char **argv) {
00029 #endif
00030   int mpienabled = 0;
00031 
00032   PROFILE_MAIN_THREAD(); // mark main VMD thread within profiler timelines
00033 
00034   PROFILE_PUSH_RANGE("VMD main() initialization", 4);
00035 
00036 #if defined(VMDMPI)
00037   // so long as the caller has not disabled MPI, we initialize MPI when VMD
00038   // has been compiled to support it.
00039   if (getenv("VMDNOMPI") == NULL) {
00040     mpienabled = 1;
00041   }
00042 #endif
00043 
00044   if (!VMDinitialize(&argc, &argv, mpienabled)) {
00045     return 0;
00046   }
00047 
00048   const char *displayTypeName = VMDgetDisplayTypeName();
00049   int displayLoc[2], displaySize[2];
00050   VMDgetDisplayFrame(displayLoc, displaySize);
00051 
00052   VMDApp *app = new VMDApp(argc, argv, mpienabled);
00053 
00054   if (!app->VMDinit(argc, argv, displayTypeName, displayLoc, displaySize)) {
00055     delete app;
00056     return 1;
00057   }
00058 
00059   PROFILE_POP_RANGE();
00060   PROFILE_PUSH_RANGE("VMD startup scripts", 1);
00061 
00062   // read various application defaults
00063   VMDreadInit(app);
00064 
00065   PROFILE_POP_RANGE();
00066   PROFILE_PUSH_RANGE("VMD process user script(s)", 1);
00067 
00068   // read user-defined startup files
00069   VMDreadStartup(app);
00070 
00071   PROFILE_POP_RANGE();
00072   PROFILE_PUSH_RANGE("VMD interactive event loop", 1);
00073 
00074   // main event loop
00075   do {
00076     // If we knew that there were no embedded python interpreter, we could
00077     // process Tcl events here, rather than within the VMD instance. 
00078 #ifdef VMDTCL
00079     // Loop on the Tcl event notifier
00080     // while (Tcl_DoOneEvent(TCL_DONT_WAIT));
00081 #endif
00082 
00083     // handle Fltk events
00084     VMDupdateFltk();
00085 
00086 #if 0
00087     // take over the console
00088     if (vmd_check_stdin()) {
00089       app->process_console();
00090     }
00091 #endif
00092 
00093   } while(app->VMDupdate(VMD_CHECK_EVENTS));
00094 
00095   PROFILE_POP_RANGE();
00096 
00097   // end of program
00098   delete app;
00099   VMDshutdown(mpienabled);
00100 
00101   return 0;
00102 }
00103 

Generated on Tue Dec 10 02:46:34 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002