-
Notifications
You must be signed in to change notification settings - Fork 1
/
CoordinateInfo.cpp
52 lines (50 loc) · 1.69 KB
/
CoordinateInfo.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include "CoordinateInfo.h"
#include "CpptrajStdio.h"
void CoordinateInfo::PrintCoordInfo(const char* name, const char* parm) const {
mprintf("DBG: '%s' parm '%s' CoordInfo={ box type %s", name, parm, box_.TypeName());
if (remdDim_.Ndims() > 0) mprintf(", %i rep dims", remdDim_.Ndims());
if (hasVel_) mprintf(", velocities");
if (hasTemp_) mprintf(", temps");
if (hasTime_) mprintf(", times");
if (hasFrc_) mprintf(", forces");
if (ensembleSize_ > 0) mprintf(", ensemble size %i", ensembleSize_);
mprintf(" }\n");
}
#ifdef MPI
int CoordinateInfo::SyncCoordInfo(Parallel::Comm const& commIn) {
// ensSize, hasvel, hastemp, hastime, hasfrc, NrepDims, Dim1, ..., DimN,
int* iArray;
int iSize;
if (commIn.Master()) {
iSize = remdDim_.Ndims() + 6;
commIn.MasterBcast( &iSize, 1, MPI_INT );
iArray = new int[ iSize ];
iArray[0] = ensembleSize_;
iArray[1] = (int)hasVel_;
iArray[2] = (int)hasTemp_;
iArray[3] = (int)hasTime_;
iArray[4] = (int)hasFrc_;
iArray[5] = remdDim_.Ndims();
unsigned int ii = 6;
for (int ir = 0; ir != remdDim_.Ndims(); ir++, ii++)
iArray[ii] = remdDim_[ir];
commIn.MasterBcast( iArray, iSize, MPI_INT );
} else {
commIn.MasterBcast( &iSize, 1, MPI_INT );
iArray = new int[ iSize ];
commIn.MasterBcast( iArray, iSize, MPI_INT );
ensembleSize_ = iArray[0];
hasVel_ = (bool)iArray[1];
hasTemp_ = (bool)iArray[2];
hasTime_ = (bool)iArray[3];
hasFrc_ = (bool)iArray[4];
remdDim_.clear();
unsigned int ii = 6;
for (int ir = 0; ir != iArray[5]; ir++, ii++)
remdDim_.AddRemdDimension( iArray[ii] );
}
delete[] iArray;
box_.SyncBox( commIn );
return 0;
}
#endif