main.cpp File Reference

#include "mainapp.h"
#include <string>
#include "dealbase.h"
#include "configfile.h"
#include "transportbase.h"
#include "dynamicbase.h"
#include "orthomesh.h"
#include "flashbase.h"
#include "conservativemethodforsystem.h"
#include "diffusivestep.h"
#include <fstream>
#include "globals.h"
#include "facefluxfunction.h"
#include "co2gridgenerator.h"
#include "constvelocitymodule.h"
#include "opointer.h"
#include "linearsolver.h"
#include "fixedvaluecondition.h"
#include "stringhashfun.h"
#include "doubleporositydiff.h"
#include "blockmatrixmodule.h"
#include "monitorwells.h"
#include <stdlib.h>
#include <signal.h>
#include <fenv.h>
#include <limits.h>
#include "hdf5orthowriter.h"
#include "flashco2brine.h"
#include <sys/time.h>
#include <time.h>
Include dependency graph for main.cpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void closeFiles (int sig_num)
void fpehandler (int sig_num)
int main (int argc, char **argv)

Variables

MainAppglobal_app = NULL
bool abort_once = false

Function Documentation

void closeFiles ( int  sig_num  ) 

Definition at line 22 of file main.cpp.

00023 {
00024   if (!abort_once)
00025   {
00026     abort_once=true;
00027     printf("An abort evend was signaled......\n");
00028     global_app->abortEvent();
00029     printf("Trying to output the data......Ok\n");
00030   }
00031   else
00032     printf("Trying to output the data......Failed\n");
00033   printf("Closing Output file\ngoodby\n");
00034   HDF5OrthoWriter::getHDF5OrthoWriter().close();
00035  
00036 }

void fpehandler ( int  sig_num  ) 

Definition at line 41 of file main.cpp.

00042 {
00043         signal(SIGFPE, fpehandler);
00044         printf("SIGFPE %d: FLOATING POINT EXCEPTION OCCURRED\n",sig_num);
00045         printf("Segmentation Fault signal will be sent to cause\n");
00046         printf("production of a core file\n");
00047         closeFiles(0);
00048         kill(getpid(),SIGSEGV);
00049         abort();
00050 }

int main ( int  argc,
char **  argv 
)

Definition at line 57 of file main.cpp.

00058 {
00059   
00060 
00061   //Build the message to print if bad arguments were passed
00062   char errorMessage[1000];
00063   
00064   //FlashCO2Brine::printFlashPropertiesTable(5,800,100,353,0.02);return 0;
00065   //FlashCO2Brine::printCO2RichMolarVolume(5,800,300,353);return 0;
00066   
00067 
00068   //enable arithmetic exception
00069   feenableexcept(FE_DIVBYZERO|FE_INVALID);
00070   signal(SIGFPE,fpehandler);
00071   signal(SIGKILL,closeFiles);
00072   signal(SIGABRT,closeFiles);
00073   signal(SIGTERM,closeFiles);
00074 
00075   sprintf(errorMessage,"Invalid arguments passed\n\
00076 Usage: %s [Options] <CONFILE FILE NAME>\n\
00077 Options:\n\
00078 -g\tActivate unit tests mode\n",argv[0]);
00079 
00080 
00081   if (argc != 3 && argc!= 2)
00082   {
00083       printf("%s",errorMessage);
00084       return 0;
00085   }
00086   //read parameter -g and set the
00087   //variables bunit_test, configFile
00088   //depending on it
00089   std::string configFile;
00090   bool bunit_test=false;
00091 
00092   
00093   
00094   //check if -g option was passed
00095   if (argc == 3)
00096   {
00097     std::string option = argv[1];
00098     if (option == "-g")
00099       bunit_test=true;
00100     else
00101     {
00102       printf("%s",errorMessage);
00103       return 0;
00104     }
00105     configFile=argv[2];
00106   }
00107   else if (argc == 2)
00108     configFile=argv[1];
00109 
00110   
00111   
00112 
00113   // if the program arrived here, then the option requested
00114   // is to run the simulator with the configuration file
00115   // passed as argument. 
00116 #ifndef USE_MPI
00117   Timer t1(PROCESSOR_TIME);
00118    t1.start();
00119 
00120   //Execute the MainApp class
00121   MainApp app;
00122   global_app = &app;
00123   app.execute(configFile,bunit_test);
00124 
00125   t1.end();
00126   std::cout << "Total Exec Time: " <<  t1.printTime() << std::endl;
00127   return 0;
00128   
00129 #else
00130 
00131   
00132   MPI_Init(&argc,&argv);
00133   if (argc != 2)
00134    {
00135      printf("%s",errorMessage);
00136      return 0;
00137    }
00138   system("echo $HOSTNAME $SSH_HOST $SSH_CONNECTION");
00139   MainAppMPI app;
00140   app.execute(argv[1]);
00141   
00142   MPI_Finalize();
00143   return 0;
00144 
00145 #endif
00146 
00147 
00148   
00149 
00150 }


Variable Documentation

bool abort_once = false

Definition at line 17 of file main.cpp.

Definition at line 16 of file main.cpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Sun Apr 8 23:12:35 2012 for CO2INJECTION by  doxygen 1.6.3