ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/InitializeFromFile.cpp
(Generate patch)

Comparing:
branches/mmeineke/OOPSE/libmdtools/InitializeFromFile.cpp (file contents), Revision 377 by mmeineke, Fri Mar 21 17:42:12 2003 UTC vs.
trunk/OOPSE/libmdtools/InitializeFromFile.cpp (file contents), Revision 690 by mmeineke, Tue Aug 12 21:44:06 2003 UTC

# Line 12 | Line 12
12   #include "simError.h"
13  
14   #ifdef IS_MPI
15 + #include <mpi.h>
16   #include "mpiSimulation.hpp"
17 + #define TAKE_THIS_TAG_CHAR 0
18 + #define TAKE_THIS_TAG_INT 1
19  
20 < #define TAKE_THIS_TAG 0
20 > namespace initFile{
21 >  void nodeZeroError( void );
22 >  void anonymousNodeDie( void );
23 > }
24 >
25 > using namespace initFile;
26 >
27   #endif // is_mpi
28  
29 < InitializeFromFile :: InitializeFromFile( char *in_name ){
29 > InitializeFromFile::InitializeFromFile( char *in_name ){
30 >
31   #ifdef IS_MPI
32    if (worldRank == 0) {
33   #endif
# Line 39 | Line 49 | InitializeFromFile :: ~InitializeFromFile( ){
49    return;  
50   }
51  
52 < InitializeFromFile :: ~InitializeFromFile( ){
52 > InitializeFromFile::~InitializeFromFile( ){
53   #ifdef IS_MPI
54    if (worldRank == 0) {
55   #endif
# Line 60 | Line 70 | void InitializeFromFile :: read_xyz( SimInfo* the_entr
70   }
71  
72  
73 < void InitializeFromFile :: read_xyz( SimInfo* the_entry_plug ){
73 > void InitializeFromFile :: readInit( SimInfo* the_simnfo ){
74  
75 <  int i; // loop counter
75 >  int i, j, done, which_node, which_atom; // loop counter
76  
77    const int BUFFERSIZE = 2000; // size of the read buffer
78    int n_atoms; // the number of atoms
# Line 74 | Line 84 | void InitializeFromFile :: read_xyz( SimInfo* the_entr
84    char *eof_test; // ptr to see when we reach the end of the file
85    char *parseErr;
86    int procIndex;
87 +  double currTime;
88 +  double boxMat[9];
89 +  double theBoxMat3[3][3];
90  
91 <  entry_plug = the_entry_plug;
91 >  simnfo = the_simnfo;
92  
93  
94   #ifndef IS_MPI
# Line 90 | Line 103 | void InitializeFromFile :: read_xyz( SimInfo* the_entr
103  
104    n_atoms = atoi( read_buffer );
105  
106 <  Atom **atoms = entry_plug->atoms;
106 >  Atom **atoms = simnfo->atoms;
107    DirectionalAtom* dAtom;
108  
109 <  if( n_atoms != entry_plug->n_atoms ){
109 >  if( n_atoms != simnfo->n_atoms ){
110      sprintf( painCave.errMsg,
111               "Initialize from File error. %s n_atoms, %d, "
112               "does not match the BASS file's n_atoms, %d.\n",
113 <             c_in_name, n_atoms, entry_plug->n_atoms );
113 >             c_in_name, n_atoms, simnfo->n_atoms );
114      painCave.isFatal = 1;
115      simError();
116    }
117    
118 <  //read and toss the comment line
118 >  //read the box mat from the comment line
119    
120    eof_test = fgets(read_buffer, sizeof(read_buffer), c_in_file);
121    if(eof_test == NULL){
# Line 112 | Line 125 | void InitializeFromFile :: read_xyz( SimInfo* the_entr
125      simError();
126    }
127  
128 +  parseErr = parseBoxLine( read_buffer, boxMat, currTime );
129 +  if( parseErr != NULL ){
130 +    strcpy( painCave.errMsg, parseErr );
131 +    painCave.isFatal = 1;
132 +    simError();
133 +  }
134 +
135 +  for(i=0;i<3;i++)
136 +    for(j=0;j<3;j++) theBoxMat3[i][j] = boxMat[3*j+i];
137 +
138 +  simnfo->setBoxM( theBoxMat3 );
139 +  simnfo->setTime( currTime );
140 +
141 +
142    for( i=0; i < n_atoms; i++){
143      
144      eof_test = fgets(read_buffer, sizeof(read_buffer), c_in_file);
# Line 131 | Line 158 | void InitializeFromFile :: read_xyz( SimInfo* the_entr
158        strcpy( painCave.errMsg, parseErr );
159        painCave.isFatal = 1;
160        simError();
161 <    }    
161 >    }
162    }
163  
164  
165    // MPI Section of code..........
166   #else //IS_MPI
167  
168 <  int masterIndex;
169 <  int nodeAtomsStart;
143 <  int nodeAtomsEnd;
144 <  int mpiErr;
145 <  int sendError;
168 >  // first thing first, suspend fatalities.
169 >  painCave.isEventLoop = 1;
170  
171 <  MPI_Status istatus[MPI_STATUS_SIZE];
171 >  int myStatus; // 1 = wakeup & success; 0 = error; -1 = AllDone
172 >  int haveError;
173 >  
174 >  MPI_Status istatus;
175 >  int *AtomToProcMap = mpiSim->getAtomToProcMap();
176  
177 +  
178 +  haveError = 0;
179    if (worldRank == 0) {
180 +
181      eof_test = fgets(read_buffer, sizeof(read_buffer), c_in_file);
182      if( eof_test == NULL ){
183        sprintf( painCave.errMsg,
184                 "Error reading 1st line of %d \n ",c_in_name);
185 <      painCave.isFatal = 1;
185 >      haveError = 1;
186        simError();
187      }
188      
189      n_atoms = atoi( read_buffer );
190      
191 <    Atom **atoms = entry_plug->atoms;
191 >    Atom **atoms = simnfo->atoms;
192      DirectionalAtom* dAtom;
193  
194      // Check to see that the number of atoms in the intial configuration file is the
# Line 167 | Line 198 | void InitializeFromFile :: read_xyz( SimInfo* the_entr
198        sprintf( painCave.errMsg,
199                 "Initialize from File error. %s n_atoms, %d, "
200                 "does not match the BASS file's n_atoms, %d.\n",
201 <               c_in_name, n_atoms, entry_plug->n_atoms );
202 <      painCave.isFatal = 1;
201 >               c_in_name, n_atoms, simnfo->n_atoms );
202 >      haveError= 1;
203        simError();
204      }
205      
206 <    //read and toss the comment line
206 >    //read the boxMat from the comment line
207      
208      eof_test = fgets(read_buffer, sizeof(read_buffer), c_in_file);
209      if(eof_test == NULL){
210        sprintf( painCave.errMsg,
211                 "error in reading commment in %s\n", c_in_name);
212 <      painCave.isFatal = 1;
212 >      haveError = 1;
213        simError();
214      }
184  
185    // Read Proc 0 share of the xyz file...
186    masterIndex = 0;
187    for( i=0; i <= mpiSim->getMyAtomEnd(); i++){
215      
216 +    parseErr = parseBoxLine( read_buffer, boxMat, currTime );
217 +    if( parseErr != NULL ){
218 +      strcpy( painCave.errMsg, parseErr );
219 +      haveError = 1;
220 +      simError();
221 +    }
222 +
223 +    MPI_Bcast(boxMat, 9, MPI_DOUBLE, 0, MPI_COMM_WORLD );
224 +    MPI_Bcast(&currTime, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD );
225 +  
226 +    if(haveError) nodeZeroError();
227 +
228 +    for (i=0 ; i < mpiSim->getTotAtoms(); i++) {
229 +      
230        eof_test = fgets(read_buffer, sizeof(read_buffer), c_in_file);
231        if(eof_test == NULL){
232          sprintf(painCave.errMsg,
# Line 193 | Line 234 | void InitializeFromFile :: read_xyz( SimInfo* the_entr
234                  "natoms  = %d; index = %d\n"
235                  "error reading the line from the file.\n",
236                  c_in_name, n_atoms, i );
237 <        painCave.isFatal = 1;
237 >        haveError= 1;
238          simError();
239        }
240      
241 <      parseErr = parseDumpLine( read_buffer, i );
201 <      if( parseErr != NULL ){
202 <        strcpy( painCave.errMsg, parseErr );
203 <        painCave.isFatal = 1;
204 <        simError();
205 <      }    
206 <      masterIndex++;
207 <    }
208 <  }
241 >      if(haveError) nodeZeroError();
242  
243 <  sprintf(checkPointMsg,
244 <          "Node 0 has successfully read positions from input file.");
245 <  MPIcheckPoint();
246 <
247 <  for (procIndex = 1; procIndex < mpiSim->getNumberProcessors();
248 <         procIndex++){
249 <    if (worldRank == 0) {
250 <
251 <      mpiErr = MPI_Recv(&nodeAtomsStart,1,MPI_INT,procIndex,TAKE_THIS_TAG,MPI_COMM_WORLD,
252 <               istatus);
253 <
221 <      mpiErr = MPI_Recv(&nodeAtomsEnd,1,MPI_INT,procIndex,TAKE_THIS_TAG,MPI_COMM_WORLD,
222 <               istatus);
223 <      // Make sure where node 0 is reading from, matches where the receiving node
224 <      // expects it to be.
225 <
226 <      if (masterIndex != nodeAtomsStart){
227 <        sendError = 1;
228 <        mpiErr = MPI_Send(&sendError,1,MPI_INT,procIndex,TAKE_THIS_TAG,MPI_COMM_WORLD);
229 <        sprintf(painCave.errMsg,
230 <                "Initialize from file error: atoms start index (%d) for "
231 <                "node %d not equal to master index (%d)",nodeAtomsStart,procIndex,masterIndex );
232 <        painCave.isFatal = 1;
233 <        simError();
234 <      }
235 <      sendError = 0;
236 <      mpiErr = MPI_Send(&sendError,1,MPI_INT,procIndex,TAKE_THIS_TAG,MPI_COMM_WORLD);
243 >      // Get the Node number which wants this atom:
244 >      which_node = AtomToProcMap[i];    
245 >      if (which_node == 0) {
246 >        parseErr = parseDumpLine( read_buffer, i );
247 >        if( parseErr != NULL ){
248 >          strcpy( painCave.errMsg, parseErr );
249 >          haveError = 1;
250 >          simError();
251 >        }    
252 >        if(haveError) nodeZeroError();
253 >      }
254        
255 <      for ( i = nodeAtomsStart; i <= nodeAtomsEnd; i++){
256 <        eof_test = fgets(read_buffer, sizeof(read_buffer), c_in_file);
257 <        if(eof_test == NULL){
258 <          
259 <          sprintf(read_buffer,"ERROR");
260 <          mpiErr = MPI_Send(read_buffer,BUFFERSIZE,MPI_CHAR,procIndex,TAKE_THIS_TAG,MPI_COMM_WORLD);
261 <          
262 <          sprintf(painCave.errMsg,
263 <                  "error in reading file %s\n"
264 <                  "natoms  = %d; index = %d\n"
265 <                  "error reading the line from the file.\n",
249 <                  c_in_name, n_atoms, i );
250 <          painCave.isFatal = 1;
251 <          simError();
252 <        }
255 >      else {
256 >      
257 >        myStatus = 1;
258 >        MPI_Send(&myStatus, 1, MPI_INT, which_node,
259 >                 TAKE_THIS_TAG_INT, MPI_COMM_WORLD);
260 >        MPI_Send(read_buffer, BUFFERSIZE, MPI_CHAR, which_node,
261 >                 TAKE_THIS_TAG_CHAR, MPI_COMM_WORLD);
262 >        MPI_Send(&i, 1, MPI_INT, which_node, TAKE_THIS_TAG_INT,
263 >                 MPI_COMM_WORLD);
264 >        MPI_Recv(&myStatus, 1, MPI_INT, which_node, TAKE_THIS_TAG_INT,
265 >                 MPI_COMM_WORLD, &istatus);
266          
267 <        mpiErr = MPI_Send(read_buffer,BUFFERSIZE,MPI_CHAR,procIndex,TAKE_THIS_TAG,MPI_COMM_WORLD);
255 <        mpiErr = MPI_Recv(&sendError,1,MPI_INT,procIndex,TAKE_THIS_TAG,MPI_COMM_WORLD,
256 <                          istatus);
257 <        if (sendError) MPIcheckPoint();
258 <
259 <        masterIndex++;
267 >        if(!myStatus) nodeZeroError();
268        }
269      }
270 +    myStatus = -1;
271 +    for (j = 0; j < mpiSim->getNumberProcessors(); j++) {      
272 +      MPI_Send( &myStatus, 1, MPI_INT, j,
273 +                TAKE_THIS_TAG_INT, MPI_COMM_WORLD);
274 +    }
275 +    
276 +  } else {
277 +    
278 +    MPI_Bcast(boxMat, 9, MPI_DOUBLE, 0, MPI_COMM_WORLD);
279 +    MPI_Bcast(&currTime, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD);
280  
281 +    done = 0;
282 +    while (!done) {
283  
284 <    else if(worldRank == procIndex){
285 <      nodeAtomsStart = mpiSim->getMyAtomStart();
266 <      nodeAtomsEnd = mpiSim->getMyAtomEnd();
267 <      mpiErr = MPI_Send(&nodeAtomsStart,1,MPI_INT,0,TAKE_THIS_TAG,MPI_COMM_WORLD);
268 <      mpiErr = MPI_Send(&nodeAtomsEnd,1,MPI_INT,0,TAKE_THIS_TAG,MPI_COMM_WORLD);
284 >      MPI_Recv(&myStatus, 1, MPI_INT, 0,
285 >               TAKE_THIS_TAG_INT, MPI_COMM_WORLD, &istatus);
286        
287 <      mpiErr = MPI_Recv(&sendError,1,MPI_INT,0,TAKE_THIS_TAG,MPI_COMM_WORLD,
288 <               istatus);
289 <      if (sendError) MPIcheckPoint();
287 >      if(!myStatus) anonymousNodeDie();
288 >      
289 >      if(myStatus < 0) break;
290  
291 <      for ( i = 0; i < entry_plug->n_atoms; i++){
292 <
293 <        mpiErr = MPI_Recv(&read_buffer,BUFFERSIZE,MPI_CHAR,0,TAKE_THIS_TAG,MPI_COMM_WORLD,
294 <                          istatus);
295 <        
296 <        if(!strcmp(read_buffer, "ERROR")) MPIcheckPoint();
297 <        
298 <        parseErr = parseDumpLine( read_buffer, i );
299 <        if( parseErr != NULL ){
300 <          sendError = 1;
301 <          mpiErr = MPI_Send(&sendError,1,MPI_INT,0,TAKE_THIS_TAG,MPI_COMM_WORLD);
285 <
286 <
287 <          strcpy( painCave.errMsg, parseErr );
288 <          painCave.isFatal = 1;
289 <          simError();
290 <        }
291 <        sendError = 0;
292 <        mpiErr = MPI_Send(&sendError,1,MPI_INT,0,TAKE_THIS_TAG,MPI_COMM_WORLD);
291 >      MPI_Recv(read_buffer, BUFFERSIZE, MPI_CHAR, 0,
292 >               TAKE_THIS_TAG_CHAR, MPI_COMM_WORLD, &istatus);
293 >      MPI_Recv(&which_atom, 1, MPI_INT, 0,
294 >               TAKE_THIS_TAG_INT, MPI_COMM_WORLD, &istatus);
295 >      
296 >      myStatus = 1;
297 >      parseErr = parseDumpLine( read_buffer, which_atom );
298 >      if( parseErr != NULL ){
299 >        strcpy( painCave.errMsg, parseErr );
300 >        myStatus = 0;;
301 >        simError();
302        }
303 +      
304 +      MPI_Send( &myStatus, 1, MPI_INT, 0,
305 +                TAKE_THIS_TAG_INT, MPI_COMM_WORLD);
306 +      
307      }
295    sprintf(checkPointMsg,"Node %d received initial configuration.",procIndex);
296    MPIcheckPoint();
308    }
309 +    
310 + // last  thing last, enable  fatalities.
311 +  painCave.isEventLoop = 0;
312  
313 +  for(i=0;i<3;i++)
314 +    for(j=0;j<3;j++) theBoxMat3[i][j] = boxMat[3*j+i];
315 +
316 +  simnfo->setBoxM( theBoxMat3 );
317 +  simnfo->setTime( currTime );
318 +
319 +  
320   #endif
321   }
322  
323 + char* InitializeFromFile::parseDumpLine(char* readLine, int globalIndex){
324  
303 char* InitializeFromFile::parseDumpLine(char* readLine, int atomIndex){
304
325    char *foo; // the pointer to the current string token
326    
327 <  double rx, ry, rz; // position place holders
328 <  double vx, vy, vz; // velocity placeholders
327 >  double pos[3]; // position place holders
328 >  double vel[3]; // velocity placeholders
329    double q[4]; // the quaternions
330    double jx, jy, jz; // angular velocity placeholders;
331    double qSqr, qLength; // needed to normalize the quaternion vector.
332    
333 <  Atom **atoms = entry_plug->atoms;
333 >  Atom **atoms = simnfo->atoms;
334    DirectionalAtom* dAtom;
335    
336 <  int n_atoms;
336 >  int j, n_atoms, atomIndex;
337  
338   #ifdef IS_MPI
339    n_atoms = mpiSim->getTotAtoms();
340 +  atomIndex=-1;        
341 +  for (j=0; j < mpiSim->getMyNlocal(); j++) {
342 +    if (atoms[j]->getGlobalIndex() == globalIndex) atomIndex = j;
343 +  }
344 +  if (atomIndex == -1) {
345 +    sprintf( painCave.errMsg,
346 +             "Initialize from file error. Atom at index %d "
347 +             "in file %s does not exist on processor %d .\n",
348 +             globalIndex, c_in_name, mpiSim->getMyNode() );
349 +    return strdup( painCave.errMsg );
350 +  }  
351   #else
352 <  n_atoms = entry_plug->n_atoms;
352 >  n_atoms = simnfo->n_atoms;
353 >  atomIndex = globalIndex;
354   #endif // is_mpi
355  
324
356    // set the string tokenizer
357    
358    foo = strtok(readLine, " ,;\t");
# Line 347 | Line 378 | char* InitializeFromFile::parseDumpLine(char* readLine
378               c_in_name, n_atoms, atomIndex );
379      return strdup( painCave.errMsg );
380    }
381 <  rx = atof( foo );
381 >  pos[0] = atof( foo );
382    
383    foo = strtok(NULL, " ,;\t");
384    if(foo == NULL){
# Line 357 | Line 388 | char* InitializeFromFile::parseDumpLine(char* readLine
388               c_in_name, n_atoms, atomIndex );
389      return strdup( painCave.errMsg );
390    }
391 <  ry = atof( foo );
391 >  pos[1] = atof( foo );
392      
393    foo = strtok(NULL, " ,;\t");
394    if(foo == NULL){
# Line 367 | Line 398 | char* InitializeFromFile::parseDumpLine(char* readLine
398               c_in_name, n_atoms, atomIndex );
399      return strdup( painCave.errMsg );
400    }
401 <  rz = atof( foo );    
401 >  pos[2] = atof( foo );    
402  
403  
404    // get the velocities
# Line 380 | Line 411 | char* InitializeFromFile::parseDumpLine(char* readLine
411               c_in_name, n_atoms, atomIndex );
412      return strdup( painCave.errMsg );
413    }
414 <  vx = atof( foo );
414 >  vel[0] = atof( foo );
415      
416    foo = strtok(NULL, " ,;\t");
417    if(foo == NULL){
# Line 390 | Line 421 | char* InitializeFromFile::parseDumpLine(char* readLine
421               c_in_name, n_atoms, atomIndex );
422      return strdup( painCave.errMsg );
423    }
424 <  vy = atof( foo );
424 >  vel[1] = atof( foo );
425      
426    foo = strtok(NULL, " ,;\t");
427    if(foo == NULL){
# Line 400 | Line 431 | char* InitializeFromFile::parseDumpLine(char* readLine
431               c_in_name, n_atoms, atomIndex );
432      return strdup( painCave.errMsg );
433    }
434 <  vz = atof( foo );
434 >  vel[2] = atof( foo );
435      
436      
437    // get the quaternions
# Line 502 | Line 533 | char* InitializeFromFile::parseDumpLine(char* readLine
533      
534    // add the positions and velocities to the atom
535      
536 <  atoms[atomIndex]->setX( rx );
537 <  atoms[atomIndex]->setY( ry );
507 <  atoms[atomIndex]->setZ( rz );
508 <    
509 <  atoms[atomIndex]->set_vx( vx );
510 <  atoms[atomIndex]->set_vy( vy );
511 <  atoms[atomIndex]->set_vz( vz );
536 >  atoms[atomIndex]->setPos( pos );
537 >  atoms[atomIndex]->setVel( vel );
538  
539    return NULL;
540   }
541 +
542 +
543 + char* InitializeFromFile::parseBoxLine(char* readLine, double boxMat[9],
544 +                                       double &time ){
545 +
546 +  char *foo; // the pointer to the current string token
547 +  int j;
548 +
549 +  // set the string tokenizer
550 +  
551 +  foo = strtok(readLine, " ,;\t");
552 +  // set the timeToken.
553 +
554 +  if(foo == NULL){
555 +    sprintf( painCave.errMsg,
556 +             "error in reading Time from %s\n",
557 +             c_in_name );
558 +    return strdup( painCave.errMsg );
559 +  }
560 +  time = atof( foo );
561 +
562 +  // get the Hx vector
563 +
564 +  foo = strtok(NULL, " ,;\t");
565 +  if(foo == NULL){
566 +    sprintf( painCave.errMsg,
567 +             "error in reading Hx[0] from %s\n",
568 +             c_in_name );
569 +    return strdup( painCave.errMsg );
570 +  }
571 +  boxMat[0] = atof( foo );
572 +  
573 +  foo = strtok(NULL, " ,;\t");
574 +  if(foo == NULL){
575 +    sprintf( painCave.errMsg,
576 +             "error in reading Hx[1] from %s\n",
577 +             c_in_name );
578 +    return strdup( painCave.errMsg );
579 +  }
580 +  boxMat[1] = atof( foo );
581 +    
582 +  foo = strtok(NULL, " ,;\t");
583 +  if(foo == NULL){
584 +    sprintf( painCave.errMsg,
585 +             "error in reading Hx[2] from %s\n",
586 +             c_in_name );
587 +    return strdup( painCave.errMsg );
588 +  }
589 +  boxMat[2] = atof( foo );    
590 +
591 +  // get the Hy vector
592 +
593 +  foo = strtok(NULL, " ,;\t");
594 +  if(foo == NULL){
595 +    sprintf( painCave.errMsg,
596 +             "error in reading Hy[0] from %s\n",
597 +             c_in_name );
598 +    return strdup( painCave.errMsg );
599 +  }
600 +  boxMat[3] = atof( foo );
601 +  
602 +  foo = strtok(NULL, " ,;\t");
603 +  if(foo == NULL){
604 +    sprintf( painCave.errMsg,
605 +             "error in reading Hy[1] from %s\n",
606 +             c_in_name );
607 +    return strdup( painCave.errMsg );
608 +  }
609 +  boxMat[4] = atof( foo );
610 +    
611 +  foo = strtok(NULL, " ,;\t");
612 +  if(foo == NULL){
613 +    sprintf( painCave.errMsg,
614 +             "error in reading Hy[2] from %s\n",
615 +             c_in_name );
616 +    return strdup( painCave.errMsg );
617 +  }
618 +  boxMat[5] = atof( foo );    
619 +
620 +  // get the Hz vector
621 +
622 +  foo = strtok(NULL, " ,;\t");
623 +  if(foo == NULL){
624 +    sprintf( painCave.errMsg,
625 +             "error in reading Hz[0] from %s\n",
626 +             c_in_name );
627 +    return strdup( painCave.errMsg );
628 +  }
629 +  boxMat[6] = atof( foo );
630 +  
631 +  foo = strtok(NULL, " ,;\t");
632 +  if(foo == NULL){
633 +    sprintf( painCave.errMsg,
634 +             "error in reading Hz[1] from %s\n",
635 +             c_in_name );
636 +    return strdup( painCave.errMsg );
637 +  }
638 +  boxMat[7] = atof( foo );
639 +    
640 +  foo = strtok(NULL, " ,;\t");
641 +  if(foo == NULL){
642 +    sprintf( painCave.errMsg,
643 +             "error in reading Hz[2] from %s\n",
644 +             c_in_name );
645 +    return strdup( painCave.errMsg );
646 +  }
647 +  boxMat[8] = atof( foo );    
648 +
649 +  return NULL;
650 + }
651 +
652 +
653 + #ifdef IS_MPI
654 +
655 + // a couple of functions to let us escape the read loop
656 +
657 + void initFile::nodeZeroError( void ){
658 +  int j, myStatus;
659 +  
660 +  myStatus = 0;
661 +  for (j = 0; j < mpiSim->getNumberProcessors(); j++) {      
662 +    MPI_Send( &myStatus, 1, MPI_INT, j,
663 +              TAKE_THIS_TAG_INT, MPI_COMM_WORLD);
664 +  }  
665 +  
666 +
667 +  MPI_Finalize();
668 +  exit (0);
669 +  
670 + }
671 +
672 + void initFile::anonymousNodeDie( void ){
673 +
674 +  MPI_Finalize();
675 +  exit (0);
676 + }
677 +
678 + #endif //is_mpi

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines