1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkUnstructuredGridBase.h
5 
6   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7   All rights reserved.
8   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10      This software is distributed WITHOUT ANY WARRANTY; without even
11      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12      PURPOSE.  See the above copyright notice for more information.
13 
14 =========================================================================*/
15 // .NAME vtkUnstructuredGridBase - dataset represents arbitrary combinations
16 // of all possible cell types. May be mapped onto a non-standard memory layout.
17 //
18 // .SECTION Description
19 // vtkUnstructuredGridBase defines the core vtkUnstructuredGrid API, omitting
20 // functions that are implementation dependent.
21 //
22 // .SECTION See Also
23 // vtkMappedDataArray vtkUnstructuredGrid
24 
25 #ifndef vtkUnstructuredGridBase_h
26 #define vtkUnstructuredGridBase_h
27 
28 #include "vtkCommonDataModelModule.h" // For export macro
29 #include "vtkPointSet.h"
30 
31 class VTKCOMMONDATAMODEL_EXPORT vtkUnstructuredGridBase : public vtkPointSet
32 {
33 public:
vtkAbstractTypeMacro(vtkUnstructuredGridBase,vtkPointSet)34   vtkAbstractTypeMacro(vtkUnstructuredGridBase,vtkPointSet)
35   void PrintSelf(ostream &os, vtkIndent indent)
36   {
37     this->Superclass::PrintSelf(os, indent);
38   }
39 
GetDataObjectType()40   int GetDataObjectType() { return VTK_UNSTRUCTURED_GRID_BASE; }
41 
42   // Description:
43   // Allocate memory for the number of cells indicated. extSize is not used.
44   virtual void Allocate(vtkIdType numCells=1000, int extSize=1000) = 0;
45 
46   // Description:
47   // Shallow and Deep copy.
48   void DeepCopy(vtkDataObject *src);
49 
50   // Description:
51   // Insert/create cell in object by type and list of point ids defining
52   // cell topology. Most cells require just a type which implicitly defines
53   // a set of points and their ordering. For non-polyhedron cell type, npts
54   // is the number of unique points in the cell. pts are the list of global
55   // point Ids. For polyhedron cell, a special input format is required.
56   // npts is the number of faces in the cell. ptIds is the list of face stream:
57   // (numFace0Pts, id1, id2, id3, numFace1Pts,id1, id2, id3, ...)
58   virtual vtkIdType InsertNextCell(int type, vtkIdType npts,
59                                    vtkIdType *ptIds) = 0;
60 
61   // Description:
62   // Insert/create cell in object by a list of point ids defining
63   // cell topology. Most cells require just a type which implicitly defines
64   // a set of points and their ordering. For non-polyhedron cell type, ptIds
65   // is the list of global Ids of unique cell points. For polyhedron cell,
66   // a special ptIds input format is required:
67   // (numCellFaces, numFace0Pts, id1, id2, id3, numFace1Pts,id1, id2, id3, ...)
68   virtual vtkIdType InsertNextCell(int type, vtkIdList *ptIds) = 0;
69 
70   // Desciption:
71   // Insert/create a polyhedron cell. npts is the number of unique points in
72   // the cell. pts is the list of the unique cell point Ids. nfaces is the
73   // number of faces in the cell. faces is the face-stream
74   // [numFace0Pts, id1, id2, id3, numFace1Pts,id1, id2, id3, ...].
75   // All point Ids are global.
76   virtual vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *ptIds,
77                                    vtkIdType nfaces, vtkIdType *faces) = 0;
78 
79   // Description:
80   // Replace the points defining cell "cellId" with a new set of points. This
81   // operator is (typically) used when links from points to cells have not been
82   // built (i.e., BuildLinks() has not been executed). Use the operator
83   // ReplaceLinkedCell() to replace a cell when cell structure has been built.
84   virtual void ReplaceCell(vtkIdType cellId, int npts, vtkIdType *pts) = 0;
85 
86   // Description:
87   // Fill vtkIdTypeArray container with list of cell Ids.  This
88   // method traverses all cells and, for a particular cell type,
89   // inserts the cell Id into the container.
90   virtual void GetIdsOfCellsOfType(int type, vtkIdTypeArray *array) = 0;
91 
92   // Description:
93   // Traverse cells and determine if cells are all of the same type.
94   virtual int IsHomogeneous() = 0;
95 
96   //BTX
97   // Description:
98   // Retrieve an instance of this class from an information object.
99   static vtkUnstructuredGridBase* GetData(vtkInformation* info);
100   static vtkUnstructuredGridBase* GetData(vtkInformationVector* v, int i=0);
101   //ETX
102 
103 protected:
104   vtkUnstructuredGridBase();
105   ~vtkUnstructuredGridBase();
106 
107 private:
108   vtkUnstructuredGridBase(const vtkUnstructuredGridBase&);  // Not implemented.
109   void operator=(const vtkUnstructuredGridBase&);  // Not implemented.
110 };
111 
112 #endif
113