ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/ReadWrite.hpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/ReadWrite.hpp (file contents):
Revision 646 by mmeineke, Tue Jul 22 20:05:30 2003 UTC vs.
Revision 1078 by tim, Tue Mar 2 20:32:40 2004 UTC

# Line 1 | Line 1
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  
8 < #include <cstring>
9 < #include <cstdio>
10 < #include <cstdlib>
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  
15  
16   #include "Atom.hpp"
# Line 15 | Line 19 | using namespace std;
19  
20   using namespace std;
21  
22 + class FilePos{
23  
24 + public:
25 +  FilePos(){
26 +    myPos = NULL;
27 +    next = NULL;
28 +  }
29 +  FilePos( fpos_t* thePos ) {
30 +    myPos = thePos;
31 +    next = NULL;
32 +  }
33 +  ~FilePos(){
34 +    if( next  != NULL ) delete next;
35 +    if( myPos != NULL ) delete myPos;
36 +  }
37  
38 +  void add( fpos_t *thePos ){
39 +    if( next != NULL )
40 +      next->add( thePos );
41 +    else
42 +      next = new FilePos( thePos );
43 +  }
44  
45 +  FilePos &operator=(fpos_t *thePos){ myPos = thePos; return *this; }
46 +
47 +  void setPos( fpos_t *thePos ){ myPos = thePos; }
48 +  fpos_t *getPos( void ){ return myPos; }
49 +
50 +  FilePos* getNext( void ) { return next; }
51 + private:
52 +
53 +  fpos_t *myPos;
54 +  FilePos* next;
55 +
56 + };
57 +
58   class DumpWriter{
59  
60   public:
# Line 25 | Line 62 | class DumpWriter{ (public)
62    ~DumpWriter();
63  
64    void writeDump( double currentTime );
65 <  void writeFinal( double finalTime );
65 >  void writeFinal( double currentTime);
66 >  void writeFrame( vector<ofstream*>& outFile, double finalTime );
67  
68 + #ifdef IS_MPI
69 +  void update();
70 + #endif
71 +
72   private:
73 +
74 + #ifdef IS_MPI
75 +  void sortByGlobalIndex();
76 + #endif
77 +
78    SimInfo* entry_plug;
79 <  ofstream outFile;
80 <  char outName[500];
79 >  ofstream dumpFile;
80 >
81 > #ifdef IS_MPI
82 >  vector<pair<int, int> > indexArray;
83 > #endif
84   };
85  
86   class StatWriter{
# Line 40 | Line 90 | class StatWriter{ (public)
90    ~StatWriter();
91  
92    void writeStat( double currentTime );
93 <  
93 >
94   private:
95 <  
95 >
96    SimInfo* entry_plug;
97    ofstream outFile;
98    char outName[500];
# Line 57 | Line 107 | class InitializeFromFile{ (public)
107    ~InitializeFromFile();
108  
109    void readInit( SimInfo* the_entry_plug );
110 <  
110 >
111   private:
112    char* parseDumpLine(char* line, int atomIndex);
113 <  char* parseBoxLine(char* line, double boxMat[9], double &time );
113 >  char* parseCommentLine(char* line, SimInfo* entry_plug);
114    FILE *c_in_file;
115    char c_in_name[500];
116    SimInfo* simnfo;
# Line 69 | Line 119 | class DumpReader{ (public)
119   class DumpReader{
120  
121   public:
122 <  DumpReader( char *in_name );
122 >  DumpReader(const char *in_name );
123    ~DumpReader();
124  
125    int getNframes();
76  void getNextFrame();
77  void getFrame(SimInfo* the_entry_plug, int whichFrame);
78  void rewind();
126    void scanFile( void );
127  
128 +  void getNextFrame() {}
129 +  void readFrame(SimInfo* the_simnfo, int whichFrame);
130 +
131   private:
132 +
133 +  void readSet( int whichFrame );
134    char* parseDumpLine(char* line, int atomIndex);
135    char* parseCommentLine(char* line, double &time, double boxMat[9] );
136 <  FILE *c_in_file;
137 <  char c_in_name[500];
138 <  SimInfo* simnfo;
136 >  FILE *inFile;
137 >  char inName[500];
138 >  bool isScanned;
139 >  int nFrames;
140 >
141 >  FilePos** frameStart;
142 >  FilePos* headFP;
143 >
144 >  SimInfo *simnfo;
145   };
146  
147  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines