Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

vtkAVSucdReader.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkAVSucdReader.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00038 #ifndef __vtkAVSucdReader_h
00039 #define __vtkAVSucdReader_h
00040 
00041 #include "vtkUnstructuredGridAlgorithm.h"
00042 
00043 class vtkIntArray;
00044 class vtkFloatArray;
00045 class vtkIdTypeArray;
00046 class vtkDataArraySelection;
00047 
00048 class VTK_IO_EXPORT vtkAVSucdReader : public vtkUnstructuredGridAlgorithm
00049 {
00050 public:
00051   static vtkAVSucdReader *New();
00052   vtkTypeRevisionMacro(vtkAVSucdReader,vtkUnstructuredGridAlgorithm);
00053   void PrintSelf(ostream& os, vtkIndent indent);
00054 
00056 
00057   vtkSetStringMacro(FileName);
00058   vtkGetStringMacro(FileName);
00060 
00062 
00064   vtkSetMacro(BinaryFile, int);
00065   vtkGetMacro(BinaryFile, int);
00066   vtkBooleanMacro(BinaryFile, int);
00068 
00070 
00071   vtkGetMacro(NumberOfCells,int);
00073 
00075 
00076   vtkGetMacro(NumberOfNodes,int);
00078 
00080 
00081   vtkGetMacro(NumberOfNodeFields,int);
00083 
00085 
00086   vtkGetMacro(NumberOfCellFields,int);
00088 
00090 
00092   vtkGetMacro(NumberOfFields,int);
00094 
00096 
00097   vtkGetMacro(NumberOfNodeComponents,int);
00098   vtkGetMacro(NumberOfCellComponents,int);
00100 
00102 
00103   void SetByteOrderToBigEndian();
00104   void SetByteOrderToLittleEndian();
00105   const char *GetByteOrderAsString();
00107 
00108   vtkSetMacro(ByteOrder, int);
00109   vtkGetMacro(ByteOrder, int);
00110 
00112 
00115   int GetNumberOfPointArrays();
00116   int GetNumberOfCellArrays();
00117   const char* GetPointArrayName(int index);
00118   const char* GetCellArrayName(int index);
00119   int GetPointArrayStatus(const char* name);
00120   int GetCellArrayStatus(const char* name);
00121   void SetPointArrayStatus(const char* name, int status);  
00122   void SetCellArrayStatus(const char* name, int status);
00124 
00125   void DisableAllCellArrays();
00126   void EnableAllCellArrays();
00127   void DisableAllPointArrays();
00128   void EnableAllPointArrays();
00129 
00130   // get min and max value for the index-th value of a cell component
00131   // index varies from 0 to (veclen - 1)
00132   void GetCellDataRange(int cellComp, int index, float *min, float *max);
00133 
00134   // get min and max value for the index-th value of a node component
00135   // index varies from 0 to (veclen - 1)
00136   void GetNodeDataRange(int nodeComp, int index, float *min, float *max);
00137 
00138 protected:
00139   vtkAVSucdReader();
00140   ~vtkAVSucdReader();
00141   int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00142   int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00143 
00144   char *FileName;
00145   int BinaryFile;
00146 
00147   int NumberOfNodes;
00148   int NumberOfCells;
00149   int NumberOfNodeFields;
00150   int NumberOfNodeComponents;
00151   int NumberOfCellComponents;
00152   int NumberOfCellFields;
00153   int NumberOfFields;
00154   int NlistNodes;
00155 
00156   ifstream *FileStream;
00157 
00158   vtkDataArraySelection* PointDataArraySelection;
00159   vtkDataArraySelection* CellDataArraySelection;
00160 
00161   int DecrementNodeIds;
00162   int ByteOrder;
00163   int GetLabel(char *string, int number, char *label);
00164   //BTX
00165   enum
00166   {
00167     FILE_BIG_ENDIAN=0,
00168     FILE_LITTLE_ENDIAN=1
00169   };
00170   enum UCDCell_type
00171   {
00172     PT    = 0,
00173     LINE  = 1,
00174     TRI   = 2,
00175     QUAD  = 3,
00176     TET   = 4,
00177     PYR   = 5,
00178     PRISM = 6,
00179     HEX   = 7
00180   };
00181 
00182   struct DataInfo {
00183     long foffset; // offset in binary file
00184     int  veclen;  // number of components in the node or cell variable
00185     float min[3]; // pre-calculated data minima (max size 3 for vectors)
00186     float max[3]; // pre-calculated data maxima (max size 3 for vectors)
00187   };
00188   //ETX
00189 
00190   DataInfo *NodeDataInfo;
00191   DataInfo *CellDataInfo;
00192 
00193 private:
00194   void ReadFile(vtkUnstructuredGrid *output);
00195   void ReadGeometry(vtkUnstructuredGrid *output);
00196   void ReadNodeData(vtkUnstructuredGrid *output);
00197   void ReadCellData(vtkUnstructuredGrid *output);
00198 
00199   int ReadFloatBlock(int n, float *block);
00200   int ReadIntBlock(int n, int *block);
00201   void ReadXYZCoords(vtkFloatArray *coords);
00202   void ReadBinaryCellTopology(vtkIntArray *material, int *types, 
00203                               vtkIdTypeArray *listcells);
00204   void ReadASCIICellTopology(vtkIntArray *material, vtkUnstructuredGrid *output);
00205 
00206   vtkAVSucdReader(const vtkAVSucdReader&);  // Not implemented.
00207   void operator=(const vtkAVSucdReader&);  // Not implemented.
00208 };
00209 
00210 #endif

Generated on Mon Jan 21 23:07:30 2008 for VTK by  doxygen 1.4.3-20050530