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

Method ReadFunctionHeader

IO/Parallel/vtkMultiBlockPLOT3DReader.cxx:3161–3201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3159}
3160
3161int vtkMultiBlockPLOT3DReader::ReadFunctionHeader(FILE* fp, int* nFunctions)
3162{
3163 int numGrid = this->GetNumberOfBlocksInternal(fp, 0);
3164 vtkDebugMacro("Function number of grids: " << numGrid);
3165 if (numGrid == 0)
3166 {
3167 return VTK_ERROR;
3168 }
3169
3170 // If the numbers of grids still do not match, the
3171 // function file is wrong
3172 if (numGrid != static_cast<int>(this->Internal->Blocks.size()))
3173 {
3174 vtkErrorMacro("The number of grids between the geometry "
3175 "and the function file do not match.");
3176 return VTK_ERROR;
3177 }
3178
3179 this->SkipByteCount(fp);
3180 for (int i = 0; i < numGrid; i++)
3181 {
3182 int n[3];
3183 n[2] = 1;
3184 this->ReadIntBlock(fp, this->Internal->Settings.NumberOfDimensions, n);
3185 vtkDebugMacro("Function, block " << i << " dimensions: " << n[0] << " " << n[1] << " " << n[2]);
3186
3187 int* dims = this->Internal->Dimensions[i].Values;
3188 int extent[6] = { 0, dims[0] - 1, 0, dims[1] - 1, 0, dims[2] - 1 };
3189 if (extent[1] != n[0] - 1 || extent[3] != n[1] - 1 || extent[5] != n[2] - 1)
3190 {
3191 this->SetErrorCode(vtkErrorCode::FileFormatError);
3192 vtkErrorMacro("Geometry and data dimensions do not match. "
3193 "Data file may be corrupt.");
3194 this->Internal->Blocks[i]->Initialize();
3195 return VTK_ERROR;
3196 }
3197 this->ReadIntBlock(fp, 1, nFunctions + i);
3198 }
3199 this->SkipByteCount(fp);
3200 return VTK_OK;
3201}
3202
3203void vtkMultiBlockPLOT3DReader::SetXYZFileName(const char* name)
3204{

Callers 1

ReadArraysMethod · 0.95

Calls 5

SkipByteCountMethod · 0.95
ReadIntBlockMethod · 0.95
sizeMethod · 0.45
InitializeMethod · 0.45

Tested by

no test coverage detected