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 |
+ |
#include <string> |
8 |
+ |
#include <string.h> |
9 |
+ |
#include <stdio.h> |
10 |
+ |
#include <stdlib.h> |
11 |
+ |
#include <unistd.h> |
12 |
+ |
#include <sys/types.h> |
13 |
+ |
#include <sys/stat.h> |
14 |
|
|
7 |
– |
#include <cstring> |
8 |
– |
#include <cstdio> |
9 |
– |
#include <cstdlib> |
15 |
|
|
11 |
– |
|
16 |
|
#include "Atom.hpp" |
17 |
|
#include "SimInfo.hpp" |
18 |
|
#include "Thermo.hpp" |
19 |
+ |
#include "StuntDouble.hpp" |
20 |
|
|
21 |
|
using namespace std; |
22 |
|
|
18 |
– |
|
19 |
– |
|
20 |
– |
|
23 |
|
class DumpWriter{ |
24 |
|
|
25 |
|
public: |
27 |
|
~DumpWriter(); |
28 |
|
|
29 |
|
void writeDump( double currentTime ); |
30 |
< |
void writeFinal( double finalTime ); |
30 |
> |
void writeFinal( double currentTime); |
31 |
> |
void writeFrame( vector<ofstream*>& outFile, double finalTime ); |
32 |
|
|
33 |
+ |
#ifdef IS_MPI |
34 |
+ |
void update(); |
35 |
+ |
#endif |
36 |
+ |
|
37 |
|
private: |
38 |
+ |
|
39 |
+ |
#ifdef IS_MPI |
40 |
+ |
void sortByGlobalIndex(); |
41 |
+ |
#endif |
42 |
+ |
|
43 |
|
SimInfo* entry_plug; |
44 |
< |
ofstream outFile; |
45 |
< |
char outName[500]; |
44 |
> |
ofstream dumpFile; |
45 |
> |
|
46 |
> |
#ifdef IS_MPI |
47 |
> |
vector<pair<int, int> > indexArray; |
48 |
> |
#endif |
49 |
|
}; |
50 |
|
|
51 |
|
class StatWriter{ |
55 |
|
~StatWriter(); |
56 |
|
|
57 |
|
void writeStat( double currentTime ); |
58 |
< |
|
58 |
> |
|
59 |
|
private: |
60 |
< |
|
60 |
> |
|
61 |
|
SimInfo* entry_plug; |
62 |
|
ofstream outFile; |
63 |
|
char outName[500]; |
72 |
|
~InitializeFromFile(); |
73 |
|
|
74 |
|
void readInit( SimInfo* the_entry_plug ); |
75 |
< |
|
75 |
> |
|
76 |
|
private: |
77 |
< |
char* parseDumpLine(char* line, int atomIndex); |
78 |
< |
char* parseBoxLine(char* line, double boxMat[9], double &time ); |
77 |
> |
char* parseDumpLine(char* line, StuntDouble* sd); |
78 |
> |
char* parseCommentLine(char* line, SimInfo* entry_plug); |
79 |
|
FILE *c_in_file; |
80 |
|
char c_in_name[500]; |
81 |
|
SimInfo* simnfo; |
84 |
|
class DumpReader{ |
85 |
|
|
86 |
|
public: |
87 |
< |
DumpReader( char *in_name ); |
87 |
> |
DumpReader(const char *in_name ); |
88 |
|
~DumpReader(); |
89 |
|
|
90 |
|
int getNframes(); |
93 |
|
void getNextFrame() {} |
94 |
|
void readFrame(SimInfo* the_simnfo, int whichFrame); |
95 |
|
|
96 |
+ |
#ifdef IS_MPI |
97 |
+ |
void anonymousNodeDie( void ); |
98 |
+ |
void nodeZeroError( void ); |
99 |
+ |
#endif |
100 |
|
private: |
101 |
|
|
102 |
|
void readSet( int whichFrame ); |
103 |
< |
char* parseDumpLine(char* line, int atomIndex); |
104 |
< |
char* parseCommentLine(char* line, double &time, double boxMat[9] ); |
103 |
> |
char* parseDumpLine(char* readLine, StuntDouble* sd); |
104 |
> |
char* parseCommentLine(char* readLine, SimInfo* entry_plug); |
105 |
|
FILE *inFile; |
106 |
< |
char inName[500]; |
106 |
> |
string inFileName; |
107 |
|
bool isScanned; |
89 |
– |
int nFrames; |
108 |
|
|
109 |
+ |
vector<fpos_t*> framePos; |
110 |
|
SimInfo *simnfo; |
111 |
|
}; |
112 |
|
|