1 |
|
#ifndef __READWRITE_H__ |
2 |
|
#define __READWRITE_H__ |
3 |
< |
|
3 |
> |
#define _LARGEFILE_SOURCE64 |
4 |
> |
#define _FILE_OFFSET_BITS 64 |
5 |
|
#include <iostream> |
6 |
|
#include <fstream> |
7 |
< |
|
7 |
> |
#include <string> |
8 |
|
#include <string.h> |
9 |
|
#include <stdio.h> |
10 |
|
#include <stdlib.h> |
16 |
|
#include "Atom.hpp" |
17 |
|
#include "SimInfo.hpp" |
18 |
|
#include "Thermo.hpp" |
19 |
+ |
#include "StuntDouble.hpp" |
20 |
|
|
21 |
|
using namespace std; |
22 |
|
|
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 |
– |
|
23 |
|
class DumpWriter{ |
24 |
|
|
25 |
|
public: |
42 |
|
|
43 |
|
SimInfo* entry_plug; |
44 |
|
ofstream dumpFile; |
79 |
– |
ofstream finalOut; |
45 |
|
|
46 |
|
#ifdef IS_MPI |
47 |
|
vector<pair<int, int> > indexArray; |
55 |
|
~StatWriter(); |
56 |
|
|
57 |
|
void writeStat( double currentTime ); |
58 |
+ |
void writeRaw( double currentTime ); |
59 |
|
|
60 |
|
private: |
61 |
|
|
62 |
|
SimInfo* entry_plug; |
63 |
|
ofstream outFile; |
64 |
+ |
ofstream rawFile; |
65 |
|
char outName[500]; |
66 |
+ |
char rawName[500]; |
67 |
|
Thermo* tStats; |
68 |
|
|
69 |
|
}; |
77 |
|
void readInit( SimInfo* the_entry_plug ); |
78 |
|
|
79 |
|
private: |
80 |
< |
char* parseDumpLine(char* line, int atomIndex); |
80 |
> |
char* parseDumpLine(char* line, StuntDouble* sd); |
81 |
|
char* parseCommentLine(char* line, SimInfo* entry_plug); |
82 |
|
FILE *c_in_file; |
83 |
|
char c_in_name[500]; |
87 |
|
class DumpReader{ |
88 |
|
|
89 |
|
public: |
90 |
< |
DumpReader( char *in_name ); |
90 |
> |
DumpReader(const char *in_name ); |
91 |
|
~DumpReader(); |
92 |
|
|
93 |
|
int getNframes(); |
96 |
|
void getNextFrame() {} |
97 |
|
void readFrame(SimInfo* the_simnfo, int whichFrame); |
98 |
|
|
99 |
+ |
#ifdef IS_MPI |
100 |
+ |
void anonymousNodeDie( void ); |
101 |
+ |
void nodeZeroError( void ); |
102 |
+ |
#endif |
103 |
|
private: |
104 |
|
|
105 |
|
void readSet( int whichFrame ); |
106 |
< |
char* parseDumpLine(char* line, int atomIndex); |
107 |
< |
char* parseCommentLine(char* line, double &time, double boxMat[9] ); |
106 |
> |
char* parseDumpLine(char* readLine, StuntDouble* sd); |
107 |
> |
char* parseCommentLine(char* readLine, SimInfo* entry_plug); |
108 |
|
FILE *inFile; |
109 |
< |
char inName[500]; |
109 |
> |
string inFileName; |
110 |
|
bool isScanned; |
139 |
– |
int nFrames; |
111 |
|
|
112 |
< |
FilePos** frameStart; |
142 |
< |
FilePos* headFP; |
143 |
< |
|
112 |
> |
vector<fpos_t*> framePos; |
113 |
|
SimInfo *simnfo; |
114 |
|
}; |
115 |
|
|