# | Line 112 | Line 112 | void DumpReader::scanFile( void ){ | |
---|---|---|
112 | painCave.isFatal = 1; | |
113 | simError(); | |
114 | } | |
115 | – | framePos.push_back(currPos); |
115 | ||
116 | while( !feof( inFile ) ){ | |
117 | + | |
118 | + | framePos.push_back(currPos); |
119 | ||
120 | i = atoi(readBuffer); | |
121 | ||
# | Line 149 | Line 150 | void DumpReader::scanFile( void ){ | |
150 | currPos = new fpos_t; | |
151 | fgetpos( inFile, currPos ); | |
152 | fgets( readBuffer, sizeof( readBuffer ), inFile ); | |
152 | – | framePos.push_back(currPos); |
153 | lineNum++; | |
154 | } | |
155 | ||
# | Line 198 | Line 198 | void DumpReader :: readSet( int whichFrame ){ | |
198 | eof_test = fgets(read_buffer, sizeof(read_buffer), inFile); | |
199 | if( eof_test == NULL ){ | |
200 | sprintf( painCave.errMsg, | |
201 | < | "InitializeFromFile error: error reading 1st line of \"%s\"\n", |
201 | > | "DumpReader error: error reading 1st line of \"%s\"\n", |
202 | inFileName.c_str() ); | |
203 | painCave.isFatal = 1; | |
204 | simError(); | |
# | Line 208 | Line 208 | void DumpReader :: readSet( int whichFrame ){ | |
208 | ||
209 | if( nTotObjs != simnfo->getTotIntegrableObjects() ){ | |
210 | sprintf( painCave.errMsg, | |
211 | < | "Initialize from File error. %s n_atoms, %d, " |
211 | > | "DumpReader error. %s n_atoms, %d, " |
212 | "does not match the BASS file's n_atoms, %d.\n", | |
213 | inFileName.c_str(), nTotObjs, simnfo->getTotIntegrableObjects()); | |
214 | painCave.isFatal = 1; | |
# | Line 273 | Line 273 | void DumpReader :: readSet( int whichFrame ){ | |
273 | int *MolToProcMap = mpiSim->getMolToProcMap(); | |
274 | int localIndex; | |
275 | int nCurObj; | |
276 | + | int nitems; |
277 | ||
278 | + | nTotObjs = simnfo->getTotIntegrableObjects(); |
279 | haveError = 0; | |
280 | if (worldRank == 0) { | |
281 | fsetpos(inFile, framePos[whichFrame]); | |
# | Line 286 | Line 288 | void DumpReader :: readSet( int whichFrame ){ | |
288 | simError(); | |
289 | } | |
290 | ||
291 | < | nTotObjs = atoi( read_buffer ); |
291 | > | nitems = atoi( read_buffer ); |
292 | ||
293 | // Check to see that the number of integrable objects in the intial configuration file is the | |
294 | // same as declared in simBass. | |
295 | ||
296 | < | if( nTotObjs != simnfo->getTotIntegrableObjects()){ |
296 | > | if( nTotObjs != nitems){ |
297 | sprintf( painCave.errMsg, | |
298 | < | "Initialize from File error. %s n_atoms, %d, " |
298 | > | "DumpReadererror. %s n_atoms, %d, " |
299 | "does not match the BASS file's n_atoms, %d.\n", | |
300 | inFileName.c_str(), nTotObjs, simnfo->getTotIntegrableObjects()); | |
301 | haveError= 1; | |
# | Line 354 | Line 356 | void DumpReader :: readSet( int whichFrame ){ | |
356 | ||
357 | if(haveError) nodeZeroError(); | |
358 | ||
359 | < | parseDumpLine(read_buffer, integrableObjects[i]); |
359 | > | parseDumpLine(read_buffer, integrableObjects[j]); |
360 | ||
361 | } | |
362 | ||
# | Line 363 | Line 365 | void DumpReader :: readSet( int whichFrame ){ | |
365 | else{ | |
366 | //molecule belongs to slave nodes | |
367 | ||
368 | < | MPI_Recv(&nCurObj, 1, MPI_INT, 0, |
368 | > | MPI_Recv(&nCurObj, 1, MPI_INT, which_node, |
369 | TAKE_THIS_TAG_INT, MPI_COMM_WORLD, &istatus); | |
370 | ||
371 | < | for(j=0; j < integrableObjects.size(); j++){ |
371 | > | for(j=0; j < nCurObj; j++){ |
372 | ||
373 | eof_test = fgets(read_buffer, sizeof(read_buffer), inFile); | |
374 | if(eof_test == NULL){ | |
# | Line 393 | Line 395 | void DumpReader :: readSet( int whichFrame ){ | |
395 | } | |
396 | else{ | |
397 | //actions taken at slave nodes | |
398 | + | MPI_Bcast(read_buffer, BUFFERSIZE, MPI_CHAR, 0, MPI_COMM_WORLD); |
399 | + | |
400 | + | parseErr = parseCommentLine( read_buffer, simnfo); |
401 | + | |
402 | + | if( parseErr != NULL ){ |
403 | + | strcpy( painCave.errMsg, parseErr ); |
404 | + | haveError = 1; |
405 | + | simError(); |
406 | + | } |
407 | + | |
408 | for (i=0 ; i < mpiSim->getTotNmol(); i++) { | |
409 | which_node = MolToProcMap[i]; | |
410 | ||
# | Line 411 | Line 423 | void DumpReader :: readSet( int whichFrame ){ | |
423 | ||
424 | nCurObj = integrableObjects.size(); | |
425 | ||
426 | < | MPI_Recv(&nCurObj, 1, MPI_INT, 0, |
427 | < | TAKE_THIS_TAG_INT, MPI_COMM_WORLD, &istatus); |
426 | > | MPI_Send(&nCurObj, 1, MPI_INT, 0, |
427 | > | TAKE_THIS_TAG_INT, MPI_COMM_WORLD); |
428 | ||
429 | for(j = 0; j < integrableObjects.size(); j++){ | |
430 | ||
# | Line 456 | Line 468 | char* DumpReader::parseDumpLine(char* readLine, StuntD | |
468 | ||
469 | if( strcmp( foo, sd->getType() ) ){ | |
470 | sprintf( painCave.errMsg, | |
471 | < | "Initialize from file error. Does not" |
471 | > | "DumpReader error. Does not" |
472 | " match the BASS atom %s.\n", | |
473 | sd->getType() ); | |
474 | return strdup( painCave.errMsg ); |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |