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); |
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 |
|
} |