1 |
mmeineke |
377 |
#ifndef __READWRITE_H__ |
2 |
|
|
#define __READWRITE_H__ |
3 |
tim |
1078 |
#define _LARGEFILE_SOURCE64 |
4 |
|
|
#define _FILE_OFFSET_BITS 64 |
5 |
mmeineke |
377 |
#include <iostream> |
6 |
|
|
#include <fstream> |
7 |
tim |
1118 |
#include <string> |
8 |
gezelter |
829 |
#include <string.h> |
9 |
|
|
#include <stdio.h> |
10 |
|
|
#include <stdlib.h> |
11 |
mmeineke |
804 |
#include <unistd.h> |
12 |
|
|
#include <sys/types.h> |
13 |
|
|
#include <sys/stat.h> |
14 |
mmeineke |
377 |
|
15 |
mmeineke |
646 |
|
16 |
mmeineke |
377 |
#include "Atom.hpp" |
17 |
|
|
#include "SimInfo.hpp" |
18 |
|
|
#include "Thermo.hpp" |
19 |
tim |
1108 |
#include "StuntDouble.hpp" |
20 |
mmeineke |
377 |
|
21 |
|
|
using namespace std; |
22 |
|
|
|
23 |
|
|
class DumpWriter{ |
24 |
|
|
|
25 |
|
|
public: |
26 |
|
|
DumpWriter( SimInfo* the_entry_plug ); |
27 |
|
|
~DumpWriter(); |
28 |
|
|
|
29 |
|
|
void writeDump( double currentTime ); |
30 |
tim |
929 |
void writeFinal( double currentTime); |
31 |
tim |
934 |
void writeFrame( vector<ofstream*>& outFile, double finalTime ); |
32 |
mmeineke |
377 |
|
33 |
tim |
929 |
#ifdef IS_MPI |
34 |
|
|
void update(); |
35 |
|
|
#endif |
36 |
|
|
|
37 |
mmeineke |
377 |
private: |
38 |
tim |
929 |
|
39 |
|
|
#ifdef IS_MPI |
40 |
|
|
void sortByGlobalIndex(); |
41 |
|
|
#endif |
42 |
|
|
|
43 |
mmeineke |
377 |
SimInfo* entry_plug; |
44 |
tim |
929 |
ofstream dumpFile; |
45 |
tim |
934 |
|
46 |
|
|
#ifdef IS_MPI |
47 |
tim |
929 |
vector<pair<int, int> > indexArray; |
48 |
tim |
934 |
#endif |
49 |
mmeineke |
377 |
}; |
50 |
|
|
|
51 |
|
|
class StatWriter{ |
52 |
|
|
|
53 |
|
|
public: |
54 |
|
|
StatWriter( SimInfo* the_entry_plug ); |
55 |
|
|
~StatWriter(); |
56 |
|
|
|
57 |
|
|
void writeStat( double currentTime ); |
58 |
chrisfen |
1180 |
void writeRaw( double currentTime ); |
59 |
tim |
837 |
|
60 |
mmeineke |
377 |
private: |
61 |
tim |
837 |
|
62 |
mmeineke |
377 |
SimInfo* entry_plug; |
63 |
|
|
ofstream outFile; |
64 |
chrisfen |
1180 |
ofstream rawFile; |
65 |
mmeineke |
377 |
char outName[500]; |
66 |
chrisfen |
1180 |
char rawName[500]; |
67 |
mmeineke |
377 |
Thermo* tStats; |
68 |
|
|
|
69 |
|
|
}; |
70 |
|
|
|
71 |
|
|
class InitializeFromFile{ |
72 |
|
|
|
73 |
|
|
public: |
74 |
|
|
InitializeFromFile( char *in_name ); |
75 |
|
|
~InitializeFromFile(); |
76 |
|
|
|
77 |
mmeineke |
641 |
void readInit( SimInfo* the_entry_plug ); |
78 |
tim |
837 |
|
79 |
mmeineke |
377 |
private: |
80 |
tim |
1108 |
char* parseDumpLine(char* line, StuntDouble* sd); |
81 |
tim |
837 |
char* parseCommentLine(char* line, SimInfo* entry_plug); |
82 |
mmeineke |
377 |
FILE *c_in_file; |
83 |
|
|
char c_in_name[500]; |
84 |
mmeineke |
586 |
SimInfo* simnfo; |
85 |
mmeineke |
377 |
}; |
86 |
|
|
|
87 |
gezelter |
637 |
class DumpReader{ |
88 |
mmeineke |
644 |
|
89 |
|
|
public: |
90 |
tim |
1074 |
DumpReader(const char *in_name ); |
91 |
gezelter |
637 |
~DumpReader(); |
92 |
mmeineke |
377 |
|
93 |
gezelter |
637 |
int getNframes(); |
94 |
mmeineke |
646 |
void scanFile( void ); |
95 |
mmeineke |
377 |
|
96 |
mmeineke |
656 |
void getNextFrame() {} |
97 |
|
|
void readFrame(SimInfo* the_simnfo, int whichFrame); |
98 |
|
|
|
99 |
tim |
1118 |
#ifdef IS_MPI |
100 |
|
|
void anonymousNodeDie( void ); |
101 |
|
|
void nodeZeroError( void ); |
102 |
|
|
#endif |
103 |
gezelter |
637 |
private: |
104 |
mmeineke |
647 |
|
105 |
chuckv |
657 |
void readSet( int whichFrame ); |
106 |
tim |
1118 |
char* parseDumpLine(char* readLine, StuntDouble* sd); |
107 |
|
|
char* parseCommentLine(char* readLine, SimInfo* entry_plug); |
108 |
mmeineke |
647 |
FILE *inFile; |
109 |
tim |
1118 |
string inFileName; |
110 |
mmeineke |
647 |
bool isScanned; |
111 |
tim |
837 |
|
112 |
tim |
1118 |
vector<fpos_t*> framePos; |
113 |
mmeineke |
647 |
SimInfo *simnfo; |
114 |
gezelter |
637 |
}; |
115 |
|
|
|
116 |
|
|
|
117 |
mmeineke |
644 |
|
118 |
mmeineke |
377 |
#endif |