1 |
#include <iostream> |
2 |
#include <fstream> |
3 |
#include <cstdlib> |
4 |
#include <cmath> |
5 |
#include <cstring> |
6 |
|
7 |
#include "frameCount.h" |
8 |
#include "simError.h" |
9 |
#include "SimSetup.hpp" |
10 |
#include "SimInfo.hpp" |
11 |
#include "Atom.hpp" |
12 |
#include "Integrator.hpp" |
13 |
#include "Thermo.hpp" |
14 |
#include "ReadWrite.hpp" |
15 |
|
16 |
char* program_name; |
17 |
using namespace std; |
18 |
|
19 |
int main(int argc,char* argv[]){ |
20 |
|
21 |
char dumpName[2000]; |
22 |
char* endTest; |
23 |
int nameLength; |
24 |
int nFrames; |
25 |
char* in_name; |
26 |
SimSetup* startMe; |
27 |
SimInfo* infoArray; |
28 |
|
29 |
|
30 |
// first things first, all of the initializations |
31 |
|
32 |
printf("Initializing stuff ....\n"); |
33 |
fflush(sdtout); |
34 |
srand48( 1337 ); // the random number generator. |
35 |
initSimError(); // the error handler |
36 |
|
37 |
program_name = argv[0]; /*save the program name in case we need it*/ |
38 |
if( argc < 2 ){ |
39 |
sprintf( painCave.errMsg, |
40 |
"Error, bass file is needed to run.\n" ); |
41 |
painCave.isFatal = 1; |
42 |
simError(); |
43 |
} |
44 |
|
45 |
in_name = argv[1]; |
46 |
|
47 |
// make the dump name |
48 |
|
49 |
strcpy( dumpName, in_name ); |
50 |
nameLength = strlen( dumpName ); |
51 |
endTest = &(dumpName[nameLength - 5]); |
52 |
if( !strcmp( endTest, ".bass" ) ){ |
53 |
strcpy( endTest, ".dump" ); |
54 |
} |
55 |
else if( !strcmp( endTest, ".BASS" ) ){ |
56 |
strcpy( endTest, ".dump" ); |
57 |
} |
58 |
else{ |
59 |
endTest = &(dumpName[nameLength - 4]); |
60 |
if( !strcmp( endTest, ".bss" ) ){ |
61 |
strcpy( endTest, ".dump" ); |
62 |
} |
63 |
else if( !strcmp( endTest, ".mdl" ) ){ |
64 |
strcpy( endTest, ".dump" ); |
65 |
} |
66 |
else{ |
67 |
strcat( dumpName, ".dump" ); |
68 |
} |
69 |
} |
70 |
|
71 |
// count the number of frames in the dump file. |
72 |
|
73 |
printf("Counting the number of frames in \"%s\"... ", dumpName ); |
74 |
fflush(stdout); |
75 |
|
76 |
nFrames = frmaeCount( dumpName, 0 ); |
77 |
|
78 |
printf("done.\n" |
79 |
"Found %d frames.\n" |
80 |
"\n", |
81 |
nFrames ); |
82 |
|
83 |
infoArray = new SimInfo[nFrames]; |
84 |
|
85 |
startMe = new SimSetup(); |
86 |
startMe->setSimInfo( infoArray, nFrames ); |
87 |
startMe->parseFile( in_name ); |
88 |
startMe->createSim(); |
89 |
|
90 |
delete startMe; |
91 |
|
92 |
entry_plug->the_integrator->integrate(); |
93 |
|
94 |
return 0 ; |
95 |
} |
96 |
|