VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkXdmfHeavyData.h 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 =========================================================================*/ 00015 // VTK-HeaderTest-Exclude: vtkXdmfHeavyData.h 00016 00017 #ifndef vtkXdmfHeavyData_h 00018 #define vtkXdmfHeavyData_h 00019 00020 #include "XdmfDataItem.h" 00021 #include "XdmfGrid.h" //won't compile without it 00022 #include "vtkIOXdmf2Module.h" // For export macro 00023 00024 class vtkAlgorithm; 00025 class vtkDataArray; 00026 class vtkDataObject; 00027 class vtkDataSet; 00028 class vtkImageData; 00029 class vtkMultiBlockDataSet; 00030 class vtkPoints; 00031 class vtkRectilinearGrid; 00032 class vtkStructuredGrid; 00033 class vtkUnstructuredGrid; 00034 class vtkXdmfDomain; 00035 00036 // vtkXdmfHeavyData helps in reading heavy data from Xdmf and putting that into 00037 // vtkDataObject subclasses. 00038 class VTKIOXDMF2_EXPORT vtkXdmfHeavyData 00039 { 00040 vtkXdmfDomain* Domain; 00041 xdmf2::XdmfDataItem DataItem; 00042 vtkAlgorithm* Reader; 00043 public: 00044 // These must be set before using this class. 00045 int Piece; 00046 int NumberOfPieces; 00047 int GhostLevels; 00048 int Extents[6]; // < these are original extents without the stride taken in 00049 // consideration 00050 int Stride[3]; 00051 XdmfFloat64 Time; 00052 00053 public: 00054 vtkXdmfHeavyData(vtkXdmfDomain* domain, vtkAlgorithm* reader); 00055 ~vtkXdmfHeavyData(); 00056 00057 // Description: 00058 vtkDataObject* ReadData(xdmf2::XdmfGrid* xmfGrid); 00059 00060 // Description: 00061 vtkDataObject* ReadData(); 00062 00063 // Description: 00064 // Returns the VTKCellType for the given xdmf topology. Returns VTK_EMPTY_CELL 00065 // on error and VTK_NUMBER_OF_CELL_TYPES for XDMF_MIXED. 00066 static int GetVTKCellType(XdmfInt32 topologyType); 00067 00068 // Description: 00069 // Returns the number of points per cell. -1 for error. 0 when no fixed number 00070 // of points possible. 00071 static int GetNumberOfPointsPerCell(int vtk_cell_type); 00072 00073 private: 00074 // Description: 00075 // Read a temporal collection. 00076 vtkDataObject* ReadTemporalCollection(xdmf2::XdmfGrid* xmfTemporalCollection); 00077 00078 // Description: 00079 // Read a spatial-collection or a tree. 00080 vtkDataObject* ReadComposite(xdmf2::XdmfGrid* xmfColOrTree); 00081 00082 // Description: 00083 // Read a non-composite grid. Note here uniform has nothing to do with 00084 // vtkUniformGrid but to what Xdmf's GridType="Uniform". 00085 vtkDataObject* ReadUniformData(xdmf2::XdmfGrid* xmfGrid); 00086 00087 // Description: 00088 // Reads the topology and geometry for an unstructured grid. Does not read any 00089 // data attributes or geometry. 00090 vtkDataObject* ReadUnstructuredGrid(xdmf2::XdmfGrid* xmfGrid); 00091 00092 // Description: 00093 // Read the image data. Simply initializes the extents and origin and spacing 00094 // for the image, doesn't really read any attributes including the active 00095 // point attributes. 00096 vtkImageData* RequestImageData(xdmf2::XdmfGrid* xmfGrid, bool use_uniform_grid); 00097 00098 // Description: 00099 // Reads the geometry and topology for a vtkStructuredGrid. 00100 vtkStructuredGrid* RequestStructuredGrid(xdmf2::XdmfGrid* xmfGrid); 00101 00102 // Description: 00103 // Reads the geometry and topology for a vtkRectilinearGrid. 00104 vtkRectilinearGrid* RequestRectilinearGrid(xdmf2::XdmfGrid* xmfGrid); 00105 00106 // Description: 00107 // Reads geometry for vtkUnstructuredGrid or vtkStructuredGrid i.e. of 00108 // vtkPointSet subclasses. The extents only make sense when reading 00109 // vtkStructuredGrid. If non-null, then the only the points for the sub-grid 00110 // are read. 00111 vtkPoints* ReadPoints(xdmf2::XdmfGeometry* xmfGeometry, 00112 int *update_extents=NULL, 00113 int *whole_extents=NULL); 00114 00115 // Description: 00116 // Read attributes. 00117 bool ReadAttributes(vtkDataSet* dataSet, xdmf2::XdmfGrid* xmfGrid, 00118 int* update_extents=0); 00119 00120 // Description: 00121 // Reads an attribute. 00122 // If update_extents are non-null, then we are reading structured attributes 00123 // and we read only the sub-set specified by update_extents. 00124 vtkDataArray* ReadAttribute(xdmf2::XdmfAttribute* xmfAttribute, 00125 int data_dimensionality, int* update_extents=0); 00126 00127 // Description: 00128 // Read sets that mark ghost cells/nodes and then create attribute arrays for 00129 // marking the cells as such. 00130 bool ReadGhostSets(vtkDataSet* ds, xdmf2::XdmfGrid* xmfGrid, 00131 int* update_extents=0); 00132 00133 vtkMultiBlockDataSet* ReadSets(vtkDataSet* dataSet, xdmf2::XdmfGrid* xmfGrid, 00134 int *update_extents=0); 00135 00136 // Description: 00137 // Used when reading node-sets. 00138 // Creates a new dataset with points with given ids extracted from the input 00139 // dataset. 00140 vtkDataSet* ExtractPoints(xdmf2::XdmfSet* xmfSet, vtkDataSet* dataSet); 00141 00142 // Description: 00143 // Used when reading cell-sets. 00144 // Creates a new dataset with cells with the given ids extracted from the 00145 // input dataset. 00146 vtkDataSet* ExtractCells(xdmf2::XdmfSet* xmfSet, vtkDataSet* dataSet); 00147 00148 // Description: 00149 // Used when reading face-sets. 00150 // Creates a new dataset with faces selected by the set, extracting them from 00151 // the input dataset. 00152 vtkDataSet* ExtractFaces(xdmf2::XdmfSet* xmfSet, vtkDataSet* dataSet); 00153 00154 // Description: 00155 // Used when reading edge-sets. 00156 // Creates a new dataset with egdes selected by the set, extracting them from 00157 // the input dataset. 00158 vtkDataSet* ExtractEdges(xdmf2::XdmfSet* xmfSet, vtkDataSet* dataSet); 00159 00160 }; 00161 00162 #endif