ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/props/staticProps.cpp
Revision: 672
Committed: Fri Aug 8 18:32:59 2003 UTC (21 years, 8 months ago) by mmeineke
File size: 2157 byte(s)
Log Message:
moved frameCount's functionality into DumpReader. also split props into staticProps and dynamicProps. (currently only have staticProps)

File Contents

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