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

Method CanReadBinaryFile

IO/Parallel/vtkMultiBlockPLOT3DReader.cxx:3017–3048  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3015}
3016
3017int vtkMultiBlockPLOT3DReader::CanReadBinaryFile(const char* fname)
3018{
3019 FILE* xyzFp;
3020
3021 if (!fname || fname[0] == '\0')
3022 {
3023 return 0;
3024 }
3025
3026 if (this->CheckFile(xyzFp, fname) != VTK_OK)
3027 {
3028 return 0;
3029 }
3030
3031 this->CalculateFileSize(xyzFp);
3032
3033 if (!this->AutoDetectionCheck(xyzFp))
3034 {
3035 fclose(xyzFp);
3036 return 0;
3037 }
3038 clearerr(xyzFp); // clear error and EOF flags
3039 fseek(xyzFp, 0, SEEK_SET); // move to beginning
3040
3041 int numBlocks = this->GetNumberOfBlocksInternal(xyzFp, 0);
3042 fclose(xyzFp);
3043 if (numBlocks != 0)
3044 {
3045 return 1;
3046 }
3047 return 0;
3048}
3049
3050// Read the header and return the number of grids.
3051int vtkMultiBlockPLOT3DReader::GetNumberOfBlocksInternal(FILE* xyzFp, int vtkNotUsed(allocate))

Callers

nothing calls this directly

Calls 4

CheckFileMethod · 0.95
CalculateFileSizeMethod · 0.95
AutoDetectionCheckMethod · 0.95

Tested by

no test coverage detected