| 99 |
|
#ifdef IS_MPI |
| 100 |
|
int streamSize; |
| 101 |
|
const int masterNode = 0; |
| 102 |
< |
int commStatus; |
| 102 |
> |
|
| 103 |
|
if (worldRank == masterNode) { |
| 104 |
< |
commStatus = MPI_Bcast(&mdFileVersion, 1, MPI_INT, masterNode, MPI_COMM_WORLD); |
| 104 |
> |
MPI::COMM_WORLD.Bcast(&mdFileVersion, 1, MPI::INT, masterNode); |
| 105 |
|
#endif |
| 106 |
|
SimplePreprocessor preprocessor; |
| 107 |
|
preprocessor.preprocess(rawMetaDataStream, filename, startOfMetaDataBlock, ppStream); |
| 109 |
|
#ifdef IS_MPI |
| 110 |
|
//brocasting the stream size |
| 111 |
|
streamSize = ppStream.str().size() +1; |
| 112 |
< |
commStatus = MPI_Bcast(&streamSize, 1, MPI_LONG, masterNode, MPI_COMM_WORLD); |
| 113 |
< |
|
| 114 |
< |
commStatus = MPI_Bcast(static_cast<void*>(const_cast<char*>(ppStream.str().c_str())), streamSize, MPI_CHAR, masterNode, MPI_COMM_WORLD); |
| 115 |
< |
|
| 116 |
< |
|
| 112 |
> |
MPI::COMM_WORLD.Bcast(&streamSize, 1, MPI::LONG, masterNode); |
| 113 |
> |
MPI::COMM_WORLD.Bcast(static_cast<void*>(const_cast<char*>(ppStream.str().c_str())), streamSize, MPI::CHAR, masterNode); |
| 114 |
> |
|
| 115 |
|
} else { |
| 116 |
+ |
MPI::COMM_WORLD.Bcast(&mdFileVersion, 1, MPI::INT, masterNode); |
| 117 |
|
|
| 119 |
– |
commStatus = MPI_Bcast(&mdFileVersion, 1, MPI_INT, masterNode, MPI_COMM_WORLD); |
| 120 |
– |
|
| 118 |
|
//get stream size |
| 119 |
< |
commStatus = MPI_Bcast(&streamSize, 1, MPI_LONG, masterNode, MPI_COMM_WORLD); |
| 119 |
> |
MPI::COMM_WORLD.Bcast(&streamSize, 1, MPI::LONG, masterNode); |
| 120 |
|
|
| 121 |
|
char* buf = new char[streamSize]; |
| 122 |
|
assert(buf); |
| 123 |
|
|
| 124 |
|
//receive file content |
| 125 |
< |
commStatus = MPI_Bcast(buf, streamSize, MPI_CHAR, masterNode, MPI_COMM_WORLD); |
| 125 |
> |
MPI::COMM_WORLD.Bcast(buf, streamSize, MPI::CHAR, masterNode); |
| 126 |
|
|
| 127 |
|
ppStream.str(buf); |
| 128 |
|
delete [] buf; |
| 132 |
– |
|
| 129 |
|
} |
| 130 |
|
#endif |
| 131 |
|
// Create a scanner that reads from the input stream |
| 250 |
|
std::string mdRawData; |
| 251 |
|
int metaDataBlockStart = -1; |
| 252 |
|
int metaDataBlockEnd = -1; |
| 253 |
< |
int i; |
| 253 |
> |
int i, j; |
| 254 |
|
streamoff mdOffset; |
| 255 |
|
int mdFileVersion; |
| 256 |
|
|
| 257 |
+ |
// Create a string for embedding the version information in the MetaData |
| 258 |
+ |
std::string version; |
| 259 |
+ |
version.assign("## Last run using OpenMD Version: "); |
| 260 |
+ |
version.append(OPENMD_VERSION_MAJOR); |
| 261 |
+ |
version.append("."); |
| 262 |
+ |
version.append(OPENMD_VERSION_MINOR); |
| 263 |
|
|
| 264 |
+ |
std::string svnrev; |
| 265 |
+ |
//convert a macro from compiler to a string in c++ |
| 266 |
+ |
STR_DEFINE(svnrev, SVN_REV ); |
| 267 |
+ |
version.append(" Revision: "); |
| 268 |
+ |
// If there's no SVN revision, just call this the RELEASE revision. |
| 269 |
+ |
if (!svnrev.empty()) { |
| 270 |
+ |
version.append(svnrev); |
| 271 |
+ |
} else { |
| 272 |
+ |
version.append("RELEASE"); |
| 273 |
+ |
} |
| 274 |
+ |
|
| 275 |
|
#ifdef IS_MPI |
| 276 |
|
const int masterNode = 0; |
| 277 |
|
if (worldRank == masterNode) { |
| 366 |
|
|
| 367 |
|
mdRawData.clear(); |
| 368 |
|
|
| 369 |
+ |
bool foundVersion = false; |
| 370 |
+ |
|
| 371 |
|
for (int i = 0; i < metaDataBlockEnd - metaDataBlockStart - 1; ++i) { |
| 372 |
|
mdFile_.getline(buffer, bufferSize); |
| 373 |
< |
mdRawData += buffer; |
| 373 |
> |
std::string line = trimLeftCopy(buffer); |
| 374 |
> |
j = CaseInsensitiveFind(line, "## Last run using OpenMD Version"); |
| 375 |
> |
if (static_cast<size_t>(j) != string::npos) { |
| 376 |
> |
foundVersion = true; |
| 377 |
> |
mdRawData += version; |
| 378 |
> |
} else { |
| 379 |
> |
mdRawData += buffer; |
| 380 |
> |
} |
| 381 |
|
mdRawData += "\n"; |
| 382 |
|
} |
| 383 |
< |
|
| 383 |
> |
|
| 384 |
> |
if (!foundVersion) mdRawData += version + "\n"; |
| 385 |
> |
|
| 386 |
|
mdFile_.close(); |
| 387 |
|
|
| 388 |
|
#ifdef IS_MPI |
| 522 |
|
int nTarget; |
| 523 |
|
int done; |
| 524 |
|
int i; |
| 501 |
– |
int j; |
| 525 |
|
int loops; |
| 526 |
|
int which_proc; |
| 527 |
|
int nProcessors; |
| 791 |
|
} |
| 792 |
|
} |
| 793 |
|
|
| 794 |
< |
if (simParams->getOutputElectricField()) { |
| 794 |
> |
if (simParams->getOutputElectricField() | simParams->haveElectricField()) { |
| 795 |
|
storageLayout |= DataStorage::dslElectricField; |
| 796 |
|
} |
| 797 |
|
|
| 801 |
|
storageLayout |= DataStorage::dslFlucQForce; |
| 802 |
|
} |
| 803 |
|
|
| 804 |
+ |
info->setStorageLayout(storageLayout); |
| 805 |
+ |
|
| 806 |
|
return storageLayout; |
| 807 |
|
} |
| 808 |
|
|
| 965 |
|
} |
| 966 |
|
|
| 967 |
|
void SimCreator::loadCoordinates(SimInfo* info, const std::string& mdFileName) { |
| 943 |
– |
Globals* simParams; |
| 944 |
– |
|
| 945 |
– |
simParams = info->getSimParams(); |
| 968 |
|
|
| 969 |
|
DumpReader reader(info, mdFileName); |
| 970 |
|
int nframes = reader.getNFrames(); |
| 971 |
< |
|
| 971 |
> |
|
| 972 |
|
if (nframes > 0) { |
| 973 |
|
reader.readFrame(nframes - 1); |
| 974 |
|
} else { |