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   
00008 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00009 All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without
00012 modification, are permitted provided that the following conditions are met:
00013 
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016 
00017  * Redistributions in binary form must reproduce the above copyright notice,
00018    this list of conditions and the following disclaimer in the documentation
00019    and/or other materials provided with the distribution.
00020 
00021  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00022    of any contributors may be used to endorse or promote products derived
00023    from this software without specific prior written permission.
00024 
00025  * Modified source versions must be plainly marked as such, and must not be
00026    misrepresented as being the original software.
00027 
00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00029 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00030 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00031 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00032 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00033 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00034 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00035 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00036 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00037 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00038 
00039 =========================================================================*/
00065 #ifndef __vtkStructuredGrid_h
00066 #define __vtkStructuredGrid_h
00067 
00068 #include "vtkPointSet.h"
00069 #include "vtkStructuredData.h"
00070 #include "vtkUnsignedCharArray.h"
00071 
00072 class vtkVertex;
00073 class vtkLine;
00074 class vtkQuad;
00075 class vtkHexahedron;
00076 class vtkEmptyCell;
00077 
00078 class VTK_COMMON_EXPORT vtkStructuredGrid : public vtkPointSet 
00079 {
00080 public:
00081   static vtkStructuredGrid *New();
00082 
00083   vtkTypeMacro(vtkStructuredGrid,vtkPointSet);
00084   void PrintSelf(ostream& os, vtkIndent indent);
00085  
00087   int GetDataObjectType() {return VTK_STRUCTURED_GRID;}
00088 
00090   vtkDataObject *MakeObject() {return vtkStructuredGrid::New();}
00091 
00094   void CopyStructure(vtkDataSet *ds);
00095 
00097 
00098   vtkIdType GetNumberOfPoints() {return vtkPointSet::GetNumberOfPoints();}
00099   float *GetPoint(vtkIdType ptId) {return this->vtkPointSet::GetPoint(ptId);}
00100   void GetPoint(vtkIdType ptId, float p[3])
00101     {this->vtkPointSet::GetPoint(ptId,p);}
00102   vtkCell *GetCell(vtkIdType cellId);
00103   void GetCell(vtkIdType cellId, vtkGenericCell *cell);
00104   void GetCellBounds(vtkIdType cellId, float bounds[6]);
00105   int GetCellType(vtkIdType cellId);
00106   vtkIdType GetNumberOfCells();
00107   void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds);
00108   void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)
00109     {
00110       vtkStructuredData::GetPointCells(ptId,cellIds,this->GetDimensions());
00111     }
00112   void Initialize();
00113   int GetMaxCellSize() {return 8;}; //hexahedron is the largest
00114   void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
00115                         vtkIdList *cellIds);
00116   virtual void GetScalarRange(float range[2]);
00117   float *GetScalarRange() {return this->vtkPointSet::GetScalarRange();}
00119 
00121 
00122   void SetDimensions(int i, int j, int k);
00123   void SetDimensions(int dim[3]);
00125 
00127 
00128   virtual int *GetDimensions ();
00129   virtual void GetDimensions (int dim[3]);
00131 
00133   int GetDataDimension();
00134 
00136 
00138   void SetBlanking(int blanking);
00139   int GetBlanking() {return this->Blanking;}
00140   void BlankingOn();
00141   void BlankingOff();
00142   void BlankPoint(vtkIdType ptId);
00143   void UnBlankPoint(vtkIdType ptId);
00145   
00147 
00148   vtkUnsignedCharArray *GetPointVisibility() 
00149     {return this->PointVisibility;}
00151 
00155   void SetPointVisibility(vtkUnsignedCharArray *pointVisibility);
00156 
00158 
00160   unsigned char IsPointVisible(vtkIdType ptId)
00161     {return (this->Blanking ? this->PointVisibility->GetValue(ptId) : 1);}
00163   
00166   unsigned char IsCellVisible(vtkIdType cellId);
00167   
00169 
00172   void SetUpdateExtent(int piece, int numPieces, int ghostLevel);
00173   void SetUpdateExtent(int piece, int numPieces)
00174     {this->SetUpdateExtent(piece, numPieces, 0);}
00176 
00178 
00179   void SetUpdateExtent( int x1, int x2, int y1, int y2, int z1, int z2 )
00180     { this->vtkPointSet::SetUpdateExtent( x1, x2, y1, y2, z1, z2 ); };
00181   void SetUpdateExtent( int ext[6] )
00182     { this->vtkPointSet::SetUpdateExtent( ext ); };
00184 
00186 
00189   void SetExtent(int extent[6]);
00190   void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
00191   vtkGetVector6Macro(Extent,int);
00193 
00199   unsigned long GetActualMemorySize();
00200 
00202 
00203   void ShallowCopy(vtkDataObject *src);  
00204   void DeepCopy(vtkDataObject *src);
00206 
00207 protected:
00208   vtkStructuredGrid();
00209   ~vtkStructuredGrid();
00210 
00211   // for the GetCell method
00212   vtkVertex *Vertex;
00213   vtkLine *Line;
00214   vtkQuad *Quad;  
00215   vtkHexahedron *Hexahedron;
00216   vtkEmptyCell *EmptyCell;
00217 
00218   // The extent type is a 3D extent
00219   int GetExtentType() { return VTK_3D_EXTENT; }
00220   
00224   virtual void Crop();
00225 
00226   int Dimensions[3];
00227   int DataDescription;
00228   int Blanking;
00229   vtkUnsignedCharArray *PointVisibility;
00230   void AllocatePointVisibility();
00231 
00232 private:
00234 
00235   void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds)
00236     {this->GetCellNeighbors(cellId, &ptIds, &cellIds);}
00238 
00239   // Internal method used by DeepCopy and ShallowCopy.
00240   void InternalStructuredGridCopy(vtkStructuredGrid *src);
00241 
00242 private:
00243   vtkStructuredGrid(const vtkStructuredGrid&);  // Not implemented.
00244   void operator=(const vtkStructuredGrid&);  // Not implemented.
00245 };
00246 
00247 
00248 inline vtkIdType vtkStructuredGrid::GetNumberOfCells() 
00249 {
00250   int nCells=1;
00251   int dims[3];
00252   int i;
00253 
00254   this->GetDimensions(dims);
00255   for (i=0; i<3; i++)
00256     {
00257     if (dims[i] <= 0)
00258       {
00259       return 0;
00260       }
00261     if (dims[i] > 1)
00262       {
00263       nCells *= (dims[i]-1);
00264       }
00265     }
00266 
00267   return nCells;
00268 }
00269 
00270 inline int vtkStructuredGrid::GetDataDimension()
00271 {
00272   return vtkStructuredData::GetDataDimension(this->DataDescription);
00273 }
00274 
00275 #endif
00276 
00277 
00278 
00279 
00280 
00281 

Generated on Thu Mar 28 14:19:17 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001