4 |
|
#include <iostream> |
5 |
|
#include <fstream> |
6 |
|
|
7 |
< |
#include <cstring> |
8 |
< |
#include <cstdio> |
9 |
< |
#include <cstdlib> |
7 |
> |
#include <string.h> |
8 |
> |
#include <stdio.h> |
9 |
> |
#include <stdlib.h> |
10 |
> |
#include <unistd.h> |
11 |
> |
#include <sys/types.h> |
12 |
> |
#include <sys/stat.h> |
13 |
|
|
14 |
+ |
|
15 |
|
#include "Atom.hpp" |
16 |
|
#include "SimInfo.hpp" |
17 |
|
#include "Thermo.hpp" |
18 |
|
|
19 |
|
using namespace std; |
20 |
|
|
21 |
+ |
class FilePos{ |
22 |
+ |
|
23 |
+ |
public: |
24 |
+ |
FilePos(){ |
25 |
+ |
myPos = NULL; |
26 |
+ |
next = NULL; |
27 |
+ |
} |
28 |
+ |
FilePos( fpos_t* thePos ) { |
29 |
+ |
myPos = thePos; |
30 |
+ |
next = NULL; |
31 |
+ |
} |
32 |
+ |
~FilePos(){ |
33 |
+ |
if( next != NULL ) delete next; |
34 |
+ |
if( myPos != NULL ) delete myPos; |
35 |
+ |
} |
36 |
+ |
|
37 |
+ |
void add( fpos_t *thePos ){ |
38 |
+ |
if( next != NULL ) |
39 |
+ |
next->add( thePos ); |
40 |
+ |
else |
41 |
+ |
next = new FilePos( thePos ); |
42 |
+ |
} |
43 |
+ |
|
44 |
+ |
FilePos &operator=(fpos_t *thePos){ myPos = thePos; return *this; } |
45 |
+ |
|
46 |
+ |
void setPos( fpos_t *thePos ){ myPos = thePos; } |
47 |
+ |
fpos_t *getPos( void ){ return myPos; } |
48 |
+ |
|
49 |
+ |
FilePos* getNext( void ) { return next; } |
50 |
+ |
private: |
51 |
+ |
|
52 |
+ |
fpos_t *myPos; |
53 |
+ |
FilePos* next; |
54 |
+ |
|
55 |
+ |
}; |
56 |
+ |
|
57 |
|
class DumpWriter{ |
58 |
|
|
59 |
|
public: |
96 |
|
|
97 |
|
private: |
98 |
|
char* parseDumpLine(char* line, int atomIndex); |
99 |
< |
char* parseBoxLine(char* line, double boxMat[9] ); |
99 |
> |
char* parseBoxLine(char* line, double boxMat[9], double &time ); |
100 |
|
FILE *c_in_file; |
101 |
|
char c_in_name[500]; |
102 |
|
SimInfo* simnfo; |
103 |
|
}; |
104 |
|
|
105 |
|
class DumpReader{ |
106 |
+ |
|
107 |
+ |
public: |
108 |
|
DumpReader( char *in_name ); |
109 |
|
~DumpReader(); |
110 |
|
|
111 |
|
int getNframes(); |
112 |
< |
void getNextFrame(); |
71 |
< |
void getFrame(SimInfo* the_entry_plug, int whichFrame) |
72 |
< |
void rewind(); |
112 |
> |
void scanFile( void ); |
113 |
|
|
114 |
+ |
void getNextFrame() {} |
115 |
+ |
void readFrame(SimInfo* the_simnfo, int whichFrame); |
116 |
+ |
|
117 |
|
private: |
118 |
+ |
|
119 |
+ |
void readSet( int whichFrame ); |
120 |
|
char* parseDumpLine(char* line, int atomIndex); |
121 |
< |
char* parseCommentLine(char* line, double time, double boxMat[9] ); |
122 |
< |
FILE *c_in_file; |
123 |
< |
char c_in_name[500]; |
124 |
< |
SimInfo* simnfo; |
121 |
> |
char* parseCommentLine(char* line, double &time, double boxMat[9] ); |
122 |
> |
FILE *inFile; |
123 |
> |
char inName[500]; |
124 |
> |
bool isScanned; |
125 |
> |
int nFrames; |
126 |
> |
|
127 |
> |
FilePos** frameStart; |
128 |
> |
FilePos* headFP; |
129 |
> |
|
130 |
> |
SimInfo *simnfo; |
131 |
|
}; |
132 |
|
|
82 |
– |
public: |
133 |
|
|
134 |
+ |
|
135 |
|
#endif |