main.cpp File Reference

#include <FFThread.hpp>
#include <StaticCenter.hpp>
#include <RunningOptions.hpp>
#include <cstddef>
#include <string>
#include <fstream>
#include <iostream>
#include <CommandLineParser.hpp>

Include dependency graph for main.cpp:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Variables

static StaticCenter staticCenter


Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 57 of file main.cpp.

References CommandLineParser::filename(), StaticBase< RunningOptions >::instance(), RunningOptions::setDisplay(), FFThread::setInput(), RunningOptions::setVerbosity(), Thread::start(), and CommandLineParser::verbosityLevel().

00058 {
00059 #ifdef HAVE_GUI_LIBS
00060 #ifdef Q_WS_X11
00061   Display* display
00062     = XOpenDisplay(getenv( "DISPLAY" ));
00063   if (display != 0) {
00064     XCloseDisplay(display); // freeing 1 X11 socket...
00065     RunningOptions::instance().setDisplay(true);
00066   }
00067 #else // Q_WS_X11
00068   // When not running X11, always have Display
00069   RunningOptions::instance().setDisplay(true);
00070 #endif // Q_WS_X11
00071 #endif // HAVE_GUI_LIBS
00072 
00073   CommandLineParser arguments(argc, argv);
00074   RunningOptions::instance().setVerbosity(arguments.verbosityLevel());
00075 
00076 #ifdef HAVE_GUI_LIBS
00077   gui = new GUI(argc, argv);
00078 #endif // HAVE_GUI_LIBS
00079 
00080   if (not(RunningOptions::instance().useGUI())) {
00081     std::ifstream fin(arguments.filename().c_str());
00082 
00083     if (not(fin)) {
00084       std::cerr << "Error: cannot open file \""
00085                 << arguments.filename() << "\"\n";
00086       return 1;
00087     }
00088 
00089     FFThread mainThread;
00090     mainThread.setInput(fin);
00091     mainThread.start();
00092   }
00093 
00094 #ifdef HAVE_GUI_LIBS
00095   if (gui != 0) delete gui;
00096 #endif // HAVE_GUI_LIBS
00097 
00098   return 0;
00099 }

Here is the call graph for this function:


Variable Documentation

Definition at line 55 of file main.cpp.


Generated on Wed Nov 19 00:01:53 2008 for FreeFEM3D (aka ff3d) by  doxygen 1.5.6