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

Comparing trunk/src/brains/SimCreator.cpp (file contents):
Revision 1809 by gezelter, Wed Oct 3 14:07:28 2012 UTC vs.
Revision 1810 by gezelter, Thu Nov 8 14:23:43 2012 UTC

# Line 255 | Line 255 | namespace OpenMD {
255      std::string mdRawData;
256      int metaDataBlockStart = -1;
257      int metaDataBlockEnd = -1;
258 <    int i;
258 >    int i, j;
259      streamoff mdOffset(0);
260      int mdFileVersion;
261  
262 +    // Create a string for embedding the version information in the MetaData
263 +    std::string version;
264 +    version.assign("## Last run using OpenMD Version: ");
265 +    version.append(OPENMD_VERSION_MAJOR);
266 +    version.append(".");
267 +    version.append(OPENMD_VERSION_MINOR);
268  
269 +    std::string svnrev;
270 +    //convert a macro from compiler to a string in c++
271 +    STR_DEFINE(svnrev, SVN_REV );
272 +    version.append(" Revision: ");
273 +    // If there's no SVN revision, just call this the RELEASE revision.
274 +    if (!svnrev.empty()) {
275 +      version.append(svnrev);
276 +    } else {
277 +      version.append("RELEASE");
278 +    }
279 +  
280   #ifdef IS_MPI            
281      const int masterNode = 0;
282      if (worldRank == masterNode) {
# Line 354 | Line 371 | namespace OpenMD {
371  
372        mdRawData.clear();
373  
374 +      bool foundVersion = false;
375 +
376        for (int i = 0; i < metaDataBlockEnd - metaDataBlockStart - 1; ++i) {
377          mdFile_.getline(buffer, bufferSize);
378 <        mdRawData += buffer;
378 >        std::string line = trimLeftCopy(buffer);
379 >        j = CaseInsensitiveFind(line, "## Last run using OpenMD Version");
380 >        if (static_cast<size_t>(j) != string::npos) {
381 >          foundVersion = true;
382 >          mdRawData += version;
383 >        } else {
384 >          mdRawData += buffer;
385 >        }
386          mdRawData += "\n";
387        }
388 <
388 >      
389 >      if (!foundVersion) mdRawData += version + "\n";
390 >      
391        mdFile_.close();
392  
393   #ifdef IS_MPI

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines