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

Comparing trunk/OOPSE/libmdtools/DumpReader.cpp (file contents):
Revision 829 by gezelter, Tue Oct 28 16:03:37 2003 UTC vs.
Revision 1078 by tim, Tue Mar 2 20:32:40 2004 UTC

# Line 1 | Line 1
1 + #define _LARGEFILE_SOURCE64
2   #define _FILE_OFFSET_BITS 64
3  
4   #include <sys/types.h>
# Line 33 | Line 34 | using namespace dumpRead;
34   using namespace dumpRead;
35  
36  
37 < DumpReader :: DumpReader( char *in_name ){
37 > DumpReader :: DumpReader(const char *in_name ){
38  
39    isScanned = false;
40    headFP = new FilePos;
# Line 226 | Line 227 | void DumpReader :: readSet( int whichFrame ){
227    
228    framePos = frameStart[whichFrame]->getPos();
229  
230 +  fsetpos(inFile, framePos);
231    
230
232  
233    eof_test = fgets(read_buffer, sizeof(read_buffer), inFile);
234    if( eof_test == NULL ){
# Line 316 | Line 317 | void DumpReader :: readSet( int whichFrame ){
317    
318    haveError = 0;
319    if (worldRank == 0) {
320 <
320 >    fsetpos(inFile, framePos);
321      eof_test = fgets(read_buffer, sizeof(read_buffer), inFile);
322      if( eof_test == NULL ){
323        sprintf( painCave.errMsg,
# Line 497 | Line 498 | char* DumpReader::parseDumpLine(char* readLine, int gl
498    // set the string tokenizer
499    
500    foo = strtok(readLine, " ,;\t");
501 <  
501 >  atoms[atomIndex]->setType(foo);
502    // check the atom name to the current atom
503    
504 <  if( strcmp( foo, atoms[atomIndex]->getType() ) ){
505 <    sprintf( painCave.errMsg,
506 <             "Initialize from file error. Atom %s at index %d "
507 <             "in file %s does not"
508 <             " match the BASS atom %s.\n",
509 <             foo, atomIndex, inName, atoms[atomIndex]->getType() );
510 <    return strdup( painCave.errMsg );
511 <  }
504 >  //if( strcmp( foo, atoms[atomIndex]->getType() ) ){
505 >  //  sprintf( painCave.errMsg,
506 >  //    "Initialize from file error. Atom %s at index %d "
507 >  //     "in file %s does not"
508 >  //     " match the BASS atom %s.\n",
509 >  //     foo, atomIndex, inName, atoms[atomIndex]->getType() );
510 >  //  return strdup( painCave.errMsg );
511 >  //}
512      
513    // get the positions
514  
# Line 686 | Line 687 | char* DumpReader::parseCommentLine(char* readLine, dou
687  
688    char *foo; // the pointer to the current string token
689    int j;
690 +  double chi, integralOfChidt;
691 +  double eta[9];
692  
693    // set the string tokenizer
694    
# Line 786 | Line 789 | char* DumpReader::parseCommentLine(char* readLine, dou
789    boxMat[8] = atof( foo );    
790  
791    return NULL;
792 +
793 +  //get chi and integralOfChidt, they should appear by pair
794 +  foo = strtok(NULL, " ,;\t\n");
795 +  if(foo != NULL){
796 +    chi = atof(foo);
797 +    
798 +    foo = strtok(NULL, " ,;\t\n");
799 +    if(foo == NULL){
800 +      sprintf( painCave.errMsg,
801 +               "chi and integralOfChidt should appear by pair in %s\n", inName );
802 +      return strdup( painCave.errMsg );
803 +    }
804 +    integralOfChidt = atof( foo );
805 +    
806 +    //push chi and integralOfChidt into SimInfo::properties which can be
807 +    //retrieved by integrator later
808 +    DoubleData* chiValue = new DoubleData();
809 +    chiValue->setID(CHIVALUE_ID);
810 +    chiValue->setData(chi);
811 +    simnfo->addProperty(chiValue);
812 +    
813 +    DoubleData* integralOfChidtValue = new DoubleData();
814 +    integralOfChidtValue->setID(INTEGRALOFCHIDT_ID);
815 +    integralOfChidtValue->setData(integralOfChidt);
816 +    simnfo->addProperty(integralOfChidtValue);
817 +    
818 +  }
819 +  else
820 +    return NULL;
821 +  
822 +  //get eta
823 +  for(int i = 0 ; i < 9; i++){
824 +    foo = strtok(NULL, " ,;\t");
825 +    if(foo == NULL){
826 +      sprintf( painCave.errMsg,
827 +               "error in reading eta[%d] from %s\n", i, inName );
828 +      return strdup( painCave.errMsg );
829 +    }
830 +    eta[i] = atof( foo );
831 +  }
832 +  
833 +  //push eta into SimInfo::properties which can be
834 +  //retrieved by integrator later
835 +  //simnfo->setBoxM( theBoxMat3 );
836 +  DoubleArrayData* etaValue = new DoubleArrayData();
837 +  etaValue->setID(ETAVALUE_ID);
838 +  etaValue->setData(eta, 9);
839 +  simnfo->addProperty(etaValue);
840 +  
841 +  
842 +  return NULL;
843 +  
844 +  
845 +
846   }
847  
848  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines