VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkHyperTreeGridSource.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 =========================================================================*/ 00027 The top level of the tree is not considered a grid level 00028 NB: For ease of legibility, white spaces are allowed and ignored. 00029 00030 @par Thanks: 00031 This class was written by Philippe Pebay and Joachim Pouderoux, 00032 Kitware 2013 00033 This work was supported in part by Commissariat a l'Energie Atomique (CEA/DIF) 00034 00035 @par Examples: 00036 @ref c2_vtk_e_vtkHyperTreeGridSource "vtkHyperTreeGridSource (Examples)" 00037 00038 @par Tests: 00039 @ref c2_vtk_t_vtkHyperTreeGridSource "vtkHyperTreeGridSource (Tests)" 00040 */ 00041 00042 #ifndef __vtkHyperTreeGridSource_h 00043 #define __vtkHyperTreeGridSource_h 00044 00045 #include "vtkFiltersSourcesModule.h" // For export macro 00046 #include "vtkHyperTreeGridAlgorithm.h" 00047 #include "vtkStdString.h" // For vtkStdString ivars 00048 00049 #include <vector> // STL Header 00050 #include <map> // STL Header 00051 00052 class vtkDataArray; 00053 class vtkBitArray; 00054 class vtkImplicitFunction; 00055 class vtkHyperTreeGrid; 00056 class vtkQuadric; 00057 00058 class VTKFILTERSSOURCES_EXPORT vtkHyperTreeGridSource : public vtkHyperTreeGridAlgorithm 00059 { 00060 public: 00061 vtkTypeMacro(vtkHyperTreeGridSource,vtkHyperTreeGridAlgorithm); 00062 void PrintSelf(ostream& os, vtkIndent indent); 00063 00064 static vtkHyperTreeGridSource* New(); 00065 00068 unsigned int GetMaximumLevel(); 00069 00072 void SetMaximumLevel( unsigned int levels ); 00073 00075 00076 vtkSetVector3Macro(Origin, double); 00077 vtkGetVector3Macro(Origin, double); 00079 00081 00083 vtkSetVector3Macro(GridScale, double); 00084 vtkGetVector3Macro(GridScale, double); 00086 00088 00089 vtkSetVector3Macro(GridSize, unsigned int); 00090 vtkGetVector3Macro(GridSize, unsigned int); 00092 00094 00097 vtkSetMacro(TransposedRootIndexing, bool); 00098 vtkGetMacro(TransposedRootIndexing, bool); 00099 void SetIndexingModeToKJI(); 00100 void SetIndexingModeToIJK(); 00102 00104 00105 vtkSetClampMacro(BranchFactor, unsigned int, 2, 3); 00106 vtkGetMacro(BranchFactor, unsigned int); 00108 00110 00111 vtkSetClampMacro(Dimension, unsigned int, 2, 3); 00112 vtkGetMacro(Dimension, unsigned int); 00114 00116 00118 vtkSetMacro(UseDescriptor, bool); 00119 vtkGetMacro(UseDescriptor, bool); 00120 vtkBooleanMacro(UseDescriptor, bool); 00122 00124 00126 vtkSetMacro(UseMaterialMask, bool); 00127 vtkGetMacro(UseMaterialMask, bool); 00128 vtkBooleanMacro(UseMaterialMask, bool); 00130 00132 00133 vtkSetStringMacro(Descriptor); 00134 vtkGetStringMacro(Descriptor); 00136 00138 00139 vtkSetStringMacro(MaterialMask); 00140 vtkGetStringMacro(MaterialMask); 00142 00144 00145 virtual void SetDescriptorBits( vtkBitArray* ); 00146 vtkGetObjectMacro( DescriptorBits, vtkBitArray ); 00148 00150 virtual void SetLevelZeroMaterialIndex( vtkIdTypeArray* ); 00151 00153 00154 virtual void SetMaterialMaskBits( vtkBitArray* ); 00155 vtkGetObjectMacro( MaterialMaskBits, vtkBitArray ); 00157 00159 00160 virtual void SetQuadric( vtkQuadric* ); 00161 vtkGetObjectMacro(Quadric, vtkQuadric); 00163 00165 00166 void SetQuadricCoefficients( double[10] ); 00167 void GetQuadricCoefficients( double[10] ); 00168 double* GetQuadricCoefficients(); 00170 00172 unsigned long GetMTime(); 00173 00175 00176 vtkBitArray* ConvertDescriptorStringToBitArray( const vtkStdString& ); 00177 vtkBitArray* ConvertMaterialMaskStringToBitArray( const vtkStdString& ); 00179 00180 protected: 00181 vtkHyperTreeGridSource(); 00182 ~vtkHyperTreeGridSource(); 00183 00184 int RequestInformation ( vtkInformation*, 00185 vtkInformationVector**, 00186 vtkInformationVector* ); 00187 00188 virtual int RequestData( vtkInformation*, 00189 vtkInformationVector**, 00190 vtkInformationVector* ); 00191 00193 int InitializeFromStringDescriptor(); 00194 00196 int InitializeFromBitsDescriptor(); 00197 00199 00200 void InitTreeFromDescriptor( vtkHyperTreeCursor* cursor, 00201 int treeIdx, 00202 int idx[3] ); 00204 00206 00207 void SubdivideFromStringDescriptor( vtkHyperTreeCursor* cursor, 00208 unsigned int level, 00209 int treeIdx, 00210 int childIdx, 00211 int idx[3], 00212 int parentPos ); 00214 00216 00217 void SubdivideFromBitsDescriptor( vtkHyperTreeCursor* cursor, 00218 unsigned int level, 00219 int treeIdx, 00220 int childIdx, 00221 int idx[3], 00222 int parentPos ); 00224 00226 00227 void SubdivideFromQuadric( vtkHyperTreeCursor* cursor, 00228 unsigned int level, 00229 int treeIdx, 00230 int idx[3], 00231 double origin[3], 00232 double size[3] ); 00234 00236 double EvaluateQuadric( double[3] ); 00237 00238 double Origin[3]; 00239 double GridScale[3]; 00240 unsigned int GridSize[3]; 00241 bool TransposedRootIndexing; 00242 unsigned int MaximumLevel; 00243 unsigned int Dimension; 00244 unsigned int BranchFactor; 00245 unsigned int BlockSize; 00246 bool UseDescriptor; 00247 bool UseMaterialMask; 00248 00249 vtkDataArray* XCoordinates; 00250 vtkDataArray* YCoordinates; 00251 vtkDataArray* ZCoordinates; 00252 00253 char* Descriptor; 00254 char* MaterialMask; 00255 std::vector<vtkStdString> LevelDescriptors; 00256 std::vector<vtkStdString> LevelMaterialMasks; 00257 00258 vtkBitArray* DescriptorBits; 00259 vtkBitArray* MaterialMaskBits; 00260 std::vector<vtkIdType> LevelBitsIndex; 00261 std::vector<vtkIdType> LevelBitsIndexCnt; 00262 00263 vtkIdTypeArray* LevelZeroMaterialIndex; 00264 std::map<vtkIdType, vtkIdType> LevelZeroMaterialMap; 00265 00266 std::vector<int> LevelCounters; 00267 00268 vtkQuadric* Quadric; 00269 00270 vtkHyperTreeGrid* Output; 00271 00272 private: 00273 vtkHyperTreeGridSource(const vtkHyperTreeGridSource&); // Not implemented. 00274 void operator=(const vtkHyperTreeGridSource&); // Not implemented. 00275 }; 00276 00277 #endif