MCPcopy Create free account
hub / github.com/Kitware/VTK / CheckBlankingAndPrecision

Method CheckBlankingAndPrecision

IO/Parallel/vtkMultiBlockPLOT3DReaderInternals.cxx:185–244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183}
184
185int vtkMultiBlockPLOT3DReaderInternals::CheckBlankingAndPrecision(FILE* fp)
186{
187 int recMarkBeg, recMarkEnd, numGrids = 1, nMax, totPts;
188
189 clearerr(fp); // clear error and EOF flags
190 fseek(fp, 0, SEEK_SET); // move to beginning
191 if (this->Settings.MultiGrid)
192 {
193 if (!this->ReadInts(fp, 1, &recMarkBeg) || !this->ReadInts(fp, 1, &numGrids) ||
194 !this->ReadInts(fp, 1, &recMarkEnd))
195 {
196 return 0;
197 }
198 }
199 if (!this->ReadInts(fp, 1, &recMarkBeg))
200 {
201 return 0;
202 }
203 nMax = this->Settings.NumberOfDimensions * numGrids;
204 std::vector<int> jmax(numGrids * 3); // allocate memory for jmax
205 if (!this->ReadInts(fp, nMax, jmax.data()) || !this->ReadInts(fp, 1, &recMarkEnd))
206 {
207 return 0;
208 }
209 totPts = 1;
210 for (int i = 0; i < this->Settings.NumberOfDimensions; i++)
211 {
212 totPts *= jmax[i];
213 }
214 this->ReadInts(fp, 1, &recMarkBeg);
215 // single precision, with iblanking
216 if (recMarkBeg == totPts * (this->Settings.NumberOfDimensions * 4 + 4))
217 {
218 this->Settings.Precision = 4;
219 this->Settings.IBlanking = 1;
220 return 1;
221 }
222 // double precision, with iblanking
223 else if (recMarkBeg == totPts * (this->Settings.NumberOfDimensions * 8 + 4))
224 {
225 this->Settings.Precision = 8;
226 this->Settings.IBlanking = 1;
227 return 1;
228 }
229 // single precision, no iblanking
230 else if (recMarkBeg == totPts * this->Settings.NumberOfDimensions * 4)
231 {
232 this->Settings.Precision = 4;
233 this->Settings.IBlanking = 0;
234 return 1;
235 }
236 // double precision, no iblanking
237 else if (recMarkBeg == totPts * this->Settings.NumberOfDimensions * 8)
238 {
239 this->Settings.Precision = 8;
240 this->Settings.IBlanking = 0;
241 return 1;
242 }

Callers 1

AutoDetectionCheckMethod · 0.80

Calls 2

ReadIntsMethod · 0.95
dataMethod · 0.45

Tested by

no test coverage detected