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

Comparing trunk/OOPSE/libmdtools/InitializeFromFile.cpp (file contents):
Revision 830 by gezelter, Tue Oct 28 16:20:28 2003 UTC vs.
Revision 1097 by gezelter, Mon Apr 12 20:32:20 2004 UTC

# Line 11 | Line 11
11  
12   #include "ReadWrite.hpp"
13   #include "simError.h"
14 + #include "GenericData.hpp"
15  
16   #ifdef IS_MPI
17   #include <mpi.h>
# Line 40 | Line 41 | InitializeFromFile::InitializeFromFile( char *in_name
41      painCave.isFatal = 1;
42      simError();
43    }
44 <  
44 >
45    strcpy( c_in_name, in_name);
46   #ifdef IS_MPI
47    }
48 < strcpy( checkPointMsg, "Infile opened for reading successfully." );
48 >  else{
49 >          sprintf( c_in_name, "mpiNodeParser_%d", worldRank );
50 >  }
51 >  
52 >  strcpy( checkPointMsg, "Infile opened for reading successfully." );
53    MPIcheckPoint();
54   #endif
55 <  return;  
55 >  return;
56   }
57  
58   InitializeFromFile::~InitializeFromFile( ){
# Line 74 | Line 79 | void InitializeFromFile :: readInit( SimInfo* the_simn
79   void InitializeFromFile :: readInit( SimInfo* the_simnfo ){
80  
81    int i, j;
82 <  
82 >
83   #ifdef IS_MPI
84    int done, which_node, which_atom; // loop counter
85   #endif //is_mpi
86  
87    const int BUFFERSIZE = 2000; // size of the read buffer
88    int n_atoms; // the number of atoms
89 <  char read_buffer[BUFFERSIZE]; //the line buffer for reading
89 >  char read_buffer[BUFFERSIZE]; //the line buffer for reading
90  
91 <  char *eof_test; // ptr to see when we reach the end of the file
91 >  char *eof_test; // ptr to see when we reach the end of the file
92    char *parseErr;
93  
89  double currTime;
90  double boxMat[9];
91  double theBoxMat3[3][3];
92
94    simnfo = the_simnfo;
95  
96  
# Line 113 | Line 114 | void InitializeFromFile :: readInit( SimInfo* the_simn
114      painCave.isFatal = 1;
115      simError();
116    }
117 <  
118 <  //read the box mat from the comment line
119 <  
117 >
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){
122      sprintf( painCave.errMsg,
# Line 124 | Line 125 | void InitializeFromFile :: readInit( SimInfo* the_simn
125      simError();
126    }
127  
128 <  parseErr = parseBoxLine( read_buffer, boxMat, currTime );
128 >
129 >
130 >  parseErr = parseCommentLine( read_buffer, simnfo);
131    if( parseErr != NULL ){
132      strcpy( painCave.errMsg, parseErr );
133      painCave.isFatal = 1;
134      simError();
135    }
136  
137 <  for(i=0;i<3;i++)
135 <    for(j=0;j<3;j++) theBoxMat3[i][j] = boxMat[3*j+i];
137 >  //parse dump lines
138  
137  simnfo->setBoxM( theBoxMat3 );
138  simnfo->setTime( currTime );
139
140
139    for( i=0; i < n_atoms; i++){
140 <    
140 >
141      eof_test = fgets(read_buffer, sizeof(read_buffer), c_in_file);
142      if(eof_test == NULL){
143        sprintf(painCave.errMsg,
# Line 151 | Line 149 | void InitializeFromFile :: readInit( SimInfo* the_simn
149        simError();
150      }
151  
152 <    
152 >
153      parseErr = parseDumpLine( read_buffer, i );
154      if( parseErr != NULL ){
155        strcpy( painCave.errMsg, parseErr );
# Line 169 | Line 167 | void InitializeFromFile :: readInit( SimInfo* the_simn
167  
168    int myStatus; // 1 = wakeup & success; 0 = error; -1 = AllDone
169    int haveError;
170 <  
170 >
171    MPI_Status istatus;
172    int *AtomToProcMap = mpiSim->getAtomToProcMap();
173  
174 <  
174 >
175    haveError = 0;
176    if (worldRank == 0) {
177  
# Line 184 | Line 182 | void InitializeFromFile :: readInit( SimInfo* the_simn
182        haveError = 1;
183        simError();
184      }
185 <    
185 >
186      n_atoms = atoi( read_buffer );
187 <    
187 >
188      // Check to see that the number of atoms in the intial configuration file is the
189      // same as declared in simBass.
190 <    
190 >
191      if( n_atoms != mpiSim->getTotAtoms() ){
192        sprintf( painCave.errMsg,
193                 "Initialize from File error. %s n_atoms, %d, "
# Line 198 | Line 196 | void InitializeFromFile :: readInit( SimInfo* the_simn
196        haveError= 1;
197        simError();
198      }
199 <    
200 <    //read the boxMat from the comment line
201 <    
199 >
200 >    //read the boxMat from the comment line
201 >
202      eof_test = fgets(read_buffer, sizeof(read_buffer), c_in_file);
203      if(eof_test == NULL){
204        sprintf( painCave.errMsg,
# Line 208 | Line 206 | void InitializeFromFile :: readInit( SimInfo* the_simn
206        haveError = 1;
207        simError();
208      }
209 <    
210 <    parseErr = parseBoxLine( read_buffer, boxMat, currTime );
209 >
210 >    //Every single processor will parse the comment line by itself
211 >    //By using this way, we might lose some efficiency, but if we want to add
212 >    //more parameters into comment line, we only need to modify function
213 >    //parseCommentLine
214 >
215 >    MPI_Bcast(read_buffer, BUFFERSIZE, MPI_CHAR, 0, MPI_COMM_WORLD);
216 >
217 >    parseErr = parseCommentLine( read_buffer, simnfo);
218 >
219      if( parseErr != NULL ){
220        strcpy( painCave.errMsg, parseErr );
221        haveError = 1;
222        simError();
223      }
224  
219    MPI_Bcast(boxMat, 9, MPI_DOUBLE, 0, MPI_COMM_WORLD );
220    MPI_Bcast(&currTime, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD );
221  
222    if(haveError) nodeZeroError();
223
225      for (i=0 ; i < mpiSim->getTotAtoms(); i++) {
226 <      
226 >
227        eof_test = fgets(read_buffer, sizeof(read_buffer), c_in_file);
228        if(eof_test == NULL){
229          sprintf(painCave.errMsg,
# Line 233 | Line 234 | void InitializeFromFile :: readInit( SimInfo* the_simn
234          haveError= 1;
235          simError();
236        }
237 <    
237 >
238        if(haveError) nodeZeroError();
239  
240        // Get the Node number which wants this atom:
241 <      which_node = AtomToProcMap[i];    
241 >      which_node = AtomToProcMap[i];
242        if (which_node == 0) {
243          parseErr = parseDumpLine( read_buffer, i );
244          if( parseErr != NULL ){
245            strcpy( painCave.errMsg, parseErr );
246            haveError = 1;
247            simError();
248 <        }    
248 >        }
249          if(haveError) nodeZeroError();
250 <      }
251 <      
250 >      }
251 >
252        else {
253 <      
253 >
254          myStatus = 1;
255 <        MPI_Send(&myStatus, 1, MPI_INT, which_node,
255 >        MPI_Send(&myStatus, 1, MPI_INT, which_node,
256                   TAKE_THIS_TAG_INT, MPI_COMM_WORLD);
257 <        MPI_Send(read_buffer, BUFFERSIZE, MPI_CHAR, which_node,
257 >        MPI_Send(read_buffer, BUFFERSIZE, MPI_CHAR, which_node,
258                   TAKE_THIS_TAG_CHAR, MPI_COMM_WORLD);
259          MPI_Send(&i, 1, MPI_INT, which_node, TAKE_THIS_TAG_INT,
260                   MPI_COMM_WORLD);
261 <        MPI_Recv(&myStatus, 1, MPI_INT, which_node, TAKE_THIS_TAG_INT,
261 >        MPI_Recv(&myStatus, 1, MPI_INT, which_node, TAKE_THIS_TAG_INT,
262                   MPI_COMM_WORLD, &istatus);
263 <        
263 >
264          if(!myStatus) nodeZeroError();
265        }
266      }
267      myStatus = -1;
268 <    for (j = 0; j < mpiSim->getNumberProcessors(); j++) {      
269 <      MPI_Send( &myStatus, 1, MPI_INT, j,
268 >    for (j = 1; j < mpiSim->getNumberProcessors(); j++) {
269 >      MPI_Send( &myStatus, 1, MPI_INT, j,
270                  TAKE_THIS_TAG_INT, MPI_COMM_WORLD);
271      }
272 <    
272 >
273    } else {
273    
274    MPI_Bcast(boxMat, 9, MPI_DOUBLE, 0, MPI_COMM_WORLD);
275    MPI_Bcast(&currTime, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD);
274  
275 +    MPI_Bcast(read_buffer, BUFFERSIZE, MPI_CHAR, 0, MPI_COMM_WORLD);
276 +
277 +    parseErr = parseCommentLine( read_buffer, simnfo);
278 +
279 +    if( parseErr != NULL ){
280 +      strcpy( painCave.errMsg, parseErr );
281 +      haveError = 1;
282 +      simError();
283 +    }
284 +
285 +
286      done = 0;
287      while (!done) {
288  
289 <      MPI_Recv(&myStatus, 1, MPI_INT, 0,
289 >      MPI_Recv(&myStatus, 1, MPI_INT, 0,
290                 TAKE_THIS_TAG_INT, MPI_COMM_WORLD, &istatus);
291 <      
291 >
292        if(!myStatus) anonymousNodeDie();
293 <      
293 >
294        if(myStatus < 0) break;
295  
296 <      MPI_Recv(read_buffer, BUFFERSIZE, MPI_CHAR, 0,
296 >      MPI_Recv(read_buffer, BUFFERSIZE, MPI_CHAR, 0,
297                 TAKE_THIS_TAG_CHAR, MPI_COMM_WORLD, &istatus);
298 <      MPI_Recv(&which_atom, 1, MPI_INT, 0,
298 >      MPI_Recv(&which_atom, 1, MPI_INT, 0,
299                 TAKE_THIS_TAG_INT, MPI_COMM_WORLD, &istatus);
300 <      
300 >
301        myStatus = 1;
302        parseErr = parseDumpLine( read_buffer, which_atom );
303        if( parseErr != NULL ){
# Line 296 | Line 305 | void InitializeFromFile :: readInit( SimInfo* the_simn
305          myStatus = 0;;
306          simError();
307        }
308 <      
309 <      MPI_Send( &myStatus, 1, MPI_INT, 0,
308 >
309 >      MPI_Send( &myStatus, 1, MPI_INT, 0,
310                  TAKE_THIS_TAG_INT, MPI_COMM_WORLD);
311 <      
311 >
312      }
313    }
314 <    
314 >
315   // last  thing last, enable  fatalities.
316    painCave.isEventLoop = 0;
317  
309  for(i=0;i<3;i++)
310    for(j=0;j<3;j++) theBoxMat3[i][j] = boxMat[3*j+i];
318  
312  simnfo->setBoxM( theBoxMat3 );
313  simnfo->setTime( currTime );
319  
315  
320   #endif
321   }
322  
323   char* InitializeFromFile::parseDumpLine(char* readLine, int globalIndex){
324  
325 <  char *foo; // the pointer to the current string token
326 <  
325 >  char *foo; // the pointer to the current string token
326 >
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;
330 >  double ji[3]; // angular velocity placeholders;
331    double qSqr, qLength; // needed to normalize the quaternion vector.
332 <  
332 >
333    Atom **atoms = simnfo->atoms;
334    DirectionalAtom* dAtom;
335 <  
335 >
336    int n_atoms, atomIndex;
337  
338   #ifdef IS_MPI
339    int j;
340  
341    n_atoms = mpiSim->getTotAtoms();
342 <  atomIndex=-1;        
342 >  atomIndex=-1;
343    for (j=0; j < mpiSim->getMyNlocal(); j++) {
344      if (atoms[j]->getGlobalIndex() == globalIndex) atomIndex = j;
345    }
# Line 345 | Line 349 | char* InitializeFromFile::parseDumpLine(char* readLine
349               "in file %s does not exist on processor %d .\n",
350               globalIndex, c_in_name, mpiSim->getMyNode() );
351      return strdup( painCave.errMsg );
352 <  }  
352 >  }
353   #else
354    n_atoms = simnfo->n_atoms;
355    atomIndex = globalIndex;
356   #endif // is_mpi
357  
358    // set the string tokenizer
359 <  
359 >
360    foo = strtok(readLine, " ,;\t");
361 <  
361 >
362    // check the atom name to the current atom
363 <  
363 >
364    if( strcmp( foo, atoms[atomIndex]->getType() ) ){
365      sprintf( painCave.errMsg,
366               "Initialize from file error. Atom %s at index %d "
# Line 365 | Line 369 | char* InitializeFromFile::parseDumpLine(char* readLine
369               foo, atomIndex, c_in_name, atoms[atomIndex]->getType() );
370      return strdup( painCave.errMsg );
371    }
372 <    
372 >
373    // get the positions
374  
375    foo = strtok(NULL, " ,;\t");
# Line 377 | Line 381 | char* InitializeFromFile::parseDumpLine(char* readLine
381      return strdup( painCave.errMsg );
382    }
383    pos[0] = atof( foo );
384 <  
384 >
385    foo = strtok(NULL, " ,;\t");
386    if(foo == NULL){
387      sprintf( painCave.errMsg,
# Line 387 | Line 391 | char* InitializeFromFile::parseDumpLine(char* readLine
391      return strdup( painCave.errMsg );
392    }
393    pos[1] = atof( foo );
394 <    
394 >
395    foo = strtok(NULL, " ,;\t");
396    if(foo == NULL){
397      sprintf( painCave.errMsg,
# Line 396 | Line 400 | char* InitializeFromFile::parseDumpLine(char* readLine
400               c_in_name, n_atoms, atomIndex );
401      return strdup( painCave.errMsg );
402    }
403 <  pos[2] = atof( foo );    
403 >  pos[2] = atof( foo );
404  
405  
406    // get the velocities
# Line 410 | Line 414 | char* InitializeFromFile::parseDumpLine(char* readLine
414      return strdup( painCave.errMsg );
415    }
416    vel[0] = atof( foo );
417 <    
417 >
418    foo = strtok(NULL, " ,;\t");
419    if(foo == NULL){
420      sprintf( painCave.errMsg,
# Line 420 | Line 424 | char* InitializeFromFile::parseDumpLine(char* readLine
424      return strdup( painCave.errMsg );
425    }
426    vel[1] = atof( foo );
427 <    
427 >
428    foo = strtok(NULL, " ,;\t");
429    if(foo == NULL){
430      sprintf( painCave.errMsg,
# Line 430 | Line 434 | char* InitializeFromFile::parseDumpLine(char* readLine
434      return strdup( painCave.errMsg );
435    }
436    vel[2] = atof( foo );
437 <    
438 <    
437 >
438 >
439    // get the quaternions
440 <    
440 >
441    if( atoms[atomIndex]->isDirectional() ){
442 <      
442 >
443      foo = strtok(NULL, " ,;\t");
444      if(foo == NULL){
445        sprintf(painCave.errMsg,
# Line 445 | Line 449 | char* InitializeFromFile::parseDumpLine(char* readLine
449        return strdup( painCave.errMsg );
450      }
451      q[0] = atof( foo );
452 <      
452 >
453      foo = strtok(NULL, " ,;\t");
454      if(foo == NULL){
455        sprintf( painCave.errMsg,
# Line 455 | Line 459 | char* InitializeFromFile::parseDumpLine(char* readLine
459        return strdup( painCave.errMsg );
460      }
461      q[1] = atof( foo );
462 <      
462 >
463      foo = strtok(NULL, " ,;\t");
464      if(foo == NULL){
465        sprintf( painCave.errMsg,
# Line 465 | Line 469 | char* InitializeFromFile::parseDumpLine(char* readLine
469        return strdup( painCave.errMsg );
470      }
471      q[2] = atof( foo );
472 <      
472 >
473      foo = strtok(NULL, " ,;\t");
474      if(foo == NULL){
475        sprintf( painCave.errMsg,
# Line 475 | Line 479 | char* InitializeFromFile::parseDumpLine(char* readLine
479        return strdup( painCave.errMsg );
480      }
481      q[3] = atof( foo );
482 <      
482 >
483      // get the angular velocities
484 <      
484 >
485      foo = strtok(NULL, " ,;\t");
486      if(foo == NULL){
487        sprintf( painCave.errMsg,
# Line 486 | Line 490 | char* InitializeFromFile::parseDumpLine(char* readLine
490                 c_in_name, n_atoms, atomIndex );
491        return strdup( painCave.errMsg );
492      }
493 <    jx = atof( foo );
494 <      
493 >    ji[0] = atof( foo );
494 >
495      foo = strtok(NULL, " ,;\t");
496      if(foo == NULL){
497        sprintf( painCave.errMsg,
# Line 496 | Line 500 | char* InitializeFromFile::parseDumpLine(char* readLine
500                 c_in_name, n_atoms, atomIndex );
501        return strdup( painCave.errMsg );
502      }
503 <    jy = atof(foo );
504 <      
503 >    ji[1] = atof(foo );
504 >
505      foo = strtok(NULL, " ,;\t");
506      if(foo == NULL){
507        sprintf( painCave.errMsg,
# Line 506 | Line 510 | char* InitializeFromFile::parseDumpLine(char* readLine
510                 c_in_name, n_atoms, atomIndex );
511        return strdup( painCave.errMsg );
512      }
513 <    jz = atof( foo );
514 <      
513 >    ji[2] = atof( foo );
514 >
515      dAtom = ( DirectionalAtom* )atoms[atomIndex];
516  
517      // check that the quaternion vector is normalized
518  
519      qSqr = (q[0] * q[0]) + (q[1] * q[1]) + (q[2] * q[2]) + (q[3] * q[3]);
520 <      
520 >
521      qLength = sqrt( qSqr );
522      q[0] = q[0] / qLength;
523      q[1] = q[1] / qLength;
524      q[2] = q[2] / qLength;
525      q[3] = q[3] / qLength;
526 <      
526 >
527      dAtom->setQ( q );
528 <      
528 >
529      // add the angular velocities
530  
531 <    dAtom->setJx( jx );
528 <    dAtom->setJy( jy );
529 <    dAtom->setJz( jz );
531 >    dAtom->setJ( ji );
532    }
533 <    
533 >
534    // add the positions and velocities to the atom
535 <    
535 >
536    atoms[atomIndex]->setPos( pos );
537    atoms[atomIndex]->setVel( vel );
538  
# Line 538 | Line 540 | char* InitializeFromFile::parseBoxLine(char* readLine,
540   }
541  
542  
543 < char* InitializeFromFile::parseBoxLine(char* readLine, double boxMat[9],
542 <                                       double &time ){
543 > char* InitializeFromFile::parseCommentLine(char* readLine, SimInfo* entry_plug){
544  
545 <  char *foo; // the pointer to the current string token
545 >  double currTime;
546 >  double boxMat[9];
547 >  double theBoxMat3[3][3];
548 >  double chi;
549 >  double integralOfChidt;
550 >  double eta[9];
551  
552 +  char *foo; // the pointer to the current string token
553 +
554    // set the string tokenizer
555 <  
555 >
556    foo = strtok(readLine, " ,;\t");
557    // set the timeToken.
558  
# Line 554 | Line 562 | char* InitializeFromFile::parseBoxLine(char* readLine,
562               c_in_name );
563      return strdup( painCave.errMsg );
564    }
557  time = atof( foo );
565  
566 <  // get the Hx vector
566 >  currTime = atof( foo );
567 >  entry_plug->setTime( currTime );
568  
569 <  foo = strtok(NULL, " ,;\t");
570 <  if(foo == NULL){
571 <    sprintf( painCave.errMsg,
572 <             "error in reading Hx[0] from %s\n",
573 <             c_in_name );
574 <    return strdup( painCave.errMsg );
569 >  //get H-Matrix
570 >
571 >  for(int i = 0 ; i < 9; i++){
572 >    foo = strtok(NULL, " ,;\t");
573 >    if(foo == NULL){
574 >      sprintf( painCave.errMsg,
575 >               "error in reading H[%d] from %s\n", i, c_in_name );
576 >      return strdup( painCave.errMsg );
577 >    }
578 >    boxMat[i] = atof( foo );
579    }
568  boxMat[0] = atof( foo );
569  
570  foo = strtok(NULL, " ,;\t");
571  if(foo == NULL){
572    sprintf( painCave.errMsg,
573             "error in reading Hx[1] from %s\n",
574             c_in_name );
575    return strdup( painCave.errMsg );
576  }
577  boxMat[1] = atof( foo );
578    
579  foo = strtok(NULL, " ,;\t");
580  if(foo == NULL){
581    sprintf( painCave.errMsg,
582             "error in reading Hx[2] from %s\n",
583             c_in_name );
584    return strdup( painCave.errMsg );
585  }
586  boxMat[2] = atof( foo );    
580  
581 <  // get the Hy vector
581 >  for(int i=0;i<3;i++)
582 >    for(int j=0;j<3;j++) theBoxMat3[i][j] = boxMat[3*j+i];
583  
584 <  foo = strtok(NULL, " ,;\t");
585 <  if(foo == NULL){
592 <    sprintf( painCave.errMsg,
593 <             "error in reading Hy[0] from %s\n",
594 <             c_in_name );
595 <    return strdup( painCave.errMsg );
596 <  }
597 <  boxMat[3] = atof( foo );
598 <  
599 <  foo = strtok(NULL, " ,;\t");
600 <  if(foo == NULL){
601 <    sprintf( painCave.errMsg,
602 <             "error in reading Hy[1] from %s\n",
603 <             c_in_name );
604 <    return strdup( painCave.errMsg );
605 <  }
606 <  boxMat[4] = atof( foo );
607 <    
608 <  foo = strtok(NULL, " ,;\t");
609 <  if(foo == NULL){
610 <    sprintf( painCave.errMsg,
611 <             "error in reading Hy[2] from %s\n",
612 <             c_in_name );
613 <    return strdup( painCave.errMsg );
614 <  }
615 <  boxMat[5] = atof( foo );    
584 >  //set H-Matrix
585 >  entry_plug->setBoxM( theBoxMat3 );
586  
587 <  // get the Hz vector
587 >  //get chi and integralOfChidt, they should appear by pair
588  
589 <  foo = strtok(NULL, " ,;\t");
590 <  if(foo == NULL){
591 <    sprintf( painCave.errMsg,
592 <             "error in reading Hz[0] from %s\n",
593 <             c_in_name );
594 <    return strdup( painCave.errMsg );
589 >  if( entry_plug->useInitXSstate ){
590 >    foo = strtok(NULL, " ,;\t\n");
591 >    if(foo != NULL){
592 >      chi = atof(foo);
593 >      
594 >      foo = strtok(NULL, " ,;\t\n");
595 >      if(foo == NULL){
596 >        sprintf( painCave.errMsg,
597 >                 "chi and integralOfChidt should appear by pair in %s\n", c_in_name );
598 >        return strdup( painCave.errMsg );
599 >      }
600 >      integralOfChidt = atof( foo );
601 >      
602 >      //push chi and integralOfChidt into SimInfo::properties which can be
603 >      //retrieved by integrator later
604 >      DoubleData* chiValue = new DoubleData();
605 >      chiValue->setID(CHIVALUE_ID);
606 >      chiValue->setData(chi);
607 >      entry_plug->addProperty(chiValue);
608 >      
609 >      DoubleData* integralOfChidtValue = new DoubleData();
610 >      integralOfChidtValue->setID(INTEGRALOFCHIDT_ID);
611 >      integralOfChidtValue->setData(integralOfChidt);
612 >      entry_plug->addProperty(integralOfChidtValue);
613 >      
614 >    }
615 >    else
616 >      return NULL;
617 >    
618 >    //get eta
619 >    foo = strtok(NULL, " ,;\t\n");
620 >    if(foo != NULL ){
621 >  
622 >      for(int i = 0 ; i < 9; i++){
623 >        
624 >        if(foo == NULL){
625 >          sprintf( painCave.errMsg,
626 >                   "error in reading eta[%d] from %s\n", i, c_in_name );
627 >          return strdup( painCave.errMsg );
628 >        }
629 >        eta[i] = atof( foo );
630 >        foo = strtok(NULL, " ,;\t\n");
631 >      }
632 >    }
633 >    else
634 >      return NULL;
635 >    
636 >    //push eta into SimInfo::properties which can be
637 >    //retrieved by integrator later
638 >    //entry_plug->setBoxM( theBoxMat3 );
639 >    DoubleArrayData* etaValue = new DoubleArrayData();
640 >    etaValue->setID(ETAVALUE_ID);
641 >    etaValue->setData(eta, 9);
642 >    entry_plug->addProperty(etaValue);
643    }
626  boxMat[6] = atof( foo );
627  
628  foo = strtok(NULL, " ,;\t");
629  if(foo == NULL){
630    sprintf( painCave.errMsg,
631             "error in reading Hz[1] from %s\n",
632             c_in_name );
633    return strdup( painCave.errMsg );
634  }
635  boxMat[7] = atof( foo );
636    
637  foo = strtok(NULL, " ,;\t");
638  if(foo == NULL){
639    sprintf( painCave.errMsg,
640             "error in reading Hz[2] from %s\n",
641             c_in_name );
642    return strdup( painCave.errMsg );
643  }
644  boxMat[8] = atof( foo );    
644  
645    return NULL;
646   }
647  
649
648   #ifdef IS_MPI
649  
650   // a couple of functions to let us escape the read loop
651  
652   void initFile::nodeZeroError( void ){
653    int j, myStatus;
654 <  
654 >
655    myStatus = 0;
656 <  for (j = 0; j < mpiSim->getNumberProcessors(); j++) {      
657 <    MPI_Send( &myStatus, 1, MPI_INT, j,
656 >  for (j = 0; j < mpiSim->getNumberProcessors(); j++) {
657 >    MPI_Send( &myStatus, 1, MPI_INT, j,
658                TAKE_THIS_TAG_INT, MPI_COMM_WORLD);
659 <  }  
662 <  
659 >  }
660  
661 +
662    MPI_Finalize();
663    exit (0);
664 <  
664 >
665   }
666  
667   void initFile::anonymousNodeDie( void ){

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines