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

Comparing branches/development/src/brains/SimCreator.cpp (file contents):
Revision 1808 by gezelter, Mon Oct 22 20:42:10 2012 UTC vs.
Revision 1826 by gezelter, Wed Jan 9 19:41:48 2013 UTC

# Line 254 | Line 254 | namespace OpenMD {
254      std::string mdRawData;
255      int metaDataBlockStart = -1;
256      int metaDataBlockEnd = -1;
257 <    int i;
257 >    int i, j;
258      streamoff mdOffset;
259      int mdFileVersion;
260  
261 +    // Create a string for embedding the version information in the MetaData
262 +    std::string version;
263 +    version.assign("## Last run using OpenMD Version: ");
264 +    version.append(OPENMD_VERSION_MAJOR);
265 +    version.append(".");
266 +    version.append(OPENMD_VERSION_MINOR);
267  
268 +    std::string svnrev;
269 +    //convert a macro from compiler to a string in c++
270 +    STR_DEFINE(svnrev, SVN_REV );
271 +    version.append(" Revision: ");
272 +    // If there's no SVN revision, just call this the RELEASE revision.
273 +    if (!svnrev.empty()) {
274 +      version.append(svnrev);
275 +    } else {
276 +      version.append("RELEASE");
277 +    }
278 +  
279   #ifdef IS_MPI            
280      const int masterNode = 0;
281      if (worldRank == masterNode) {
# Line 352 | Line 369 | namespace OpenMD {
369        mdFile_.seekg(mdOffset);
370  
371        mdRawData.clear();
372 +
373 +      bool foundVersion = false;
374  
375        for (int i = 0; i < metaDataBlockEnd - metaDataBlockStart - 1; ++i) {
376          mdFile_.getline(buffer, bufferSize);
377 <        mdRawData += buffer;
377 >        std::string line = trimLeftCopy(buffer);
378 >        j = CaseInsensitiveFind(line, "## Last run using OpenMD Version");
379 >        if (static_cast<size_t>(j) != string::npos) {
380 >          foundVersion = true;
381 >          mdRawData += version;
382 >        } else {
383 >          mdRawData += buffer;
384 >        }
385          mdRawData += "\n";
386        }
387 <
387 >      
388 >      if (!foundVersion) mdRawData += version + "\n";
389 >      
390        mdFile_.close();
391  
392   #ifdef IS_MPI
# Line 498 | Line 526 | namespace OpenMD {
526      int nTarget;
527      int done;
528      int i;
501    int j;
529      int loops;
530      int which_proc;
531      int nProcessors;
# Line 940 | Line 967 | namespace OpenMD {
967    }
968    
969    void SimCreator::loadCoordinates(SimInfo* info, const std::string& mdFileName) {
943    Globals* simParams;
944
945    simParams = info->getSimParams();
970      
971      DumpReader reader(info, mdFileName);
972      int nframes = reader.getNFrames();
973 <
973 >    
974      if (nframes > 0) {
975        reader.readFrame(nframes - 1);
976      } else {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines