Common/vtkStructuredGrid.h Source File

Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# Common/vtkStructuredGrid.h

Go to the documentation of this file.

    00001 /*=========================================================================
    00002
    00003   Program:   Visualization Toolkit
    00004   Module:    $RCSfile: vtkStructuredGrid.h,v $
    00005   Language:  C++
    00006
    00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
    00008   All rights reserved.
    00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
    00010
    00011      This software is distributed WITHOUT ANY WARRANTY; without even
    00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    00013      PURPOSE.  See the above copyright notice for more information.
    00014
    00015 =========================================================================*/
    00064 #ifndef __vtkStructuredGrid_h
    00065 #define __vtkStructuredGrid_h
    00066
    00067 #include "vtkPointSet.h"
    00068
    00069 #include "vtkStructuredData.h" // Needed for inline methods
    00070 #include "vtkUnsignedCharArray.h" // Needed for inline methods
    00071
    00072 class vtkEmptyCell;
    00073 class vtkHexahedron;
    00074 class vtkLine;
    00075 class vtkQuad;
    00076 class vtkVertex;
    00077
    00078 class VTK_COMMON_EXPORT vtkStructuredGrid : public vtkPointSet
    00079 {
    00080 public:
    00081   static vtkStructuredGrid *New();
    00082
    00083   vtkTypeRevisionMacro(vtkStructuredGrid,vtkPointSet);
    00084   void PrintSelf(ostream& os, vtkIndent indent);
    00085
    00087   int GetDataObjectType() {return VTK_STRUCTURED_GRID;}
    00088
    00091   void CopyStructure(vtkDataSet *ds);
    00092
    00094
    00095   vtkIdType GetNumberOfPoints() {return vtkPointSet::GetNumberOfPoints();}
    00096   float *GetPoint(vtkIdType ptId) {return this->vtkPointSet::GetPoint(ptId);}
    00097   void GetPoint(vtkIdType ptId, float p[3])
    00098     {this->vtkPointSet::GetPoint(ptId,p);}
    00099   vtkCell *GetCell(vtkIdType cellId);
    00100   void GetCell(vtkIdType cellId, vtkGenericCell *cell);
    00101   void GetCellBounds(vtkIdType cellId, float bounds[6]);
    00102   int GetCellType(vtkIdType cellId);
    00103   vtkIdType GetNumberOfCells();
    00104   void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds);
    00105   void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)
    00106     {
    00107       vtkStructuredData::GetPointCells(ptId,cellIds,this->GetDimensions());
    00108     }
    00109   void Initialize();
    00110   int GetMaxCellSize() {return 8;}; //hexahedron is the largest
    00111   void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
    00112                         vtkIdList *cellIds);
    00113   virtual void GetScalarRange(float range[2]);
    00114   float *GetScalarRange() {return this->vtkPointSet::GetScalarRange();}
    00116
    00118
    00119   void SetDimensions(int i, int j, int k);
    00120   void SetDimensions(int dim[3]);
    00122
    00124
    00125   virtual int *GetDimensions ();
    00126   virtual void GetDimensions (int dim[3]);
    00128
    00130   int GetDataDimension();
    00131
    00133
    00135   void SetBlanking(int blanking);
    00136   int GetBlanking() {return this->Blanking;}
    00137   void BlankingOn();
    00138   void BlankingOff();
    00139   void BlankPoint(vtkIdType ptId);
    00140   void UnBlankPoint(vtkIdType ptId);
    00142
    00144
    00145   vtkUnsignedCharArray *GetPointVisibility()
    00146     {return this->PointVisibility;}
    00148
    00152   void SetPointVisibility(vtkUnsignedCharArray *pointVisibility);
    00153
    00155
    00157   unsigned char IsPointVisible(vtkIdType ptId)
    00158     {return (this->Blanking ? this->PointVisibility->GetValue(ptId) : 1);}
    00160
    00163   unsigned char IsCellVisible(vtkIdType cellId);
    00164
    00166
    00169   void SetUpdateExtent(int piece, int numPieces, int ghostLevel);
    00170   void SetUpdateExtent(int piece, int numPieces)
    00171     {this->SetUpdateExtent(piece, numPieces, 0);}
    00173
    00175
    00176   void SetUpdateExtent( int x1, int x2, int y1, int y2, int z1, int z2 )
    00177     { this->vtkPointSet::SetUpdateExtent( x1, x2, y1, y2, z1, z2 ); };
    00178   void SetUpdateExtent( int ext[6] )
    00179     { this->vtkPointSet::SetUpdateExtent( ext ); };
    00181
    00183
    00186   void SetExtent(int extent[6]);
    00187   void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
    00188   vtkGetVector6Macro(Extent,int);
    00190
    00196   unsigned long GetActualMemorySize();
    00197
    00199
    00200   void ShallowCopy(vtkDataObject *src);
    00201   void DeepCopy(vtkDataObject *src);
    00203
    00206   virtual void UpdateData();
    00207
    00208 protected:
    00209   vtkStructuredGrid();
    00210   ~vtkStructuredGrid();
    00211
    00212   // for the GetCell method
    00213   vtkVertex *Vertex;
    00214   vtkLine *Line;
    00215   vtkQuad *Quad;
    00216   vtkHexahedron *Hexahedron;
    00217   vtkEmptyCell *EmptyCell;
    00218
    00219   // The extent type is a 3D extent
    00220   int GetExtentType() { return VTK_3D_EXTENT; }
    00221
    00225   virtual void Crop();
    00226
    00227   int Dimensions[3];
    00228   int DataDescription;
    00229   int Blanking;
    00230   vtkUnsignedCharArray *PointVisibility;
    00231   void AllocatePointVisibility();
    00232
    00233 private:
    00235
    00236   void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds)
    00237     {this->GetCellNeighbors(cellId, &ptIds, &cellIds);}
    00239
    00240   // Internal method used by DeepCopy and ShallowCopy.
    00241   void InternalStructuredGridCopy(vtkStructuredGrid *src);
    00242
    00243 private:
    00244   vtkStructuredGrid(const vtkStructuredGrid&);  // Not implemented.
    00245   void operator=(const vtkStructuredGrid&);  // Not implemented.
    00246 };
    00247
    00248
    00249 inline vtkIdType vtkStructuredGrid::GetNumberOfCells()
    00250 {
    00251   int nCells=1;
    00252   int dims[3];
    00253   int i;
    00254
    00255   this->GetDimensions(dims);
    00256   for (i=0; i<3; i++)
    00257     {
    00258     if (dims[i] <= 0)
    00259       {
    00260       return 0;
    00261       }
    00262     if (dims[i] > 1)
    00263       {
    00264       nCells *= (dims[i]-1);
    00265       }
    00266     }
    00267
    00268   return nCells;
    00269 }
    00270
    00271 inline int vtkStructuredGrid::GetDataDimension()
    00272 {
    00273   return vtkStructuredData::GetDataDimension(this->DataDescription);
    00274 }
    00275
    00276 #endif
    00277
    00278
    00279
    00280
    00281
    00282