ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/io/DumpReader.cpp
(Generate patch)

Comparing branches/development/src/io/DumpReader.cpp (file contents):
Revision 1787 by gezelter, Wed Aug 29 18:13:11 2012 UTC vs.
Revision 1871 by gezelter, Fri May 10 14:59:13 2013 UTC

# Line 35 | Line 35
35   *                                                                      
36   * [1]  Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).            
37   * [2]  Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).          
38 < * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008).          
38 > * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008).          
39   * [4]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010).
40   * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
41   */
# Line 75 | Line 75 | namespace OpenMD {
75      if (worldRank == 0) {
76   #endif
77        
78 <      inFile_ = new std::ifstream(filename_.c_str());
78 >      inFile_ = new std::ifstream(filename_.c_str(),  
79 >                                  ifstream::in | ifstream::binary);
80        
81        if (inFile_->fail()) {
82          sprintf(painCave.errMsg,
# Line 140 | Line 141 | namespace OpenMD {
141        prevPos = currPos;
142        bool foundOpenSnapshotTag = false;
143        bool foundClosedSnapshotTag = false;
144 <      bool foundOpenSiteDataTag = false;
144 >
145        while(inFile_->getline(buffer, bufferSize)) {
146          ++lineNo;
147          
# Line 201 | Line 202 | namespace OpenMD {
202   #ifdef IS_MPI
203      }
204      
205 <    MPI_Bcast(&nframes_, 1, MPI_INT, 0, MPI_COMM_WORLD);
205 >    MPI::COMM_WORLD.Bcast(&nframes_, 1, MPI::INT, 0);
206      
207   #endif // is_mpi
208      
# Line 287 | Line 288 | namespace OpenMD {
288        }
289  
290        int sendBufferSize = sendBuffer.size();
291 <      MPI_Bcast(&sendBufferSize, 1, MPI_INT, masterNode, MPI_COMM_WORLD);    
292 <      MPI_Bcast((void *)sendBuffer.c_str(), sendBufferSize, MPI_CHAR, masterNode, MPI_COMM_WORLD);    
291 >      MPI::COMM_WORLD.Bcast(&sendBufferSize, 1, MPI::INT, masterNode);    
292 >      MPI::COMM_WORLD.Bcast((void *)sendBuffer.c_str(), sendBufferSize,
293 >                            MPI::CHAR, masterNode);    
294        
295        sstream.str(sendBuffer);
296      } else {
297        int sendBufferSize;
298 <      MPI_Bcast(&sendBufferSize, 1, MPI_INT, masterNode, MPI_COMM_WORLD);    
298 >      MPI::COMM_WORLD.Bcast(&sendBufferSize, 1, MPI::INT, masterNode);
299        char * recvBuffer = new char[sendBufferSize+1];
300        assert(recvBuffer);
301        recvBuffer[sendBufferSize] = '\0';
302 <      MPI_Bcast(recvBuffer, sendBufferSize, MPI_CHAR, masterNode, MPI_COMM_WORLD);    
302 >      MPI::COMM_WORLD.Bcast(recvBuffer, sendBufferSize, MPI::CHAR, masterNode);
303        sstream.str(recvBuffer);
304        delete [] recvBuffer;
305      }      
# Line 525 | Line 527 | namespace OpenMD {
527  
528      StringTokenizer tokenizer(line);
529      int nTokens;
530 <    
530 >        
531      nTokens = tokenizer.countTokens();
532      
533      if (nTokens < 2) {  
# Line 645 | Line 647 | namespace OpenMD {
647  
648    void  DumpReader::readSiteData(std::istream& inputStream) {
649  
648    inputStream.getline(buffer, bufferSize);
650      std::string line(buffer);
651 +
652 +    // We already found the starting <SiteData> tag or we wouldn't be
653 +    // here, so just start parsing until we get to the ending
654 +    // </SiteData> tag:
655      
651    if (line.find("<SiteData>") == std::string::npos) {
652      // site data isn't required for a simulation, so skip
653      return;
654    }
655
656      while(inputStream.getline(buffer, bufferSize)) {
657        line = buffer;
658        

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines