VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkMappedUnstructuredGrid.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 =========================================================================*/ 00135 @endcode 00136 00137 The vtkCPExodusIIElementBlock class provides an example of 00138 vtkMappedUnstructuredGrid usage, adapting the Exodus II data structures for 00139 the VTK pipeline. 00140 */ 00141 00142 #ifndef __vtkMappedUnstructuredGrid_h 00143 #define __vtkMappedUnstructuredGrid_h 00144 00145 #include "vtkUnstructuredGridBase.h" 00146 00147 #include "vtkMappedUnstructuredGridCellIterator.h" // For default cell iterator 00148 #include "vtkNew.h" // For vtkNew 00149 #include "vtkSmartPointer.h" // For vtkSmartPointer 00150 #include "vtkTypeTemplate.h" // For vtkTypeTemplate 00151 00152 template <class Implementation, 00153 class CellIterator = vtkMappedUnstructuredGridCellIterator<Implementation> > 00154 class vtkMappedUnstructuredGrid: 00155 public vtkTypeTemplate<vtkMappedUnstructuredGrid<Implementation, CellIterator>, 00156 vtkUnstructuredGridBase> 00157 { 00158 public: 00159 typedef 00160 vtkTypeTemplate<vtkMappedUnstructuredGrid<Implementation, CellIterator>, 00161 vtkUnstructuredGridBase> Superclass; 00162 typedef Implementation ImplementationType; 00163 typedef CellIterator CellIteratorType; 00164 00165 // Virtuals from various base classes: 00166 void PrintSelf(ostream &os, vtkIndent indent); 00167 void CopyStructure(vtkDataSet *pd); 00168 void ShallowCopy(vtkDataObject *src); 00169 vtkIdType GetNumberOfCells(); 00170 vtkCell* GetCell(vtkIdType cellId); 00171 void GetCell(vtkIdType cellId, vtkGenericCell *cell); 00172 int GetCellType(vtkIdType cellId); 00173 void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds); 00174 vtkCellIterator* NewCellIterator(); 00175 void GetPointCells(vtkIdType ptId, vtkIdList *cellIds); 00176 int GetMaxCellSize(); 00177 void GetIdsOfCellsOfType(int type, vtkIdTypeArray *array); 00178 int IsHomogeneous(); 00179 void Allocate(vtkIdType numCells, int extSize = 1000); 00180 vtkIdType InsertNextCell(int type, vtkIdList *ptIds); 00181 vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *ptIds); 00182 vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *ptIds, 00183 vtkIdType nfaces, vtkIdType *faces); 00184 void ReplaceCell(vtkIdType cellId, int npts, vtkIdType *pts); 00185 unsigned long GetMTime(); 00186 00187 void SetImplementation(ImplementationType *impl); 00188 ImplementationType *GetImplementation(); 00189 00190 protected: 00191 vtkMappedUnstructuredGrid(); 00192 ~vtkMappedUnstructuredGrid(); 00193 00194 // For convenience... 00195 typedef vtkMappedUnstructuredGrid<Implementation, CellIterator> ThisType; 00196 00197 vtkSmartPointer<ImplementationType> Impl; 00198 00199 private: 00200 vtkMappedUnstructuredGrid(const vtkMappedUnstructuredGrid &); // Not implemented. 00201 void operator=(const vtkMappedUnstructuredGrid &); // Not implemented. 00202 00203 vtkNew<vtkGenericCell> TempCell; 00204 }; 00205 00206 #include "vtkMappedUnstructuredGrid.txx" 00207 00208 // We need to fake the superclass for the wrappers, otherwise they will choke on 00209 // the template: 00210 #ifndef __WRAP__ 00211 00212 #define vtkMakeExportedMappedUnstructuredGrid(_className, _impl, _exportDecl) \ 00213 class _exportDecl _className : \ 00214 public vtkMappedUnstructuredGrid<_impl> \ 00215 { \ 00216 public: \ 00217 vtkTypeMacro(_className, \ 00218 vtkMappedUnstructuredGrid<_impl>) \ 00219 static _className* New(); \ 00220 protected: \ 00221 _className() \ 00222 { \ 00223 _impl *i = _impl::New(); \ 00224 this->SetImplementation(i); \ 00225 i->Delete(); \ 00226 } \ 00227 ~_className() {} \ 00228 private: \ 00229 _className(const _className&); \ 00230 void operator=(const _className&); \ 00231 }; 00232 00233 #define vtkMakeExportedMappedUnstructuredGridWithIter(_className, _impl, _cIter, _exportDecl) \ 00234 class _exportDecl _className : \ 00235 public vtkMappedUnstructuredGrid<_impl, _cIter> \ 00236 { \ 00237 public: \ 00238 vtkTypeMacro(_className, \ 00239 vtkMappedUnstructuredGrid<_impl, _cIter>) \ 00240 static _className* New(); \ 00241 protected: \ 00242 _className() \ 00243 { \ 00244 _impl *i = _impl::New(); \ 00245 this->SetImplementation(i); \ 00246 i->Delete(); \ 00247 } \ 00248 ~_className() {} \ 00249 private: \ 00250 _className(const _className&); \ 00251 void operator=(const _className&); \ 00252 }; 00253 00254 #else // __WRAP__ 00255 00256 #define vtkMakeExportedMappedUnstructuredGrid(_className, _impl, _exportDecl) \ 00257 class _exportDecl _className : \ 00258 public vtkUnstructuredGridBase \ 00259 { \ 00260 public: \ 00261 vtkTypeMacro(_className, vtkUnstructuredGridBase) \ 00262 static _className* New(); \ 00263 protected: \ 00264 _className() {} \ 00265 ~_className() {} \ 00266 private: \ 00267 _className(const _className&); \ 00268 void operator=(const _className&); \ 00269 }; 00270 00271 #define vtkMakeExportedMappedUnstructuredGridWithIter(_className, _impl, _cIter, _exportDecl) \ 00272 class _exportDecl _className : \ 00273 public vtkUnstructuredGridBase \ 00274 { \ 00275 public: \ 00276 vtkTypeMacro(_className, vtkUnstructuredGridBase) \ 00277 static _className* New(); \ 00278 protected: \ 00279 _className() {} \ 00280 ~_className() {} \ 00281 private: \ 00282 _className(const _className&); \ 00283 void operator=(const _className&); \ 00284 }; 00285 00286 #endif // __WRAP__ 00287 00288 #define vtkMakeMappedUnstructuredGrid(_className, _impl) \ 00289 vtkMakeExportedMappedUnstructuredGrid(_className, _impl, ) 00290 00291 #define vtkMakeMappedUnstructuredGridWithIter(_className, _impl, _cIter, _exportDecl) \ 00292 vtkMakeExportedMappedUnstructuredGridWithIter(_className, _impl, _cIter, ) 00293 00294 #endif //__vtkMappedUnstructuredGrid_h 00295 00296 // VTK-HeaderTest-Exclude: vtkMappedUnstructuredGrid.h