VTK
vtkMultiBlockPLOT3DReaderInternals.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkMultiBlockPLOT3DReaderInternals.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 #ifndef vtkMultiBlockPLOT3DReaderInternals_h
16 #define vtkMultiBlockPLOT3DReaderInternals_h
17 
18 #include "vtkByteSwap.h"
20 #include "vtkSmartPointer.h"
21 #include "vtkStructuredGrid.h"
22 
23 #include <vector>
24 
26 {
27  struct Dims
28  {
29 
30  Dims()
31  {
32  memset(this->Values, 0, 3*sizeof(int));
33  }
34 
35  int Values[3];
36  };
37 
38  std::vector<Dims> Dimensions;
39  std::vector<vtkSmartPointer<vtkStructuredGrid> > Blocks;
40 
42  {
44  int ByteOrder;
46  int MultiGrid;
48  int Precision; // in bytes
49  int IBlanking;
51  BinaryFile(1),
52  ByteOrder(vtkMultiBlockPLOT3DReader::FILE_BIG_ENDIAN),
53  HasByteCount(1),
54  MultiGrid(0),
55  NumberOfDimensions(3),
56  Precision(4),
57  IBlanking(0)
58  {
59  }
60  };
61 
64 
66  NeedToCheckXYZFile(true)
67  {
68  }
69 
70  int ReadInts(FILE* fp, int n, int* val);
71  void CheckBinaryFile(FILE *fp, size_t fileSize);
72  int CheckByteOrder(FILE* fp);
73  int CheckByteCount(FILE* fp);
74  int CheckMultiGrid(FILE* fp);
75  int Check2DGeom(FILE* fp);
76  int CheckBlankingAndPrecision(FILE* fp);
77  int CheckCFile(FILE* fp, size_t fileSize);
78  size_t CalculateFileSize(int mgrid,
79  int precision, // in bytes
80  int blanking,
81  int ndims,
82  int hasByteCount,
83  int nGrids,
84  int* gridDims);
85  size_t CalculateFileSizeForBlock(int precision, // in bytes
86  int blanking,
87  int ndims,
88  int hasByteCount,
89  int* gridDims);
90 };
91 #endif
92 // VTK-HeaderTest-Exclude: vtkMultiBlockPLOT3DReaderInternals.h
int ReadInts(FILE *fp, int n, int *val)
size_t CalculateFileSize(int mgrid, int precision, int blanking, int ndims, int hasByteCount, int nGrids, int *gridDims)
size_t CalculateFileSizeForBlock(int precision, int blanking, int ndims, int hasByteCount, int *gridDims)
std::vector< vtkSmartPointer< vtkStructuredGrid > > Blocks
void CheckBinaryFile(FILE *fp, size_t fileSize)
int CheckCFile(FILE *fp, size_t fileSize)