1 |
< |
#define _LARGEFILE_SOURCE64 |
2 |
< |
#define _FILE_OFFSET_BITS 64 |
1 |
> |
#include "io/DumpWrite.hpp" |
2 |
> |
#include "utils/simError.h" |
3 |
|
|
4 |
– |
#include <string.h> |
5 |
– |
#include <iostream> |
6 |
– |
#include <fstream> |
7 |
– |
#include <algorithm> |
8 |
– |
#include <utility> |
9 |
– |
|
4 |
|
#ifdef IS_MPI |
5 |
|
#include <mpi.h> |
12 |
– |
#include "brains/mpiSimulation.hpp" |
13 |
– |
|
14 |
– |
namespace dWrite{ |
15 |
– |
void DieDieDie( void ); |
16 |
– |
} |
17 |
– |
|
18 |
– |
using namespace dWrite; |
6 |
|
#endif //is_mpi |
7 |
+ |
namespace oopse { |
8 |
+ |
DumpWriter::DumpWriter(SimInfo* info, const std::string& filename) |
9 |
+ |
: info_(info), filename_(filename){ |
10 |
+ |
#ifdef IS_MPI |
11 |
|
|
12 |
< |
#include "io/ReadWrite.hpp" |
13 |
< |
#include "utils/simError.h" |
12 |
> |
if (worldRank == 0) { |
13 |
> |
#endif // is_mpi |
14 |
|
|
15 |
< |
DumpWriter::DumpWriter( SimInfo* the_entry_plug ){ |
15 |
> |
dumpFile.open(filename_.c_str(), ios::out | ios::trunc); |
16 |
|
|
17 |
< |
entry_plug = the_entry_plug; |
17 |
> |
if (!dumpFile) { |
18 |
> |
sprintf(painCave.errMsg, "Could not open \"%s\" for dump output.\n", |
19 |
> |
info_->filename_.c_str()); |
20 |
> |
painCave.isFatal = 1; |
21 |
> |
simError(); |
22 |
> |
} |
23 |
|
|
24 |
|
#ifdef IS_MPI |
29 |
– |
if(worldRank == 0 ){ |
30 |
– |
#endif // is_mpi |
25 |
|
|
32 |
– |
dumpFile.open(entry_plug->sampleName.c_str(), ios::out | ios::trunc ); |
33 |
– |
|
34 |
– |
if( !dumpFile ){ |
35 |
– |
|
36 |
– |
sprintf( painCave.errMsg, |
37 |
– |
"Could not open \"%s\" for dump output.\n", |
38 |
– |
entry_plug->sampleName.c_str()); |
39 |
– |
painCave.isFatal = 1; |
40 |
– |
simError(); |
26 |
|
} |
27 |
|
|
28 |
< |
#ifdef IS_MPI |
29 |
< |
} |
28 |
> |
sprintf(checkPointMsg, "Sucessfully opened output file for dumping.\n"); |
29 |
> |
MPIcheckPoint(); |
30 |
|
|
46 |
– |
//sort the local atoms by global index |
47 |
– |
sortByGlobalIndex(); |
48 |
– |
|
49 |
– |
sprintf( checkPointMsg, |
50 |
– |
"Sucessfully opened output file for dumping.\n"); |
51 |
– |
MPIcheckPoint(); |
31 |
|
#endif // is_mpi |
32 |
+ |
|
33 |
|
} |
34 |
|
|
35 |
< |
DumpWriter::~DumpWriter( ){ |
35 |
> |
DumpWriter::~DumpWriter() { |
36 |
|
|
37 |
|
#ifdef IS_MPI |
38 |
< |
if(worldRank == 0 ){ |
38 |
> |
|
39 |
> |
if (worldRank == 0) { |
40 |
|
#endif // is_mpi |
41 |
|
|
42 |
< |
dumpFile.close(); |
42 |
> |
dumpFile.close(); |
43 |
|
|
44 |
|
#ifdef IS_MPI |
64 |
– |
} |
65 |
– |
#endif // is_mpi |
66 |
– |
} |
45 |
|
|
46 |
< |
#ifdef IS_MPI |
46 |
> |
} |
47 |
|
|
48 |
< |
/** |
71 |
< |
* A hook function to load balancing |
72 |
< |
*/ |
48 |
> |
#endif // is_mpi |
49 |
|
|
74 |
– |
void DumpWriter::update(){ |
75 |
– |
sortByGlobalIndex(); |
50 |
|
} |
77 |
– |
|
78 |
– |
/** |
79 |
– |
* Auxiliary sorting function |
80 |
– |
*/ |
81 |
– |
|
82 |
– |
bool indexSortingCriterion(const pair<int, int>& p1, const pair<int, int>& p2){ |
83 |
– |
return p1.second < p2.second; |
84 |
– |
} |
51 |
|
|
52 |
< |
/** |
87 |
< |
* Sorting the local index by global index |
88 |
< |
*/ |
89 |
< |
|
90 |
< |
void DumpWriter::sortByGlobalIndex(){ |
91 |
< |
Molecule* mols = entry_plug->molecules; |
92 |
< |
indexArray.clear(); |
93 |
< |
|
94 |
< |
for(int i = 0; i < entry_plug->n_mol;i++) |
95 |
< |
indexArray.push_back(make_pair(i, mols[i].getGlobalIndex())); |
96 |
< |
|
97 |
< |
sort(indexArray.begin(), indexArray.end(), indexSortingCriterion); |
98 |
< |
} |
52 |
> |
void writeCommentLine(Snapshot* s) { |
53 |
|
|
54 |
< |
#endif |
54 |
> |
double currentTime; |
55 |
> |
Mat3x3d hmat; |
56 |
> |
double chi; |
57 |
> |
double integralOfChiDt; |
58 |
> |
Mat3x3d eta; |
59 |
> |
|
60 |
> |
currentTime = s->getTime(); |
61 |
> |
hmat = s->getHmat(); |
62 |
> |
chi = s->getChi(); |
63 |
> |
integralOfChiDt = s->getIntegralOfChiDt(); |
64 |
> |
eta = s->getEta(); |
65 |
> |
|
66 |
> |
os << currentTime << ";\t" |
67 |
> |
<< hmat[0][0] << "\t" << hmat[1][0] << "\t" << hmat[2][0] << ";\t" |
68 |
> |
<< hmat[0][1] << "\t" << hmat[1][1] << "\t" << hmat[2][1] << ";\t" |
69 |
> |
<< hmat[0][2] << "\t" << hmat[1][2] << "\t" << hmat[2][2] << ";"; |
70 |
|
|
71 |
< |
void DumpWriter::writeDump(double currentTime){ |
71 |
> |
//write out additional parameters, such as chi and eta |
72 |
|
|
73 |
< |
ofstream finalOut; |
105 |
< |
vector<ofstream*> fileStreams; |
73 |
> |
os << chi << "\t" << integralOfChiDt << "\t;" |
74 |
|
|
75 |
< |
#ifdef IS_MPI |
76 |
< |
if(worldRank == 0 ){ |
77 |
< |
#endif |
78 |
< |
finalOut.open( entry_plug->finalName.c_str(), ios::out | ios::trunc ); |
79 |
< |
if( !finalOut ){ |
80 |
< |
sprintf( painCave.errMsg, |
113 |
< |
"Could not open \"%s\" for final dump output.\n", |
114 |
< |
entry_plug->finalName.c_str() ); |
115 |
< |
painCave.isFatal = 1; |
116 |
< |
simError(); |
117 |
< |
} |
118 |
< |
#ifdef IS_MPI |
119 |
< |
} |
120 |
< |
#endif // is_mpi |
75 |
> |
os << eta[0][0] << "\t" << eta[1][0] << "\t" << eta[2][0] << ";\t" |
76 |
> |
<< eta[0][1] << "\t" << eta[1][1] << "\t" << eta[2][1] << ";\t" |
77 |
> |
<< eta[0][2] << "\t" << eta[1][2] << "\t" << eta[2][2] << ";"; |
78 |
> |
|
79 |
> |
os << endl; |
80 |
> |
} |
81 |
|
|
82 |
< |
fileStreams.push_back(&finalOut); |
83 |
< |
fileStreams.push_back(&dumpFile); |
82 |
> |
void DumpWriter::writeFrame(std::ostream& os) { |
83 |
> |
const int BUFFERSIZE = 2000; |
84 |
> |
const int MINIBUFFERSIZE = 100; |
85 |
|
|
86 |
< |
writeFrame(fileStreams, currentTime); |
86 |
> |
char tempBuffer[BUFFERSIZE]; |
87 |
> |
char writeLine[BUFFERSIZE]; |
88 |
|
|
89 |
< |
#ifdef IS_MPI |
90 |
< |
finalOut.close(); |
91 |
< |
#endif |
92 |
< |
|
131 |
< |
} |
89 |
> |
Quat4d q; |
90 |
> |
Vector3d ji; |
91 |
> |
Vector3d pos; |
92 |
> |
Vector3d vel; |
93 |
|
|
94 |
< |
void DumpWriter::writeFinal(double currentTime){ |
94 |
> |
Molecule* mol; |
95 |
> |
StuntDouble* integrableObject; |
96 |
> |
typename SimInfo::MoleculeIterator mi; |
97 |
> |
typename Molecule::IntegrableObjectIterator ii; |
98 |
> |
|
99 |
> |
int nTotObjects; |
100 |
> |
nTotObjects = info_->getNGlobalIntegrableObjects(); |
101 |
|
|
102 |
< |
ofstream finalOut; |
136 |
< |
vector<ofstream*> fileStreams; |
102 |
> |
#ifndef IS_MPI |
103 |
|
|
138 |
– |
#ifdef IS_MPI |
139 |
– |
if(worldRank == 0 ){ |
140 |
– |
#endif // is_mpi |
104 |
|
|
105 |
< |
finalOut.open( entry_plug->finalName.c_str(), ios::out | ios::trunc ); |
105 |
> |
os << nTotObjects << "\n"; |
106 |
> |
|
107 |
> |
writeCommentLine(info_->getSnapshotManager()->getCurrentSnapshot()); |
108 |
|
|
109 |
< |
if( !finalOut ){ |
145 |
< |
sprintf( painCave.errMsg, |
146 |
< |
"Could not open \"%s\" for final dump output.\n", |
147 |
< |
entry_plug->finalName.c_str() ); |
148 |
< |
painCave.isFatal = 1; |
149 |
< |
simError(); |
150 |
< |
} |
109 |
> |
for (mol = info_->beginMolecule(mi); mol != NULL; mol = info_->nextMolecule(mi)) { |
110 |
|
|
111 |
< |
#ifdef IS_MPI |
112 |
< |
} |
113 |
< |
#endif // is_mpi |
155 |
< |
|
156 |
< |
fileStreams.push_back(&finalOut); |
157 |
< |
writeFrame(fileStreams, currentTime); |
111 |
> |
for (integrableObject = mol->beginIntegrableObject(ii); integrableObject != NULL; |
112 |
> |
integrableObject = mol->nextIntegrableObject(ii)) { |
113 |
> |
|
114 |
|
|
115 |
< |
#ifdef IS_MPI |
116 |
< |
finalOut.close(); |
161 |
< |
#endif |
162 |
< |
|
163 |
< |
} |
115 |
> |
pos = integrableObject->getPos(); |
116 |
> |
vel = integrableObject->getVel(); |
117 |
|
|
118 |
< |
void DumpWriter::writeFrame( vector<ofstream*>& outFile, double currentTime ){ |
118 |
> |
sprintf(tempBuffer, "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", |
119 |
> |
integrableObject->getType(), |
120 |
> |
pos[0], pos[1], pos[2], |
121 |
> |
vel[0], vel[1], vel[2]); |
122 |
|
|
123 |
< |
const int BUFFERSIZE = 2000; |
168 |
< |
const int MINIBUFFERSIZE = 100; |
123 |
> |
strcpy(writeLine, tempBuffer); |
124 |
|
|
125 |
< |
char tempBuffer[BUFFERSIZE]; |
126 |
< |
char writeLine[BUFFERSIZE]; |
125 |
> |
if (integrableObject->isDirectional()) { |
126 |
> |
q = integrableObject->getQ(); |
127 |
> |
ji = integrableObject->getJ(); |
128 |
|
|
129 |
< |
int i; |
130 |
< |
unsigned int k; |
129 |
> |
sprintf(tempBuffer, "%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n", |
130 |
> |
q[0], q[1], q[2], q[3], |
131 |
> |
ji[0], ji[1], ji[2]); |
132 |
> |
strcat(writeLine, tempBuffer); |
133 |
> |
} else { |
134 |
> |
strcat(writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n"); |
135 |
> |
} |
136 |
|
|
137 |
< |
#ifdef IS_MPI |
177 |
< |
|
178 |
< |
/********************************************************************* |
179 |
< |
* Documentation? You want DOCUMENTATION? |
180 |
< |
* |
181 |
< |
* Why all the potatoes below? |
182 |
< |
* |
183 |
< |
* To make a long story short, the original version of DumpWriter |
184 |
< |
* worked in the most inefficient way possible. Node 0 would |
185 |
< |
* poke each of the node for an individual atom's formatted data |
186 |
< |
* as node 0 worked its way down the global index. This was particularly |
187 |
< |
* inefficient since the method blocked all processors at every atom |
188 |
< |
* (and did it twice!). |
189 |
< |
* |
190 |
< |
* An intermediate version of DumpWriter could be described from Node |
191 |
< |
* zero's perspective as follows: |
192 |
< |
* |
193 |
< |
* 1) Have 100 of your friends stand in a circle. |
194 |
< |
* 2) When you say go, have all of them start tossing potatoes at |
195 |
< |
* you (one at a time). |
196 |
< |
* 3) Catch the potatoes. |
197 |
< |
* |
198 |
< |
* It was an improvement, but MPI has buffers and caches that could |
199 |
< |
* best be described in this analogy as "potato nets", so there's no |
200 |
< |
* need to block the processors atom-by-atom. |
201 |
< |
* |
202 |
< |
* This new and improved DumpWriter works in an even more efficient |
203 |
< |
* way: |
204 |
< |
* |
205 |
< |
* 1) Have 100 of your friend stand in a circle. |
206 |
< |
* 2) When you say go, have them start tossing 5-pound bags of |
207 |
< |
* potatoes at you. |
208 |
< |
* 3) Once you've caught a friend's bag of potatoes, |
209 |
< |
* toss them a spud to let them know they can toss another bag. |
210 |
< |
* |
211 |
< |
* How's THAT for documentation? |
212 |
< |
* |
213 |
< |
*********************************************************************/ |
137 |
> |
os << writeLine; |
138 |
|
|
139 |
< |
int *potatoes; |
140 |
< |
int myPotato; |
139 |
> |
} |
140 |
> |
} |
141 |
|
|
142 |
< |
int nProc; |
143 |
< |
int j, which_node, done, which_atom, local_index, currentIndex; |
144 |
< |
double atomData[13]; |
145 |
< |
int isDirectional; |
146 |
< |
char* atomTypeString; |
147 |
< |
char MPIatomTypeString[MINIBUFFERSIZE]; |
148 |
< |
int nObjects; |
149 |
< |
int msgLen; // the length of message actually recieved at master nodes |
150 |
< |
#endif //is_mpi |
142 |
> |
#else // is_mpi |
143 |
> |
/********************************************************************* |
144 |
> |
* Documentation? You want DOCUMENTATION? |
145 |
> |
* |
146 |
> |
* Why all the potatoes below? |
147 |
> |
* |
148 |
> |
* To make a long story short, the original version of DumpWriter |
149 |
> |
* worked in the most inefficient way possible. Node 0 would |
150 |
> |
* poke each of the node for an individual atom's formatted data |
151 |
> |
* as node 0 worked its way down the global index. This was particularly |
152 |
> |
* inefficient since the method blocked all processors at every atom |
153 |
> |
* (and did it twice!). |
154 |
> |
* |
155 |
> |
* An intermediate version of DumpWriter could be described from Node |
156 |
> |
* zero's perspective as follows: |
157 |
> |
* |
158 |
> |
* 1) Have 100 of your friends stand in a circle. |
159 |
> |
* 2) When you say go, have all of them start tossing potatoes at |
160 |
> |
* you (one at a time). |
161 |
> |
* 3) Catch the potatoes. |
162 |
> |
* |
163 |
> |
* It was an improvement, but MPI has buffers and caches that could |
164 |
> |
* best be described in this analogy as "potato nets", so there's no |
165 |
> |
* need to block the processors atom-by-atom. |
166 |
> |
* |
167 |
> |
* This new and improved DumpWriter works in an even more efficient |
168 |
> |
* way: |
169 |
> |
* |
170 |
> |
* 1) Have 100 of your friend stand in a circle. |
171 |
> |
* 2) When you say go, have them start tossing 5-pound bags of |
172 |
> |
* potatoes at you. |
173 |
> |
* 3) Once you've caught a friend's bag of potatoes, |
174 |
> |
* toss them a spud to let them know they can toss another bag. |
175 |
> |
* |
176 |
> |
* How's THAT for documentation? |
177 |
> |
* |
178 |
> |
*********************************************************************/ |
179 |
> |
const int masterNode = 0; |
180 |
|
|
181 |
< |
double q[4], ji[3]; |
182 |
< |
DirectionalAtom* dAtom; |
183 |
< |
double pos[3], vel[3]; |
184 |
< |
int nTotObjects; |
185 |
< |
StuntDouble* sd; |
186 |
< |
char* molName; |
187 |
< |
vector<StuntDouble*> integrableObjects; |
188 |
< |
vector<StuntDouble*>::iterator iter; |
189 |
< |
nTotObjects = entry_plug->getTotIntegrableObjects(); |
190 |
< |
#ifndef IS_MPI |
191 |
< |
|
192 |
< |
for(k = 0; k < outFile.size(); k++){ |
240 |
< |
*outFile[k] << nTotObjects << "\n"; |
241 |
< |
|
242 |
< |
*outFile[k] << currentTime << ";\t" |
243 |
< |
<< entry_plug->Hmat[0][0] << "\t" |
244 |
< |
<< entry_plug->Hmat[1][0] << "\t" |
245 |
< |
<< entry_plug->Hmat[2][0] << ";\t" |
246 |
< |
|
247 |
< |
<< entry_plug->Hmat[0][1] << "\t" |
248 |
< |
<< entry_plug->Hmat[1][1] << "\t" |
249 |
< |
<< entry_plug->Hmat[2][1] << ";\t" |
250 |
< |
|
251 |
< |
<< entry_plug->Hmat[0][2] << "\t" |
252 |
< |
<< entry_plug->Hmat[1][2] << "\t" |
253 |
< |
<< entry_plug->Hmat[2][2] << ";"; |
254 |
< |
|
255 |
< |
//write out additional parameters, such as chi and eta |
256 |
< |
*outFile[k] << entry_plug->the_integrator->getAdditionalParameters() << endl; |
257 |
< |
} |
258 |
< |
|
259 |
< |
for( i=0; i< entry_plug->n_mol; i++ ){ |
260 |
< |
|
261 |
< |
integrableObjects = entry_plug->molecules[i].getIntegrableObjects(); |
262 |
< |
molName = (entry_plug->compStamps[entry_plug->molecules[i].getStampID()])->getID(); |
181 |
> |
int * potatoes; |
182 |
> |
int myPotato; |
183 |
> |
int nProc; |
184 |
> |
int which_node; |
185 |
> |
double atomData[13]; |
186 |
> |
int isDirectional; |
187 |
> |
const char * atomTypeString; |
188 |
> |
char MPIatomTypeString[MINIBUFFERSIZE]; |
189 |
> |
int msgLen; // the length of message actually recieved at master nodes |
190 |
> |
int haveError; |
191 |
> |
MPI_Status istatus; |
192 |
> |
int nCurObj; |
193 |
|
|
194 |
< |
for( iter = integrableObjects.begin();iter != integrableObjects.end(); ++iter){ |
195 |
< |
sd = *iter; |
196 |
< |
sd->getPos(pos); |
197 |
< |
sd->getVel(vel); |
194 |
> |
// code to find maximum tag value |
195 |
> |
int * tagub; |
196 |
> |
int flag; |
197 |
> |
int MAXTAG; |
198 |
> |
MPI_Attr_get(MPI_COMM_WORLD, MPI_TAG_UB, &tagub, &flag); |
199 |
|
|
200 |
< |
sprintf( tempBuffer, |
201 |
< |
"%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", |
202 |
< |
sd->getType(), |
203 |
< |
pos[0], |
204 |
< |
pos[1], |
274 |
< |
pos[2], |
275 |
< |
vel[0], |
276 |
< |
vel[1], |
277 |
< |
vel[2]); |
278 |
< |
strcpy( writeLine, tempBuffer ); |
200 |
> |
if (flag) { |
201 |
> |
MAXTAG = *tagub; |
202 |
> |
} else { |
203 |
> |
MAXTAG = 32767; |
204 |
> |
} |
205 |
|
|
206 |
< |
if( sd->isDirectional() ){ |
206 |
> |
if (worldRank == masterNode) { //master node (node 0) is responsible for writing the dump file |
207 |
|
|
208 |
< |
sd->getQ( q ); |
283 |
< |
sd->getJ( ji ); |
208 |
> |
// Node 0 needs a list of the magic potatoes for each processor; |
209 |
|
|
210 |
< |
sprintf( tempBuffer, |
211 |
< |
"%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n", |
287 |
< |
q[0], |
288 |
< |
q[1], |
289 |
< |
q[2], |
290 |
< |
q[3], |
291 |
< |
ji[0], |
292 |
< |
ji[1], |
293 |
< |
ji[2]); |
294 |
< |
strcat( writeLine, tempBuffer ); |
295 |
< |
} |
296 |
< |
else |
297 |
< |
strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" ); |
298 |
< |
|
299 |
< |
for(k = 0; k < outFile.size(); k++) |
300 |
< |
*outFile[k] << writeLine; |
301 |
< |
} |
210 |
> |
MPI_Comm_size(MPI_COMM_WORLD, &nProc); |
211 |
> |
potatoes = new int[nProc]; |
212 |
|
|
213 |
< |
} |
213 |
> |
//write out the comment lines |
214 |
> |
for(i = 0; i < nProc; i++) { |
215 |
> |
potatoes[i] = 0; |
216 |
> |
} |
217 |
|
|
305 |
– |
#else // is_mpi |
218 |
|
|
219 |
< |
/* code to find maximum tag value */ |
220 |
< |
|
309 |
< |
int *tagub, flag, MAXTAG; |
310 |
< |
MPI_Attr_get(MPI_COMM_WORLD, MPI_TAG_UB, &tagub, &flag); |
311 |
< |
if (flag) { |
312 |
< |
MAXTAG = *tagub; |
313 |
< |
} else { |
314 |
< |
MAXTAG = 32767; |
315 |
< |
} |
219 |
> |
os << nTotObjects << "\n"; |
220 |
> |
writeCommentLine(info_->getSnapshotManager()->getCurrentSnapshot()); |
221 |
|
|
222 |
< |
int haveError; |
222 |
> |
for(i = 0; i < info_->getNGlobalMolecules(); i++) { |
223 |
|
|
224 |
< |
MPI_Status istatus; |
320 |
< |
int nCurObj; |
321 |
< |
int *MolToProcMap = mpiSim->getMolToProcMap(); |
224 |
> |
// Get the Node number which has this atom; |
225 |
|
|
226 |
< |
// write out header and node 0's coordinates |
226 |
> |
which_node = info_->getMolToProc(i); |
227 |
|
|
228 |
< |
if( worldRank == 0 ){ |
228 |
> |
if (which_node != masterNode) { //current molecule is in slave node |
229 |
> |
if (potatoes[which_node] + 1 >= MAXTAG) { |
230 |
> |
// The potato was going to exceed the maximum value, |
231 |
> |
// so wrap this processor potato back to 0: |
232 |
|
|
233 |
< |
// Node 0 needs a list of the magic potatoes for each processor; |
233 |
> |
potatoes[which_node] = 0; |
234 |
> |
MPI_Send(&potatoes[which_node], 1, MPI_INT, which_node, 0, |
235 |
> |
MPI_COMM_WORLD); |
236 |
> |
} |
237 |
|
|
238 |
< |
nProc = mpiSim->getNProcessors(); |
330 |
< |
potatoes = new int[nProc]; |
238 |
> |
myPotato = potatoes[which_node]; |
239 |
|
|
240 |
< |
//write out the comment lines |
241 |
< |
for (i = 0; i < nProc; i++) |
242 |
< |
potatoes[i] = 0; |
243 |
< |
|
336 |
< |
for(k = 0; k < outFile.size(); k++){ |
337 |
< |
*outFile[k] << nTotObjects << "\n"; |
240 |
> |
//recieve the number of integrableObject in current molecule |
241 |
> |
MPI_Recv(&nCurObj, 1, MPI_INT, which_node, myPotato, |
242 |
> |
MPI_COMM_WORLD, &istatus); |
243 |
> |
myPotato++; |
244 |
|
|
245 |
< |
*outFile[k] << currentTime << ";\t" |
246 |
< |
<< entry_plug->Hmat[0][0] << "\t" |
247 |
< |
<< entry_plug->Hmat[1][0] << "\t" |
248 |
< |
<< entry_plug->Hmat[2][0] << ";\t" |
245 |
> |
for(int l = 0; l < nCurObj; l++) { |
246 |
> |
if (potatoes[which_node] + 2 >= MAXTAG) { |
247 |
> |
// The potato was going to exceed the maximum value, |
248 |
> |
// so wrap this processor potato back to 0: |
249 |
|
|
250 |
< |
<< entry_plug->Hmat[0][1] << "\t" |
251 |
< |
<< entry_plug->Hmat[1][1] << "\t" |
252 |
< |
<< entry_plug->Hmat[2][1] << ";\t" |
250 |
> |
potatoes[which_node] = 0; |
251 |
> |
MPI_Send(&potatoes[which_node], 1, MPI_INT, which_node, |
252 |
> |
0, MPI_COMM_WORLD); |
253 |
> |
} |
254 |
|
|
255 |
< |
<< entry_plug->Hmat[0][2] << "\t" |
256 |
< |
<< entry_plug->Hmat[1][2] << "\t" |
257 |
< |
<< entry_plug->Hmat[2][2] << ";"; |
351 |
< |
|
352 |
< |
*outFile[k] << entry_plug->the_integrator->getAdditionalParameters() << endl; |
353 |
< |
} |
255 |
> |
MPI_Recv(MPIatomTypeString, MINIBUFFERSIZE, MPI_CHAR, |
256 |
> |
which_node, myPotato, MPI_COMM_WORLD, |
257 |
> |
&istatus); |
258 |
|
|
259 |
< |
currentIndex = 0; |
259 |
> |
atomTypeString = MPIatomTypeString; |
260 |
|
|
261 |
< |
for (i = 0 ; i < mpiSim->getNMolGlobal(); i++ ) { |
358 |
< |
|
359 |
< |
// Get the Node number which has this atom; |
360 |
< |
|
361 |
< |
which_node = MolToProcMap[i]; |
362 |
< |
|
363 |
< |
if (which_node != 0) { |
364 |
< |
|
365 |
< |
if (potatoes[which_node] + 1 >= MAXTAG) { |
366 |
< |
// The potato was going to exceed the maximum value, |
367 |
< |
// so wrap this processor potato back to 0: |
261 |
> |
myPotato++; |
262 |
|
|
263 |
< |
potatoes[which_node] = 0; |
264 |
< |
MPI_Send(&potatoes[which_node], 1, MPI_INT, which_node, 0, MPI_COMM_WORLD); |
265 |
< |
|
372 |
< |
} |
263 |
> |
MPI_Recv(atomData, 13, MPI_DOUBLE, which_node, myPotato, |
264 |
> |
MPI_COMM_WORLD, &istatus); |
265 |
> |
myPotato++; |
266 |
|
|
267 |
< |
myPotato = potatoes[which_node]; |
267 |
> |
MPI_Get_count(&istatus, MPI_DOUBLE, &msgLen); |
268 |
|
|
269 |
< |
//recieve the number of integrableObject in current molecule |
270 |
< |
MPI_Recv(&nCurObj, 1, MPI_INT, which_node, |
271 |
< |
myPotato, MPI_COMM_WORLD, &istatus); |
272 |
< |
myPotato++; |
380 |
< |
|
381 |
< |
for(int l = 0; l < nCurObj; l++){ |
269 |
> |
if (msgLen == 13) |
270 |
> |
isDirectional = 1; |
271 |
> |
else |
272 |
> |
isDirectional = 0; |
273 |
|
|
274 |
< |
if (potatoes[which_node] + 2 >= MAXTAG) { |
384 |
< |
// The potato was going to exceed the maximum value, |
385 |
< |
// so wrap this processor potato back to 0: |
274 |
> |
// If we've survived to here, format the line: |
275 |
|
|
276 |
< |
potatoes[which_node] = 0; |
277 |
< |
MPI_Send(&potatoes[which_node], 1, MPI_INT, which_node, 0, MPI_COMM_WORLD); |
278 |
< |
|
279 |
< |
} |
276 |
> |
if (!isDirectional) { |
277 |
> |
sprintf(writeLine, "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", |
278 |
> |
atomTypeString, atomData[0], |
279 |
> |
atomData[1], atomData[2], |
280 |
> |
atomData[3], atomData[4], |
281 |
> |
atomData[5]); |
282 |
|
|
283 |
< |
MPI_Recv(MPIatomTypeString, MINIBUFFERSIZE, MPI_CHAR, which_node, |
284 |
< |
myPotato, MPI_COMM_WORLD, &istatus); |
283 |
> |
strcat(writeLine, |
284 |
> |
"0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n"); |
285 |
> |
} else { |
286 |
> |
sprintf(writeLine, |
287 |
> |
"%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n", |
288 |
> |
atomTypeString, |
289 |
> |
atomData[0], |
290 |
> |
atomData[1], |
291 |
> |
atomData[2], |
292 |
> |
atomData[3], |
293 |
> |
atomData[4], |
294 |
> |
atomData[5], |
295 |
> |
atomData[6], |
296 |
> |
atomData[7], |
297 |
> |
atomData[8], |
298 |
> |
atomData[9], |
299 |
> |
atomData[10], |
300 |
> |
atomData[11], |
301 |
> |
atomData[12]); |
302 |
> |
} |
303 |
|
|
304 |
< |
atomTypeString = MPIatomTypeString; |
304 |
> |
os << writeLine; |
305 |
|
|
306 |
< |
myPotato++; |
306 |
> |
} // end for(int l =0) |
307 |
|
|
308 |
< |
MPI_Recv(atomData, 13, MPI_DOUBLE, which_node, myPotato, MPI_COMM_WORLD, &istatus); |
309 |
< |
myPotato++; |
308 |
> |
potatoes[which_node] = myPotato; |
309 |
> |
} else { //master node has current molecule |
310 |
|
|
311 |
< |
MPI_Get_count(&istatus, MPI_DOUBLE, &msgLen); |
311 |
> |
mol = info_->getMoleculeByGlobalIndex(i); |
312 |
|
|
313 |
< |
if(msgLen == 13) |
314 |
< |
isDirectional = 1; |
315 |
< |
else |
316 |
< |
isDirectional = 0; |
317 |
< |
|
318 |
< |
// If we've survived to here, format the line: |
319 |
< |
|
320 |
< |
if (!isDirectional) { |
321 |
< |
|
322 |
< |
sprintf( writeLine, |
414 |
< |
"%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", |
415 |
< |
atomTypeString, |
416 |
< |
atomData[0], |
417 |
< |
atomData[1], |
418 |
< |
atomData[2], |
419 |
< |
atomData[3], |
420 |
< |
atomData[4], |
421 |
< |
atomData[5]); |
422 |
< |
|
423 |
< |
strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" ); |
424 |
< |
|
425 |
< |
} |
426 |
< |
else { |
427 |
< |
|
428 |
< |
sprintf( writeLine, |
429 |
< |
"%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n", |
430 |
< |
atomTypeString, |
431 |
< |
atomData[0], |
432 |
< |
atomData[1], |
433 |
< |
atomData[2], |
434 |
< |
atomData[3], |
435 |
< |
atomData[4], |
436 |
< |
atomData[5], |
437 |
< |
atomData[6], |
438 |
< |
atomData[7], |
439 |
< |
atomData[8], |
440 |
< |
atomData[9], |
441 |
< |
atomData[10], |
442 |
< |
atomData[11], |
443 |
< |
atomData[12]); |
444 |
< |
|
445 |
< |
} |
446 |
< |
|
447 |
< |
for(k = 0; k < outFile.size(); k++) |
448 |
< |
*outFile[k] << writeLine; |
313 |
> |
if (mol == NULL) { |
314 |
> |
strcpy(painCave.errMsg, "Molecule not found on node %d!", worldRank); |
315 |
> |
painCave.isFatal = 1; |
316 |
> |
simError(); |
317 |
> |
} |
318 |
> |
|
319 |
> |
for (integrableObject = mol->beginIntegrableObject(ii); integrableObject != NULL; |
320 |
> |
integrableObject = mol->nextIntegrableObject(ii)) { |
321 |
> |
|
322 |
> |
atomTypeString = integrableObject->getType().c_str(); |
323 |
|
|
324 |
< |
}// end for(int l =0) |
325 |
< |
potatoes[which_node] = myPotato; |
324 |
> |
pos = integrableObject->getPos(); |
325 |
> |
vel = integrableObject->getVel(); |
326 |
|
|
327 |
< |
} |
328 |
< |
else { |
329 |
< |
|
456 |
< |
haveError = 0; |
457 |
< |
|
458 |
< |
local_index = indexArray[currentIndex].first; |
327 |
> |
atomData[0] = pos[0]; |
328 |
> |
atomData[1] = pos[1]; |
329 |
> |
atomData[2] = pos[2]; |
330 |
|
|
331 |
< |
integrableObjects = (entry_plug->molecules[local_index]).getIntegrableObjects(); |
331 |
> |
atomData[3] = vel[0]; |
332 |
> |
atomData[4] = vel[1]; |
333 |
> |
atomData[5] = vel[2]; |
334 |
|
|
335 |
< |
for(iter= integrableObjects.begin(); iter != integrableObjects.end(); ++iter){ |
463 |
< |
sd = *iter; |
464 |
< |
atomTypeString = sd->getType(); |
465 |
< |
|
466 |
< |
sd->getPos(pos); |
467 |
< |
sd->getVel(vel); |
468 |
< |
|
469 |
< |
atomData[0] = pos[0]; |
470 |
< |
atomData[1] = pos[1]; |
471 |
< |
atomData[2] = pos[2]; |
335 |
> |
isDirectional = 0; |
336 |
|
|
337 |
< |
atomData[3] = vel[0]; |
338 |
< |
atomData[4] = vel[1]; |
475 |
< |
atomData[5] = vel[2]; |
476 |
< |
|
477 |
< |
isDirectional = 0; |
337 |
> |
if (integrableObject->isDirectional()) { |
338 |
> |
isDirectional = 1; |
339 |
|
|
340 |
< |
if( sd->isDirectional() ){ |
340 |
> |
q = integrableObject->getQ(); |
341 |
> |
ji = integrableObject->getJ(); |
342 |
|
|
343 |
< |
isDirectional = 1; |
344 |
< |
|
345 |
< |
sd->getQ( q ); |
484 |
< |
sd->getJ( ji ); |
343 |
> |
for(int j = 0; j < 6; j++) { |
344 |
> |
atomData[j] = atomData[j]; |
345 |
> |
} |
346 |
|
|
347 |
< |
for (int j = 0; j < 6 ; j++) |
348 |
< |
atomData[j] = atomData[j]; |
349 |
< |
|
350 |
< |
atomData[6] = q[0]; |
490 |
< |
atomData[7] = q[1]; |
491 |
< |
atomData[8] = q[2]; |
492 |
< |
atomData[9] = q[3]; |
493 |
< |
|
494 |
< |
atomData[10] = ji[0]; |
495 |
< |
atomData[11] = ji[1]; |
496 |
< |
atomData[12] = ji[2]; |
497 |
< |
} |
498 |
< |
|
499 |
< |
// If we've survived to here, format the line: |
500 |
< |
|
501 |
< |
if (!isDirectional) { |
502 |
< |
|
503 |
< |
sprintf( writeLine, |
504 |
< |
"%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", |
505 |
< |
atomTypeString, |
506 |
< |
atomData[0], |
507 |
< |
atomData[1], |
508 |
< |
atomData[2], |
509 |
< |
atomData[3], |
510 |
< |
atomData[4], |
511 |
< |
atomData[5]); |
512 |
< |
|
513 |
< |
strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" ); |
514 |
< |
|
515 |
< |
} |
516 |
< |
else { |
517 |
< |
|
518 |
< |
sprintf( writeLine, |
519 |
< |
"%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n", |
520 |
< |
atomTypeString, |
521 |
< |
atomData[0], |
522 |
< |
atomData[1], |
523 |
< |
atomData[2], |
524 |
< |
atomData[3], |
525 |
< |
atomData[4], |
526 |
< |
atomData[5], |
527 |
< |
atomData[6], |
528 |
< |
atomData[7], |
529 |
< |
atomData[8], |
530 |
< |
atomData[9], |
531 |
< |
atomData[10], |
532 |
< |
atomData[11], |
533 |
< |
atomData[12]); |
534 |
< |
|
535 |
< |
} |
536 |
< |
|
537 |
< |
for(k = 0; k < outFile.size(); k++) |
538 |
< |
*outFile[k] << writeLine; |
539 |
< |
|
540 |
< |
|
541 |
< |
}//end for(iter = integrableObject.begin()) |
542 |
< |
|
543 |
< |
currentIndex++; |
544 |
< |
} |
347 |
> |
atomData[6] = q[0]; |
348 |
> |
atomData[7] = q[1]; |
349 |
> |
atomData[8] = q[2]; |
350 |
> |
atomData[9] = q[3]; |
351 |
|
|
352 |
< |
}//end for(i = 0; i < mpiSim->getNmol()) |
353 |
< |
|
354 |
< |
for(k = 0; k < outFile.size(); k++) |
355 |
< |
outFile[k]->flush(); |
550 |
< |
|
551 |
< |
sprintf( checkPointMsg, |
552 |
< |
"Sucessfully took a dump.\n"); |
553 |
< |
|
554 |
< |
MPIcheckPoint(); |
555 |
< |
|
556 |
< |
delete[] potatoes; |
557 |
< |
|
558 |
< |
} else { |
352 |
> |
atomData[10] = ji[0]; |
353 |
> |
atomData[11] = ji[1]; |
354 |
> |
atomData[12] = ji[2]; |
355 |
> |
} |
356 |
|
|
357 |
< |
// worldRank != 0, so I'm a remote node. |
357 |
> |
// If we've survived to here, format the line: |
358 |
|
|
359 |
< |
// Set my magic potato to 0: |
359 |
> |
if (!isDirectional) { |
360 |
> |
sprintf(writeLine, "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", |
361 |
> |
atomTypeString, atomData[0], |
362 |
> |
atomData[1], atomData[2], |
363 |
> |
atomData[3], atomData[4], |
364 |
> |
atomData[5]); |
365 |
|
|
366 |
< |
myPotato = 0; |
367 |
< |
currentIndex = 0; |
368 |
< |
|
369 |
< |
for (i = 0 ; i < mpiSim->getNMolGlobal(); i++ ) { |
370 |
< |
|
371 |
< |
// Am I the node which has this integrableObject? |
372 |
< |
|
373 |
< |
if (MolToProcMap[i] == worldRank) { |
366 |
> |
strcat(writeLine, |
367 |
> |
"0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n"); |
368 |
> |
} else { |
369 |
> |
sprintf(writeLine, |
370 |
> |
"%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n", |
371 |
> |
atomTypeString, |
372 |
> |
atomData[0], |
373 |
> |
atomData[1], |
374 |
> |
atomData[2], |
375 |
> |
atomData[3], |
376 |
> |
atomData[4], |
377 |
> |
atomData[5], |
378 |
> |
atomData[6], |
379 |
> |
atomData[7], |
380 |
> |
atomData[8], |
381 |
> |
atomData[9], |
382 |
> |
atomData[10], |
383 |
> |
atomData[11], |
384 |
> |
atomData[12]); |
385 |
> |
} |
386 |
|
|
387 |
|
|
388 |
< |
if (myPotato + 1 >= MAXTAG) { |
575 |
< |
|
576 |
< |
// The potato was going to exceed the maximum value, |
577 |
< |
// so wrap this processor potato back to 0 (and block until |
578 |
< |
// node 0 says we can go: |
579 |
< |
|
580 |
< |
MPI_Recv(&myPotato, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, &istatus); |
581 |
< |
|
582 |
< |
} |
388 |
> |
os << writeLine; |
389 |
|
|
390 |
< |
local_index = indexArray[currentIndex].first; |
391 |
< |
integrableObjects = entry_plug->molecules[local_index].getIntegrableObjects(); |
392 |
< |
|
587 |
< |
nCurObj = integrableObjects.size(); |
588 |
< |
|
589 |
< |
MPI_Send(&nCurObj, 1, MPI_INT, 0, |
590 |
< |
myPotato, MPI_COMM_WORLD); |
591 |
< |
myPotato++; |
390 |
> |
} //end for(iter = integrableObject.begin()) |
391 |
> |
} |
392 |
> |
} //end for(i = 0; i < mpiSim->getNmol()) |
393 |
|
|
394 |
< |
for( iter = integrableObjects.begin(); iter != integrableObjects.end(); iter++){ |
394 |
> |
os.flush(); |
395 |
|
|
396 |
< |
if (myPotato + 2 >= MAXTAG) { |
596 |
< |
|
597 |
< |
// The potato was going to exceed the maximum value, |
598 |
< |
// so wrap this processor potato back to 0 (and block until |
599 |
< |
// node 0 says we can go: |
600 |
< |
|
601 |
< |
MPI_Recv(&myPotato, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, &istatus); |
602 |
< |
|
603 |
< |
} |
604 |
< |
|
605 |
< |
sd = *iter; |
606 |
< |
|
607 |
< |
atomTypeString = sd->getType(); |
396 |
> |
sprintf(checkPointMsg, "Sucessfully took a dump.\n"); |
397 |
|
|
398 |
< |
sd->getPos(pos); |
610 |
< |
sd->getVel(vel); |
398 |
> |
MPIcheckPoint(); |
399 |
|
|
400 |
< |
atomData[0] = pos[0]; |
401 |
< |
atomData[1] = pos[1]; |
614 |
< |
atomData[2] = pos[2]; |
400 |
> |
delete [] potatoes; |
401 |
> |
} else { |
402 |
|
|
403 |
< |
atomData[3] = vel[0]; |
617 |
< |
atomData[4] = vel[1]; |
618 |
< |
atomData[5] = vel[2]; |
619 |
< |
|
620 |
< |
isDirectional = 0; |
403 |
> |
// worldRank != 0, so I'm a remote node. |
404 |
|
|
405 |
< |
if( sd->isDirectional() ){ |
405 |
> |
// Set my magic potato to 0: |
406 |
|
|
407 |
< |
isDirectional = 1; |
407 |
> |
myPotato = 0; |
408 |
> |
|
409 |
> |
for(i = 0; i < info_->getNGlobalMolecules(); i++) { |
410 |
> |
|
411 |
> |
// Am I the node which has this integrableObject? |
412 |
> |
whichNode = info_->getMolToProc(i); |
413 |
> |
if (whichNode == worldRank) { |
414 |
> |
if (myPotato + 1 >= MAXTAG) { |
415 |
> |
|
416 |
> |
// The potato was going to exceed the maximum value, |
417 |
> |
// so wrap this processor potato back to 0 (and block until |
418 |
> |
// node 0 says we can go: |
419 |
> |
|
420 |
> |
MPI_Recv(&myPotato, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, |
421 |
> |
&istatus); |
422 |
> |
} |
423 |
> |
|
424 |
> |
mol = info_->getMoleculeByGlobalIndex(i); |
425 |
> |
|
426 |
|
|
427 |
< |
sd->getQ( q ); |
627 |
< |
sd->getJ( ji ); |
628 |
< |
|
629 |
< |
|
630 |
< |
atomData[6] = q[0]; |
631 |
< |
atomData[7] = q[1]; |
632 |
< |
atomData[8] = q[2]; |
633 |
< |
atomData[9] = q[3]; |
634 |
< |
|
635 |
< |
atomData[10] = ji[0]; |
636 |
< |
atomData[11] = ji[1]; |
637 |
< |
atomData[12] = ji[2]; |
638 |
< |
} |
427 |
> |
nCurObj = mol->getNIntegrableObjects(); |
428 |
|
|
429 |
< |
|
430 |
< |
strncpy(MPIatomTypeString, atomTypeString, MINIBUFFERSIZE); |
429 |
> |
MPI_Send(&nCurObj, 1, MPI_INT, 0, myPotato, MPI_COMM_WORLD); |
430 |
> |
myPotato++; |
431 |
|
|
432 |
< |
// null terminate the string before sending (just in case): |
433 |
< |
MPIatomTypeString[MINIBUFFERSIZE-1] = '\0'; |
432 |
> |
for (integrableObject = mol->beginIntegrableObject(ii); integrableObject != NULL; |
433 |
> |
integrableObject = mol->nextIntegrableObject(ii)) { |
434 |
|
|
435 |
< |
MPI_Send(MPIatomTypeString, MINIBUFFERSIZE, MPI_CHAR, 0, |
647 |
< |
myPotato, MPI_COMM_WORLD); |
648 |
< |
|
649 |
< |
myPotato++; |
650 |
< |
|
651 |
< |
if (isDirectional) { |
435 |
> |
if (myPotato + 2 >= MAXTAG) { |
436 |
|
|
437 |
< |
MPI_Send(atomData, 13, MPI_DOUBLE, 0, |
438 |
< |
myPotato, MPI_COMM_WORLD); |
439 |
< |
|
656 |
< |
} else { |
437 |
> |
// The potato was going to exceed the maximum value, |
438 |
> |
// so wrap this processor potato back to 0 (and block until |
439 |
> |
// node 0 says we can go: |
440 |
|
|
441 |
< |
MPI_Send(atomData, 6, MPI_DOUBLE, 0, |
442 |
< |
myPotato, MPI_COMM_WORLD); |
443 |
< |
} |
441 |
> |
MPI_Recv(&myPotato, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, |
442 |
> |
&istatus); |
443 |
> |
} |
444 |
|
|
445 |
< |
myPotato++; |
445 |
> |
atomTypeString = integrableObject->getType().c_str(); |
446 |
|
|
447 |
< |
} |
447 |
> |
pos = integrableObject->getPos(); |
448 |
> |
vel = integrableObject->getVel(); |
449 |
|
|
450 |
< |
currentIndex++; |
451 |
< |
|
452 |
< |
} |
669 |
< |
|
670 |
< |
} |
450 |
> |
atomData[0] = pos[0]; |
451 |
> |
atomData[1] = pos[1]; |
452 |
> |
atomData[2] = pos[2]; |
453 |
|
|
454 |
< |
sprintf( checkPointMsg, |
455 |
< |
"Sucessfully took a dump.\n"); |
456 |
< |
MPIcheckPoint(); |
675 |
< |
|
676 |
< |
} |
454 |
> |
atomData[3] = vel[0]; |
455 |
> |
atomData[4] = vel[1]; |
456 |
> |
atomData[5] = vel[2]; |
457 |
|
|
458 |
+ |
isDirectional = 0; |
459 |
|
|
460 |
< |
|
461 |
< |
#endif // is_mpi |
681 |
< |
} |
460 |
> |
if (integrableObject->isDirectional()) { |
461 |
> |
isDirectional = 1; |
462 |
|
|
463 |
< |
#ifdef IS_MPI |
463 |
> |
q = integrableObject->getQ(); |
464 |
> |
ji = integrableObject->getJ(); |
465 |
|
|
466 |
< |
// a couple of functions to let us escape the write loop |
466 |
> |
atomData[6] = q[0]; |
467 |
> |
atomData[7] = q[1]; |
468 |
> |
atomData[8] = q[2]; |
469 |
> |
atomData[9] = q[3]; |
470 |
|
|
471 |
< |
void dWrite::DieDieDie( void ){ |
471 |
> |
atomData[10] = ji[0]; |
472 |
> |
atomData[11] = ji[1]; |
473 |
> |
atomData[12] = ji[2]; |
474 |
> |
} |
475 |
|
|
476 |
< |
MPI_Finalize(); |
477 |
< |
exit (0); |
476 |
> |
strncpy(MPIatomTypeString, atomTypeString, MINIBUFFERSIZE); |
477 |
> |
|
478 |
> |
// null terminate the string before sending (just in case): |
479 |
> |
MPIatomTypeString[MINIBUFFERSIZE - 1] = '\0'; |
480 |
> |
|
481 |
> |
MPI_Send(MPIatomTypeString, MINIBUFFERSIZE, MPI_CHAR, 0, |
482 |
> |
myPotato, MPI_COMM_WORLD); |
483 |
> |
|
484 |
> |
myPotato++; |
485 |
> |
|
486 |
> |
if (isDirectional) { |
487 |
> |
MPI_Send(atomData, 13, MPI_DOUBLE, 0, myPotato, |
488 |
> |
MPI_COMM_WORLD); |
489 |
> |
} else { |
490 |
> |
MPI_Send(atomData, 6, MPI_DOUBLE, 0, myPotato, |
491 |
> |
MPI_COMM_WORLD); |
492 |
> |
} |
493 |
> |
|
494 |
> |
myPotato++; |
495 |
> |
} |
496 |
> |
|
497 |
> |
} |
498 |
> |
|
499 |
> |
} |
500 |
> |
|
501 |
> |
sprintf(checkPointMsg, "Sucessfully took a dump.\n"); |
502 |
> |
MPIcheckPoint(); |
503 |
> |
} |
504 |
> |
|
505 |
> |
#endif // is_mpi |
506 |
> |
|
507 |
|
} |
508 |
|
|
509 |
< |
#endif //is_mpi |
509 |
> |
}//end namespace oopse |