# | Line 26 | Line 26 | using namespace initFile; | |
---|---|---|
26 | ||
27 | #endif // is_mpi | |
28 | ||
29 | < | InitializeFromFile :: InitializeFromFile( char *in_name ){ |
29 | > | InitializeFromFile::InitializeFromFile( char *in_name ){ |
30 | > | |
31 | > | std::cerr << "Hello from Initialize from file.\n"; |
32 | > | |
33 | #ifdef IS_MPI | |
34 | if (worldRank == 0) { | |
35 | #endif | |
# | Line 48 | Line 51 | InitializeFromFile :: InitializeFromFile( char *in_nam | |
51 | return; | |
52 | } | |
53 | ||
54 | < | InitializeFromFile :: ~InitializeFromFile( ){ |
54 | > | InitializeFromFile::~InitializeFromFile( ){ |
55 | #ifdef IS_MPI | |
56 | if (worldRank == 0) { | |
57 | #endif | |
# | Line 83 | Line 86 | void InitializeFromFile :: readInit( SimInfo* the_simn | |
86 | char *eof_test; // ptr to see when we reach the end of the file | |
87 | char *parseErr; | |
88 | int procIndex; | |
89 | + | double currTime; |
90 | double boxMat[9]; | |
91 | double theBoxMat3[3][3]; | |
92 | ||
# | Line 123 | Line 127 | void InitializeFromFile :: readInit( SimInfo* the_simn | |
127 | simError(); | |
128 | } | |
129 | ||
130 | < | parseErr = parseBoxLine( read_buffer, boxMat ); |
130 | > | parseErr = parseBoxLine( read_buffer, boxMat, currTime ); |
131 | if( parseErr != NULL ){ | |
132 | strcpy( painCave.errMsg, parseErr ); | |
133 | painCave.isFatal = 1; | |
# | Line 134 | Line 138 | void InitializeFromFile :: readInit( SimInfo* the_simn | |
138 | for(j=0;j<3;j++) theBoxMat3[i][j] = boxMat[3*j+i]; | |
139 | ||
140 | simnfo->setBoxM( theBoxMat3 ); | |
141 | + | simnfo->setTime( currTime ); |
142 | ||
143 | ||
144 | for( i=0; i < n_atoms; i++){ | |
# | Line 210 | Line 215 | void InitializeFromFile :: readInit( SimInfo* the_simn | |
215 | simError(); | |
216 | } | |
217 | ||
218 | < | parseErr = parseBoxLine( read_buffer, boxMat ); |
218 | > | parseErr = parseBoxLine( read_buffer, boxMat, currTime ); |
219 | if( parseErr != NULL ){ | |
220 | strcpy( painCave.errMsg, parseErr ); | |
221 | haveError = 1; | |
# | Line 218 | Line 223 | void InitializeFromFile :: readInit( SimInfo* the_simn | |
223 | } | |
224 | ||
225 | MPI_Bcast(boxMat, 9, MPI_DOUBLE, 0, MPI_COMM_WORLD ); | |
226 | + | MPI_Bcast(&currTime, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD ); |
227 | ||
228 | if(haveError) nodeZeroError(); | |
229 | ||
# | Line 272 | Line 278 | void InitializeFromFile :: readInit( SimInfo* the_simn | |
278 | } else { | |
279 | ||
280 | MPI_Bcast(boxMat, 9, MPI_DOUBLE, 0, MPI_COMM_WORLD); | |
281 | + | MPI_Bcast(&currTime, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); |
282 | ||
283 | done = 0; | |
284 | while (!done) { | |
# | Line 309 | Line 316 | void InitializeFromFile :: readInit( SimInfo* the_simn | |
316 | for(j=0;j<3;j++) theBoxMat3[i][j] = boxMat[3*j+i]; | |
317 | ||
318 | simnfo->setBoxM( theBoxMat3 ); | |
319 | + | simnfo->setTime( currTime ); |
320 | ||
321 | ||
322 | #endif | |
# | Line 318 | Line 326 | char* InitializeFromFile::parseDumpLine(char* readLine | |
326 | ||
327 | char *foo; // the pointer to the current string token | |
328 | ||
329 | < | double rx, ry, rz; // position place holders |
330 | < | double vx, vy, vz; // velocity placeholders |
329 | > | double pos[3]; // position place holders |
330 | > | double vel[3]; // velocity placeholders |
331 | double q[4]; // the quaternions | |
332 | double jx, jy, jz; // angular velocity placeholders; | |
333 | double qSqr, qLength; // needed to normalize the quaternion vector. | |
# | Line 372 | Line 380 | char* InitializeFromFile::parseDumpLine(char* readLine | |
380 | c_in_name, n_atoms, atomIndex ); | |
381 | return strdup( painCave.errMsg ); | |
382 | } | |
383 | < | rx = atof( foo ); |
383 | > | pos[0] = atof( foo ); |
384 | ||
385 | foo = strtok(NULL, " ,;\t"); | |
386 | if(foo == NULL){ | |
# | Line 382 | Line 390 | char* InitializeFromFile::parseDumpLine(char* readLine | |
390 | c_in_name, n_atoms, atomIndex ); | |
391 | return strdup( painCave.errMsg ); | |
392 | } | |
393 | < | ry = atof( foo ); |
393 | > | pos[1] = atof( foo ); |
394 | ||
395 | foo = strtok(NULL, " ,;\t"); | |
396 | if(foo == NULL){ | |
# | Line 392 | Line 400 | char* InitializeFromFile::parseDumpLine(char* readLine | |
400 | c_in_name, n_atoms, atomIndex ); | |
401 | return strdup( painCave.errMsg ); | |
402 | } | |
403 | < | rz = atof( foo ); |
403 | > | pos[2] = atof( foo ); |
404 | ||
405 | ||
406 | // get the velocities | |
# | Line 405 | Line 413 | char* InitializeFromFile::parseDumpLine(char* readLine | |
413 | c_in_name, n_atoms, atomIndex ); | |
414 | return strdup( painCave.errMsg ); | |
415 | } | |
416 | < | vx = atof( foo ); |
416 | > | vel[0] = atof( foo ); |
417 | ||
418 | foo = strtok(NULL, " ,;\t"); | |
419 | if(foo == NULL){ | |
# | Line 415 | Line 423 | char* InitializeFromFile::parseDumpLine(char* readLine | |
423 | c_in_name, n_atoms, atomIndex ); | |
424 | return strdup( painCave.errMsg ); | |
425 | } | |
426 | < | vy = atof( foo ); |
426 | > | vel[1] = atof( foo ); |
427 | ||
428 | foo = strtok(NULL, " ,;\t"); | |
429 | if(foo == NULL){ | |
# | Line 425 | Line 433 | char* InitializeFromFile::parseDumpLine(char* readLine | |
433 | c_in_name, n_atoms, atomIndex ); | |
434 | return strdup( painCave.errMsg ); | |
435 | } | |
436 | < | vz = atof( foo ); |
436 | > | vel[2] = atof( foo ); |
437 | ||
438 | ||
439 | // get the quaternions | |
# | Line 527 | Line 535 | char* InitializeFromFile::parseDumpLine(char* readLine | |
535 | ||
536 | // add the positions and velocities to the atom | |
537 | ||
538 | < | atoms[atomIndex]->setX( rx ); |
539 | < | atoms[atomIndex]->setY( ry ); |
532 | < | atoms[atomIndex]->setZ( rz ); |
533 | < | |
534 | < | atoms[atomIndex]->set_vx( vx ); |
535 | < | atoms[atomIndex]->set_vy( vy ); |
536 | < | atoms[atomIndex]->set_vz( vz ); |
538 | > | atoms[atomIndex]->setPos( pos ); |
539 | > | atoms[atomIndex]->setVel( vel ); |
540 | ||
541 | return NULL; | |
542 | } | |
543 | ||
544 | ||
545 | < | char* InitializeFromFile::parseBoxLine(char* readLine, double boxMat[9]){ |
545 | > | char* InitializeFromFile::parseBoxLine(char* readLine, double boxMat[9], |
546 | > | double &time ){ |
547 | ||
548 | char *foo; // the pointer to the current string token | |
549 | int j; | |
# | Line 555 | Line 559 | char* InitializeFromFile::parseBoxLine(char* readLine, | |
559 | c_in_name ); | |
560 | return strdup( painCave.errMsg ); | |
561 | } | |
562 | < | simnfo->setTime( atof( foo ) ); |
562 | > | time = atof( foo ); |
563 | ||
564 | // get the Hx vector | |
565 |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |