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

Comparing trunk/OOPSE/libmdtools/ZConsReader.cpp (file contents):
Revision 1074 by tim, Mon Mar 1 20:01:50 2004 UTC vs.
Revision 1108 by tim, Wed Apr 14 15:37:41 2004 UTC

# Line 118 | Line 118 | void ZConsReader::readHeader(){
118      zconsPos.push_back(zmolPos);
119    }
120  
121 +  curZPos.resize(nZMol);
122 +  curFZ.resize(nZMol);
123   }
124  
125   void ZConsReader::readNextFrame(){
126    const int MAXBUFFERSIZE = 2000;
127    char line[MAXBUFFERSIZE];  
128    int tempNZMol;
127  int zmolIndex;
128  float zmolPos;
129  float zmolForce;
129    int sscanfCount;
130 <
130 >  int tempIndex;
131 >  float tempCurTime;
132 >  float tempFZ;
133 >  float tempCurZPos;
134 >  float tempZconsPos;
135 >  
136    istream->getline(line, MAXBUFFERSIZE);
137 <  sscanfCount = sscanf(line, "%f", curTime);
137 >  sscanfCount = sscanf(line, "%f", &tempCurTime);
138    if (sscanfCount != 1){
139      cerr << "ZConsReader Error : reading file error" << endl;
140      exit(1);
141    }
142 +  curTime = tempCurTime;
143    
144    istream->getline(line, MAXBUFFERSIZE);
145    sscanfCount = sscanf(line, "%d", &tempNZMol);
# Line 150 | Line 155 | void ZConsReader::readNextFrame(){
155  
156    for(int i = 0; i < nZMol; i++){
157      istream->getline(line, MAXBUFFERSIZE);
158 <    sscanfCount = sscanf(line, "%d\t%f\t%f", &zmolIndex, &zmolForce, &zmolPos);
159 <    if (sscanfCount != 3){
158 >    sscanfCount = sscanf(line, "%d\t%f\t%f\t%f", &tempIndex, &tempFZ, &tempCurZPos,&tempZconsPos);
159 >    if (sscanfCount != 4){
160        cerr << "ZConsReader Error : reading file error" << endl;
161        exit(1);
162      }
163 +
164 +    index[i] = tempIndex;
165 +    curFZ[i] = tempFZ;
166 +    curZPos[i]= tempCurZPos;
167 +    zconsPos[i] = tempZconsPos;
168    }
169  
170   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines