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 =========================================================================*/
00057 #ifndef __vtkStructuredGrid_h
00058 #define __vtkStructuredGrid_h
00059 
00060 #include "vtkPointSet.h"
00061 #include "vtkStructuredData.h"
00062 class vtkVertex;
00063 class vtkLine;
00064 class vtkQuad;
00065 class vtkHexahedron;
00066 
00067 
00068 class VTK_EXPORT vtkStructuredGrid : public vtkPointSet {
00069 public:
00070   static vtkStructuredGrid *New();
00071 
00072   vtkTypeMacro(vtkStructuredGrid,vtkPointSet);
00073   void PrintSelf(ostream& os, vtkIndent indent);
00074  
00076   int GetDataObjectType() {return VTK_STRUCTURED_GRID;};
00077 
00079   vtkDataObject *MakeObject() {return vtkStructuredGrid::New();};
00080 
00083   void CopyStructure(vtkDataSet *ds);
00084 
00086   int GetNumberOfPoints() {return vtkPointSet::GetNumberOfPoints();};
00087   float *GetPoint(int ptId) {return this->vtkPointSet::GetPoint(ptId);};
00088   void GetPoint(int ptId, float p[3]) {this->vtkPointSet::GetPoint(ptId,p);};
00089   vtkCell *GetCell(int cellId);
00090   void GetCell(int cellId, vtkGenericCell *cell);
00091   void GetCellBounds(int cellId, float bounds[6]);
00092   int GetCellType(int cellId);
00093   int GetNumberOfCells();
00094   void GetCellPoints(int cellId, vtkIdList *ptIds);
00095   void GetPointCells(int ptId, vtkIdList *cellIds)
00096     {vtkStructuredData::GetPointCells(ptId,cellIds,this->Dimensions);}
00097   void Initialize();
00098   int GetMaxCellSize() {return 8;}; //hexahedron is the largest
00099   void GetCellNeighbors(int cellId, vtkIdList *ptIds, vtkIdList *cellIds);
00100 
00102   void SetDimensions(int i, int j, int k);
00103   void SetDimensions(int dim[3]);
00104 
00106   vtkGetVectorMacro(Dimensions,int,3);
00107 
00109   int GetDataDimension();
00110 
00112   void BlankingOn();
00113   void BlankingOff();
00114   int GetBlanking() {return this->Blanking;};
00115   void BlankPoint(int ptId);
00116   void UnBlankPoint(int ptId);
00117   
00119   int IsPointVisible(int ptId);
00120 
00124   void SetUpdateExtent(int piece, int numPieces, int ghostLevel);
00125   void SetUpdateExtent(int piece, int numPieces)
00126     {this->SetUpdateExtent(piece, numPieces, 0);}
00127 
00129   void SetUpdateExtent( int x1, int x2, int y1, int y2, int z1, int z2 )
00130     { this->vtkPointSet::SetUpdateExtent( x1, x2, y1, y2, z1, z2 ); };
00131   void SetUpdateExtent( int ext[6] )
00132     { this->vtkPointSet::SetUpdateExtent( ext ); };
00133 
00137   void SetExtent(int extent[6]);
00138   void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
00139   vtkGetVector6Macro(Extent,int);
00140 
00146   unsigned long GetActualMemorySize();
00147 
00149   void ShallowCopy(vtkDataObject *src);  
00150   void DeepCopy(vtkDataObject *src);
00151 
00152 #ifndef VTK_REMOVE_LEGACY_CODE
00153 
00154   void GetCellPoints(int cellId, vtkIdList &ptIds)
00155     {VTK_LEGACY_METHOD(GetCellPoints,"3.2"); this->GetCellPoints(cellId, &ptIds);}
00156   void GetPointCells(int ptId, vtkIdList &cellIds)
00157     {VTK_LEGACY_METHOD(GetPointCells,"3.2"); this->GetPointCells(ptId, &cellIds);}
00158 #endif
00159   
00160 protected:
00161   vtkStructuredGrid();
00162   ~vtkStructuredGrid();
00163   vtkStructuredGrid(const vtkStructuredGrid&) {};
00164   void operator=(const vtkStructuredGrid&) {};
00165 
00166   // for the GetCell method
00167   vtkVertex *Vertex;
00168   vtkLine *Line;
00169   vtkQuad *Quad;  
00170   vtkHexahedron *Hexahedron;
00171 
00172   // The extent type is a 3D extent
00173   int GetExtentType() { return VTK_3D_EXTENT; };
00174   
00175   int Dimensions[3];
00176   int DataDescription;
00177   int Blanking;
00178   vtkScalars *PointVisibility;
00179   void AllocatePointVisibility();
00180 
00181 
00182 private:
00184   void GetCellNeighbors(int cellId, vtkIdList& ptIds, vtkIdList& cellIds)
00185     {this->GetCellNeighbors(cellId, &ptIds, &cellIds);}
00186 
00187   // Internal method used by DeepCopy and ShallowCopy.
00188   void InternalStructuredGridCopy(vtkStructuredGrid *src);
00189 
00190 };
00191 
00192 
00193 inline int vtkStructuredGrid::GetNumberOfCells() 
00194 {
00195   int nCells=1;
00196   int i;
00197 
00198   for (i=0; i<3; i++)
00199     {
00200     if (this->Dimensions[i] > 1)
00201       {
00202       nCells *= (this->Dimensions[i]-1);
00203       }
00204     }
00205 
00206   return nCells;
00207 }
00208 
00209 inline int vtkStructuredGrid::GetDataDimension()
00210 {
00211   return vtkStructuredData::GetDataDimension(this->DataDescription);
00212 }
00213 
00214 
00215 inline int vtkStructuredGrid::IsPointVisible(int ptId) 
00216 {
00217   if (!this->Blanking)
00218     {
00219     return 1;
00220     }
00221   else
00222     {
00223     return (int) this->PointVisibility->GetScalar(ptId);
00224     }
00225 }
00226 
00227 #endif
00228 
00229 
00230 
00231 
00232 
00233 

Generated on Wed Nov 21 12:26:54 2001 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001