Main Page   Namespace List   Compound List   File List   Compound Members   File Members  

copy-StartupPape.cc

Go to the documentation of this file.
00001 // $Id: StartupTyco.cc,v 1.1 2001/05/05 02:09:29 zweck Exp $
00002 
00003 //###################################################################\\
00004 //                                                                   \\
00005 //           Optical Communication Systems Simulator                 \\
00006 //                                                                   \\
00007 //       Copyright (2000):                                           \\
00008 //       Optical Fiber Communications Laboratory (OFCL)              \\
00009 //       Computer Science & Electrical Engineering Department (CSEE) \\
00010 //       University of Maryland Baltimore County (UMBC)              \\
00011 //                                                                   \\
00012 //###################################################################\\
00013 
00014 # include "StartupPape.hh"
00015 
00016 // Note that LogFile is defined here and not declared
00017 extern ofstream LogFile;
00018 
00019 
00020 /*********************************************************************\
00021 /  #Function added by John Zweck                                      \
00022 /  Documention : Pape D. Thiam                                        \
00023 /                                                                     \
00024 /  Function    :  StartupZweck                                        \
00025 /                                                                     \
00026 /  usage       :                                                      \
00027 /  an object (InFile) of type "ifstream" is first instanciated. The   \
00028 /  string object "InFileName" that was passed to the function gets    \
00029 /  converted into a pointer to a null-terminated character array      \
00030 /  before being written to the object "InFile". An error message      \
00031 /  would appear on the screen if "InFile" can not be opened. All the  \
00032 /  private data members of type string, int, and double are           \
00033 /  initialized using respectively the functions "ReadString",         \
00034 /  "ReadInt", and "ReadDouble" which return a string an int and a     \     
00035 /  double respectively. However, the data members "LogFileName" and   \
00036 /  "JobPrefix" was initialized using the following syntax             \
00037 /                                                                     \   
00038 /       "LogFileName = JobDir + JobName + ".log";"                    \ 
00039 /       "JobPrefix = JobDir + JobName + "_";"                         \
00040 /                                                                     \
00041 /  after being intialized, the string "LogFileName" is converted into \
00042 /  a pointer to a null-terminated character array                     \ 
00043 /  before being written to the object "LogFile". An error message     \ 
00044 /  would appear on the screen if "LogFile" can not be opened and the  \ 
00045 /  program is exited. Data is written into "LogFile" if it opens      \ 
00046 /  successfully. "LogFile" is closed at the end of the function.      \ 
00047 /  string.                                                            \
00048 /                                                                     \
00049 /  Argument(s) :                                                      \
00050 /     string InFileName: "InFileName" is a string that is used more   \
00051 /                        than once to write to files                  \
00052 /                                                                     \
00053 /  Return(s)   : none                                                 \
00054 \*********************************************************************/
00055 StartupZweck::StartupZweck(string InFileName)
00056 {
00057 
00058 ifstream InFile(InFileName.c_str(),ios::in);    
00059    
00060 if (!InFile) 
00061  {
00062     cerr << "Error: Input file "<< InFileName 
00063          << " could not be opened."<< endl;
00064     exit(1);
00065  }
00066 
00067 JobDir = ReadString("JobDir",&InFile);
00068 JobName =  ReadString("JobName",&InFile);
00069 
00070 LogFileName = JobDir + JobName + ".log";
00071 
00072  cout << endl
00073       << "Log File = " << LogFileName << endl << endl;
00074 
00075 LogFile.open(LogFileName.c_str(),ios::out);
00076    
00077 if (!LogFile) 
00078   {
00079     cerr << "Error: ocs.log could not be open." << endl << flush;
00080     exit(1);
00081   }    
00082 
00083 JobPrefix = JobDir + JobName + "_";
00084 
00085 
00086 
00087 LogFileSeparator();
00088 LogFile << InFileName << endl << endl;
00089 
00090 LogFile << "Job Prefix = " << JobPrefix << endl;
00091 InputFilesDir = ReadString("InputFilesDir", &InFile);
00092 SimType = ReadInt("SimType"," ",0,0,NO_BOUNDS,&InFile);
00093 qtStatSamples = ReadInt("qtStatSamples"," ",0,-1,LOWER_ONLY,&InFile);
00094 qtMapSpans = ReadInt("qtMapSpans"," ",0,-1,LOWER_ONLY,&InFile);
00095 
00096 DebugLevelAmps = ReadInt("DebugLevelAmps"," ",0,3,LOWER_AND_UPPER,
00097                           OPTIONAL_NO_WARNING,1,&InFile);
00098 
00099 
00100 RelativeErrorGoal = ReadDouble("RelativeErrorGoal"," ",0,-1,LOWER_ONLY,
00101                                 &InFile);
00102 
00103 OutputStepSizesFlag = ReadInt("OutputStepSizes"," ",0,1,
00104                                LOWER_AND_UPPER,&InFile);
00105 
00106 
00107 Beta3ZeroFlag = ReadInt("Beta3ZeroFlag"," ",0,1,LOWER_AND_UPPER,&InFile);
00108 NonLinearityZeroFlag = ReadInt("NonLinearityZeroFlag"," ",0,1,
00109                                 LOWER_AND_UPPER,&InFile);
00110 FiberLossZeroFlag = ReadInt("FiberLossZeroFlag"," ",0,1,
00111                              LOWER_AND_UPPER,&InFile);
00112 TypeAmp = ReadInt("TypeAmp"," ",0,5,LOWER_AND_UPPER,&InFile);
00113 AmpsNoiseOffFlag = ReadInt("AmpsNoiseOffFlag"," ",0,1,LOWER_AND_UPPER,&InFile);
00114 
00115 
00116 int UseMosixFlag = ReadInt("UseMosixFlag"," ",0,1,LOWER_AND_UPPER,
00117                         OPTIONAL_NO_WARNING,0,&InFile);
00118 
00119 if(UseMosixFlag)
00120   {
00121    lock_or_unlock_mosix(MOSIX_UNLOCK);
00122    cpujob_mosix();
00123    slow_mosix();
00124   }
00125 
00126 InFile.close();
00127 
00128 
00129 } // end constructor
00130 
00131 // #####################################################################
00132 
00133 
00134 
00135 
00136 
00137 
00138 

Generated at Mon Jun 9 20:08:10 2003 for OCS by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000