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

Comparing trunk/OOPSE/libmdtools/DumpWriter.cpp (file contents):
Revision 934 by tim, Tue Jan 13 20:04:28 2004 UTC vs.
Revision 936 by tim, Tue Jan 13 20:35:25 2004 UTC

# Line 40 | Line 40 | DumpWriter::DumpWriter( SimInfo* the_entry_plug ){
40        simError();
41      }
42  
43    finalOut.open( entry_plug->finalName, ios::out | ios::trunc );
44    if( !finalOut ){
45      sprintf( painCave.errMsg,
46               "Could not open \"%s\" for final dump output.\n",
47               entry_plug->finalName );
48      painCave.isFatal = 1;
49      simError();
50    }
51
43   #ifdef IS_MPI
44    }
45  
# Line 68 | Line 59 | DumpWriter::~DumpWriter( ){
59   #endif // is_mpi
60  
61      dumpFile.close();
71    finalOut.close();
62  
63   #ifdef IS_MPI
64    }
# Line 111 | Line 101 | void DumpWriter::writeDump(double currentTime){
101  
102   void DumpWriter::writeDump(double currentTime){
103  
104 +  ofstream finalOut;
105    vector<ofstream*> fileStreams;
106  
107   #ifdef IS_MPI
108    if(worldRank == 0 ){
109 <    finalOut.seekp(0);
109 >    
110 >    finalOut.open( entry_plug->finalName, ios::out | ios::trunc );
111 >    if( !finalOut ){
112 >      sprintf( painCave.errMsg,
113 >               "Could not open \"%s\" for final dump output.\n",
114 >               entry_plug->finalName );
115 >      painCave.isFatal = 1;
116 >      simError();
117 >    }
118    }
119   #endif // is_mpi
120  
# Line 123 | Line 122 | void DumpWriter::writeDump(double currentTime){
122    fileStreams.push_back(&dumpFile);
123  
124    writeFrame(fileStreams, currentTime);
125 +
126 + #ifdef IS_MPI
127 +  finalOut.close();
128 + #endif
129          
130   }
131  
132   void DumpWriter::writeFinal(double currentTime){
133  
134 +  ofstream finalOut;
135    vector<ofstream*> fileStreams;
136  
137   #ifdef IS_MPI
138    if(worldRank == 0 ){
139 <    finalOut.seekp(0);
139 >
140 >    finalOut.open( entry_plug->finalName, ios::out | ios::trunc );
141 >
142 >    if( !finalOut ){
143 >      sprintf( painCave.errMsg,
144 >               "Could not open \"%s\" for final dump output.\n",
145 >               entry_plug->finalName );
146 >      painCave.isFatal = 1;
147 >      simError();
148 >    }
149 >
150    }
151   #endif // is_mpi
152    
153    fileStreams.push_back(&finalOut);  
154    writeFrame(fileStreams, currentTime);
155 +
156 + #ifdef IS_MPI
157 +  finalOut.close();
158 + #endif
159    
160   }
161  
# Line 146 | Line 164 | void DumpWriter::writeFrame( vector<ofstream*>& outFil
164    const int BUFFERSIZE = 2000;
165    const int MINIBUFFERSIZE = 100;
166  
167 <  char tempBuffer[BUFFERSIZE];
167 >  char tempBuffer[BUFFERSIZE];  
168    char writeLine[BUFFERSIZE];
169  
170    int i, k;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines