--- trunk/OOPSE/libmdtools/ReadWrite.hpp 2003/07/21 16:23:10 641 +++ trunk/OOPSE/libmdtools/ReadWrite.hpp 2003/10/28 16:03:37 829 @@ -1,19 +1,61 @@ #ifndef __READWRITE_H__ #define __READWRITE_H__ +#define _FILE_OFFSET_BITS 64 + #include #include -#include -#include -#include +#include +#include +#include +#include +#include +#include + #include "Atom.hpp" #include "SimInfo.hpp" #include "Thermo.hpp" using namespace std; +class FilePos{ + +public: + FilePos(){ + myPos = NULL; + next = NULL; + } + FilePos( fpos_t* thePos ) { + myPos = thePos; + next = NULL; + } + ~FilePos(){ + if( next != NULL ) delete next; + if( myPos != NULL ) delete myPos; + } + + void add( fpos_t *thePos ){ + if( next != NULL ) + next->add( thePos ); + else + next = new FilePos( thePos ); + } + + FilePos &operator=(fpos_t *thePos){ myPos = thePos; return *this; } + + void setPos( fpos_t *thePos ){ myPos = thePos; } + fpos_t *getPos( void ){ return myPos; } + + FilePos* getNext( void ) { return next; } +private: + + fpos_t *myPos; + FilePos* next; + +}; + class DumpWriter{ public: @@ -56,29 +98,40 @@ class InitializeFromFile{ (private) private: char* parseDumpLine(char* line, int atomIndex); - char* parseBoxLine(char* line, double boxMat[9] ); + char* parseBoxLine(char* line, double boxMat[9], double &time ); FILE *c_in_file; char c_in_name[500]; SimInfo* simnfo; }; class DumpReader{ + +public: DumpReader( char *in_name ); ~DumpReader(); int getNframes(); - void getNextFrame(); - void getFrame(SimInfo* the_entry_plug, int whichFrame) - void rewind(); + void scanFile( void ); + void getNextFrame() {} + void readFrame(SimInfo* the_simnfo, int whichFrame); + private: + + void readSet( int whichFrame ); char* parseDumpLine(char* line, int atomIndex); - char* parseCommentLine(char* line, double time, double boxMat[9] ); - FILE *c_in_file; - char c_in_name[500]; - SimInfo* simnfo; + char* parseCommentLine(char* line, double &time, double boxMat[9] ); + FILE *inFile; + char inName[500]; + bool isScanned; + int nFrames; + + FilePos** frameStart; + FilePos* headFP; + + SimInfo *simnfo; }; -public: + #endif