1 |
#ifndef __READWRITE_H__ |
2 |
#define __READWRITE_H__ |
3 |
|
4 |
#include <iostream> |
5 |
#include <fstream> |
6 |
|
7 |
#include <cstring> |
8 |
#include <cstdio> |
9 |
#include <cstdlib> |
10 |
|
11 |
|
12 |
#include "Atom.hpp" |
13 |
#include "SimInfo.hpp" |
14 |
#include "Thermo.hpp" |
15 |
|
16 |
using namespace std; |
17 |
|
18 |
|
19 |
|
20 |
|
21 |
class DumpWriter{ |
22 |
|
23 |
public: |
24 |
DumpWriter( SimInfo* the_entry_plug ); |
25 |
~DumpWriter(); |
26 |
|
27 |
void writeDump( double currentTime ); |
28 |
void writeFinal( double finalTime ); |
29 |
|
30 |
private: |
31 |
SimInfo* entry_plug; |
32 |
ofstream outFile; |
33 |
char outName[500]; |
34 |
}; |
35 |
|
36 |
class StatWriter{ |
37 |
|
38 |
public: |
39 |
StatWriter( SimInfo* the_entry_plug ); |
40 |
~StatWriter(); |
41 |
|
42 |
void writeStat( double currentTime ); |
43 |
|
44 |
private: |
45 |
|
46 |
SimInfo* entry_plug; |
47 |
ofstream outFile; |
48 |
char outName[500]; |
49 |
Thermo* tStats; |
50 |
|
51 |
}; |
52 |
|
53 |
class InitializeFromFile{ |
54 |
|
55 |
public: |
56 |
InitializeFromFile( char *in_name ); |
57 |
~InitializeFromFile(); |
58 |
|
59 |
void readInit( SimInfo* the_entry_plug ); |
60 |
|
61 |
private: |
62 |
char* parseDumpLine(char* line, int atomIndex); |
63 |
char* parseBoxLine(char* line, double boxMat[9], double &time ); |
64 |
FILE *c_in_file; |
65 |
char c_in_name[500]; |
66 |
SimInfo* simnfo; |
67 |
}; |
68 |
|
69 |
class DumpReader{ |
70 |
|
71 |
public: |
72 |
DumpReader( char *in_name ); |
73 |
~DumpReader(); |
74 |
|
75 |
int getNframes(); |
76 |
void getNextFrame(); |
77 |
|
78 |
void scanFile( void ); |
79 |
|
80 |
private: |
81 |
|
82 |
void getFrame(SimInfo* the_simnfo, int whichFrame); |
83 |
char* parseDumpLine(char* line, int atomIndex); |
84 |
char* parseCommentLine(char* line, double &time, double boxMat[9] ); |
85 |
FILE *inFile; |
86 |
char inName[500]; |
87 |
bool isScanned; |
88 |
int nFrames; |
89 |
|
90 |
SimInfo *simnfo; |
91 |
}; |
92 |
|
93 |
|
94 |
|
95 |
#endif |