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