File: vtkHyperTreeGridPreConfiguredSource.h

package info (click to toggle)
vtk9 9.5.2%2Bdfsg3-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 205,916 kB
  • sloc: cpp: 2,336,565; ansic: 327,116; python: 111,200; yacc: 4,104; java: 3,977; sh: 3,032; xml: 2,771; perl: 2,189; lex: 1,787; makefile: 178; javascript: 165; objc: 153; tcl: 59
file content (186 lines) | stat: -rw-r--r-- 5,029 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
// SPDX-License-Identifier: BSD-3-Clause

/**
 * @class vtkHyperTreeGridPreConfiguredSource
 * @brief Helper class for generating a curated set of HyperTree Grids (HTGs) for testing purposes
 *
 * Provides a set of public methods for generating some commonly used HTG setups.
 */

#include "vtkFiltersSourcesModule.h" //for export macro
#include "vtkHyperTreeGridAlgorithm.h"

#ifndef vtkHyperTreeGridPreConfiguredSource_h
#define vtkHyperTreeGridPreConfiguredSource_h

VTK_ABI_NAMESPACE_BEGIN
class vtkHyperTreeGrid;
class vtkHyperTreeGridNonOrientedCursor;
class vtkDoubleArray;

class VTKFILTERSSOURCES_EXPORT vtkHyperTreeGridPreConfiguredSource
  : public vtkHyperTreeGridAlgorithm
{
public:
  /**
   * Standard object factory setup
   */
  vtkTypeMacro(vtkHyperTreeGridPreConfiguredSource, vtkHyperTreeGridAlgorithm);
  static vtkHyperTreeGridPreConfiguredSource* New();

  ///@{
  /**
   * Helper methods for generating HTGs
   */
  void GenerateUnbalanced(vtkHyperTreeGrid* HTG, unsigned int dim, unsigned int factor,
    unsigned int depth, const std::vector<double>& extent,
    const std::vector<unsigned int>& subdivisions);

  void GenerateBalanced(vtkHyperTreeGrid* HTG, unsigned int dim, unsigned int factor,
    unsigned int depth, const std::vector<double>& extent,
    const std::vector<unsigned int>& subdivisions);
  ///@}

  ///@{
  /**
   * An enum type for referencing preconfigured HTGs
   */
  enum HTGType
  {
    UNBALANCED_3DEPTH_2BRANCH_2X3,
    BALANCED_3DEPTH_2BRANCH_2X3,
    UNBALANCED_2DEPTH_3BRANCH_3X3,
    BALANCED_4DEPTH_3BRANCH_2X2,
    UNBALANCED_3DEPTH_2BRANCH_3X2X3,
    BALANCED_2DEPTH_3BRANCH_3X3X2,
    CUSTOM
  };
  ///@}

  ///@{
  /**
   * An enum type for configuring the type of generation for the CUSTOM HTG type
   */
  enum HTGArchitecture
  {
    UNBALANCED,
    BALANCED
  };
  ///@}

  /**
   * Get/Set HyperTreeGrid mode
   */
  vtkGetEnumMacro(HTGMode, HTGType);
  vtkSetEnumMacro(HTGMode, HTGType);

  ///@{
  /**
   * Get/Set for custom architecture
   */
  vtkGetEnumMacro(CustomArchitecture, HTGArchitecture);
  vtkSetEnumMacro(CustomArchitecture, HTGArchitecture);

  /**
   * Get/Set for custom dimension
   */
  vtkGetMacro(CustomDim, unsigned int);
  vtkSetMacro(CustomDim, unsigned int);

  /**
   * Get/Set for custom branching factor
   */
  vtkGetMacro(CustomFactor, unsigned int);
  vtkSetMacro(CustomFactor, unsigned int);

  /**
   * Get/Set for custom depth
   */
  vtkGetMacro(CustomDepth, unsigned int);
  vtkSetMacro(CustomDepth, unsigned int);

  /**
   * Get/Set for custom extent in coordinate space
   */
  vtkGetVector6Macro(CustomExtent, double);
  vtkSetVector6Macro(CustomExtent, double);

  /**
   * Get/Set for custom subdivisions of the extent
   */
  vtkGetVector3Macro(CustomSubdivisions, unsigned int);
  vtkSetVector3Macro(CustomSubdivisions, unsigned int);
  ///@}

  ///@{
  /**
   *  Helper functions for generating the different types of HTGs
   */
  void GenerateUnbalanced3DepthQuadTree2x3(vtkHyperTreeGrid* HTG);

  void GenerateBalanced3DepthQuadTree2x3(vtkHyperTreeGrid* HTG);

  void GenerateUnbalanced2Depth3BranchTree3x3(vtkHyperTreeGrid* HTG);

  void GenerateBalanced4Depth3BranchTree2x2(vtkHyperTreeGrid* HTG);

  void GenerateUnbalanced3DepthOctTree3x2x3(vtkHyperTreeGrid* HTG);

  void GenerateBalanced2Depth3BranchTree3x3x2(vtkHyperTreeGrid* HTG);

  int GenerateCustom(vtkHyperTreeGrid* HTG);
  ///@}

protected:
  /**
   * Constructor setup
   */
  vtkHyperTreeGridPreConfiguredSource();
  ~vtkHyperTreeGridPreConfiguredSource() override = default;
  vtkHyperTreeGridPreConfiguredSource(const vtkHyperTreeGridPreConfiguredSource&) = delete;

  void operator=(const vtkHyperTreeGridPreConfiguredSource&) = delete;

  int FillOutputPortInformation(int, vtkInformation*) override;

  int RequestInformation(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
  int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;

  int ProcessTrees(vtkHyperTreeGrid*, vtkDataObject*) override;

  ///@{
  /**
   * Common preprocessing for setting up the HyperTreeGrid for all types
   */
  void Preprocess(vtkHyperTreeGrid* HTG, unsigned int dim, unsigned int factor,
    const std::vector<double>& extent, const std::vector<unsigned int>& subdivisions);

  /**
   * Recursive helper for the BALANCED architecture
   */
  void RecurseBalanced(
    vtkHyperTreeGridNonOrientedCursor* cursor, vtkDoubleArray* levels, int maxDepth);
  ///@}

  ///@{
  /**
   * The pre-configuration mode of the generator
   */
  HTGType HTGMode;

  /**
   * All members related to the CUSTOM HTGType
   */
  HTGArchitecture CustomArchitecture;
  unsigned int CustomDim;
  unsigned int CustomFactor;
  unsigned int CustomDepth;
  double CustomExtent[6];
  unsigned int CustomSubdivisions[3];
  ///@}

}; // vtkHyperTreeGridPreConfiguredSource
VTK_ABI_NAMESPACE_END

#endif // vtkHyperTreeGridPreConfiguredSource_h