ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-4/src/io/DumpReader.cpp
(Generate patch)

Comparing branches/new_design/OOPSE-4/src/io/DumpReader.cpp (file contents):
Revision 1807 by tim, Wed Nov 24 22:12:12 2004 UTC vs.
Revision 1808 by tim, Tue Nov 30 23:14:29 2004 UTC

# Line 12 | Line 12
12   #include <string.h>
13  
14   #include "io/DumpReader.hpp"
15 + #include "primitives/Molecule.hpp"
16   #include "utils/simError.h"
17   #include "utils/MemoryUtils.hpp"
18 + #include "utils/StringTokenizer.hpp"
19 +
20   #ifdef IS_MPI
21  
22   #include <mpi.h>
# Line 184 | Line 187 | void DumpReader::readSet(int whichFrame) {
187  
188    Molecule* mol;
189    StuntDouble* integrableObject;
190 <  typename SimInfo::MoleculeIterator mi;
191 <  typename Molecule::IntegrableObjectIterator ii;
190 >  SimInfo::MoleculeIterator mi;
191 >  Molecule::IntegrableObjectIterator ii;
192  
193   #ifndef IS_MPI
194  
# Line 225 | Line 228 | void DumpReader::readSet(int whichFrame) {
228          simError();
229      }
230  
231 <    parseCommentLine(read_buffer, info_->getSnapshotManager()->getCurrentSnapshot(), info_->useInitState());
231 >    parseCommentLine(read_buffer, info_->getSnapshotManager()->getCurrentSnapshot());
232  
233      //parse dump lines
234  
235      for (mol = info_->beginMolecule(mi); mol != NULL; mol = info_->nextMolecule(mi)) {
236  
237 <        for (integrableObject = mol->beginIntegrableObject(i); integrableObject != NULL;
238 <            integrableObject = mol->nextIntegrableObject(i)) {          
237 >        for (integrableObject = mol->beginIntegrableObject(ii); integrableObject != NULL;
238 >            integrableObject = mol->nextIntegrableObject(ii)) {          
239  
240              eof_test = fgets(read_buffer, sizeof(read_buffer), inFile_);
241  
# Line 249 | Line 252 | void DumpReader::readSet(int whichFrame) {
252                  simError();
253              }
254  
255 <            parseDumpLine(read_buffer, integrableObjects[j]);
255 >            parseDumpLine(read_buffer, integrableObject);
256              
257 <        }
257 >            }
258      }
259  
260      // MPI Section of code..........
# Line 319 | Line 322 | void DumpReader::readSet(int whichFrame) {
322          //parseCommentLine
323  
324          MPI_Bcast(read_buffer, maxBufferSize, MPI_CHAR, masterNode, MPI_COMM_WORLD);
325 <        parseCommentLine(read_buffer, info_->getSnapshotManager()->getCurrentSnapshot(), info_->useInitState());
325 >        parseCommentLine(read_buffer, info_->getSnapshotManager()->getCurrentSnapshot());
326  
327          for(i = 0; i < info_->getNGlobalMolecules(); i++) {
328              which_node = info_->getMolToProc(i);
# Line 387 | Line 390 | void DumpReader::readSet(int whichFrame) {
390          MPI_Bcast(read_buffer, maxBufferSize, MPI_CHAR, masterNode, MPI_COMM_WORLD);
391  
392          /**@todo*/
393 <        parseCommentLine(read_buffer, info_->getSnapshotManager()->getCurrentSnapshot(), info_->useInitState());
393 >        parseCommentLine(read_buffer, info_->getSnapshotManager()->getCurrentSnapshot());
394  
395          for(i = 0; i < info_->getNGlobalMolecules(); i++) {
396              which_node = info_->getMolToProc(i);
# Line 437 | Line 440 | void DumpReader::parseDumpLine(char *line, StuntDouble
440      
441      nTokens = tokenizer.countTokens();
442  
443 <    if (nTokens < ) {
444 <
445 <
443 >    if (nTokens < 14) {
444 >            sprintf(painCave.errMsg,
445 >                    "Not enough Tokens.\n");
446 >            painCave.isFatal = 1;
447 >            simError();
448      }
449  
450      std::string name = tokenizer.nextToken();
# Line 459 | Line 464 | void DumpReader::parseDumpLine(char *line, StuntDouble
464      integrableObject->setVel(vel);
465  
466      if (integrableObject->isDirectional()) {
467 +        
468          q[0] = tokenizer.nextTokenAsFloat();
469          q[1] = tokenizer.nextTokenAsFloat();
470          q[2] = tokenizer.nextTokenAsFloat();
# Line 491 | Line 497 | char *DumpReader::parseCommentLine(char* line, Snapsho
497   }
498  
499  
500 < char *DumpReader::parseCommentLine(char* line, Snapshot* s, bool useInitXSstate) {
500 > void DumpReader::parseCommentLine(char* line, Snapshot* s) {
501      double currTime;
502      Mat3x3d hmat;
503      double chi;
# Line 513 | Line 519 | char *DumpReader::parseCommentLine(char* line, Snapsho
519  
520      //read current time
521      currTime = tokenizer.nextTokenAsFloat();
522 <    if (useInitXSstate) {
517 <        s->setTime(currTime);
518 <    }
522 >    s->setTime(currTime);
523      
524      //read h-matrix
525      hmat(0, 0) = tokenizer.nextTokenAsFloat();
# Line 529 | Line 533 | char *DumpReader::parseCommentLine(char* line, Snapsho
533      hmat(2, 2) = tokenizer.nextTokenAsFloat();
534      s->setHmat(hmat);
535      
536 <    if (useInitXSstate) {
537 <        //read chi and integrablOfChidt, they should apprear in pair
538 <        if (tokenizer.countTokens() >= 2) {
539 <            chi = tokenizer.nextTokenAsFloat();
536 <            integralOfChiDt = tokenizer.nextTokenAsFloat();            
536 >    //read chi and integrablOfChidt, they should apprear in pair
537 >    if (tokenizer.countTokens() >= 2) {
538 >        chi = tokenizer.nextTokenAsFloat();
539 >        integralOfChiDt = tokenizer.nextTokenAsFloat();            
540  
541 <            s->setChi(chi);
542 <            s->setIntegralOfChiDt(integralOfChiDt);
543 <        }
544 <        
545 <        //read eta (eta is 3x3 matrix)
546 <        if (tokenizer.countTokens() >= 9) {
547 <            eta(0, 0) = tokenizer.nextTokenAsFloat();
548 <            eta(0, 1) = tokenizer.nextTokenAsFloat();
549 <            eta(0, 2) = tokenizer.nextTokenAsFloat();
550 <            eta(1, 0) = tokenizer.nextTokenAsFloat();
551 <            eta(1, 1) = tokenizer.nextTokenAsFloat();
552 <            eta(1, 2) = tokenizer.nextTokenAsFloat();
553 <            eta(2, 0) = tokenizer.nextTokenAsFloat();
554 <            eta(2, 1) = tokenizer.nextTokenAsFloat();
555 <            eta(2, 2) = tokenizer.nextTokenAsFloat();      
541 >        s->setChi(chi);
542 >        s->setIntegralOfChiDt(integralOfChiDt);
543 >    }
544 >    
545 >    //read eta (eta is 3x3 matrix)
546 >    if (tokenizer.countTokens() >= 9) {
547 >        eta(0, 0) = tokenizer.nextTokenAsFloat();
548 >        eta(0, 1) = tokenizer.nextTokenAsFloat();
549 >        eta(0, 2) = tokenizer.nextTokenAsFloat();
550 >        eta(1, 0) = tokenizer.nextTokenAsFloat();
551 >        eta(1, 1) = tokenizer.nextTokenAsFloat();
552 >        eta(1, 2) = tokenizer.nextTokenAsFloat();
553 >        eta(2, 0) = tokenizer.nextTokenAsFloat();
554 >        eta(2, 1) = tokenizer.nextTokenAsFloat();
555 >        eta(2, 2) = tokenizer.nextTokenAsFloat();      
556  
557 <            s->setEta(eta);
555 <        }
557 >        s->setEta(eta);
558      }
559  
560      

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines