File: vtkHyperTreeGridGenerateFields.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 (157 lines) | stat: -rw-r--r-- 4,960 bytes parent folder | download | duplicates (5)
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
// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
// SPDX-License-Identifier: BSD-3-Clause
/**
 * @class   vtkHyperTreeGridGenerateFields
 * @brief   Generate cell fields for a HTG
 *
 * vtkHyperTreeGridGenerateFields creates 2 distinct (double) cell fields: ValidCell and CellSize
 * See respective internal classes for the content and computation of each field.
 *
 * Note that the filter needs to be run again if cells are refined after its execution.
 *
 * @sa
 * vtkHyperTreeGridCellSizeStrategy vtkHyperTreeGridValidCellStrategy
 * vtkHyperTreeGridGenerateFieldStrategy vtkHyperTreeGrid vtkHyperTreeGridAlgorithm
 *
 * @par Thanks:
 * This class was originally written by Jacques-Bernard Lekien, 2023
 * This work was supported by Commissariat a l'Energie Atomique
 * CEA, DAM, DIF, F-91297 Arpajon, France.
 */

#ifndef vtkHyperTreeGridGenerateFields_h
#define vtkHyperTreeGridGenerateFields_h

#include "vtkFiltersHyperTreeModule.h" // For export macro
#include "vtkHyperTreeGridAlgorithm.h"
#include "vtkHyperTreeGridGenerateFieldStrategy.h" // For vtkHyperTreeGridGenerateFieldStrategy

#include <unordered_map>

VTK_ABI_NAMESPACE_BEGIN
class vtkCellData;
class vtkHyperTreeGrid;
class vtkHyperTreeGridNonOrientedGeometryCursor;

class VTKFILTERSHYPERTREE_EXPORT vtkHyperTreeGridGenerateFields : public vtkHyperTreeGridAlgorithm
{
public:
  static vtkHyperTreeGridGenerateFields* New();
  vtkTypeMacro(vtkHyperTreeGridGenerateFields, vtkHyperTreeGridAlgorithm);
  void PrintSelf(ostream& os, vtkIndent indent) override;

  ///@{
  /**
   * Enable/disable the computation of the CellSize array.
   * Default is true.
   */
  virtual bool GetComputeCellSizeArray() VTK_FUTURE_CONST;
  virtual void SetComputeCellSizeArray(bool enable);
  vtkBooleanMacro(ComputeCellSizeArray, bool);
  ///@}

  ///@{
  /**
   * Get/Set the name used for the cell size array.
   * Defaults to 'CellSize'
   */
  virtual std::string GetCellSizeArrayName() VTK_FUTURE_CONST;
  virtual void SetCellSizeArrayName(std::string name);
  ///@}

  ///@{
  /**
   * Enable/disable the computation of the ValidCell array.
   * Default is true.
   */
  virtual bool GetComputeValidCellArray() VTK_FUTURE_CONST;
  virtual void SetComputeValidCellArray(bool enable);
  vtkBooleanMacro(ComputeValidCellArray, bool);
  ///@}

  ///@{
  /**
   * Get/Set the name used for the cell validity array.
   * Defaults to 'ValidCell'
   */
  virtual std::string GetValidCellArrayName() VTK_FUTURE_CONST;
  virtual void SetValidCellArrayName(std::string name);
  ///@}

  ///@{
  /**
   * Enable/disable the computation of the CellCenter array.
   * Default is true.
   */
  virtual bool GetComputeCellCenterArray() VTK_FUTURE_CONST;
  virtual void SetComputeCellCenterArray(bool enable);
  vtkBooleanMacro(ComputeCellCenterArray, bool);
  ///@}

  ///@{
  /**
   * Get/Set the name used for the cell center array.
   * Defaults to 'CellCenter'
   */
  virtual std::string GetCellCenterArrayName() VTK_FUTURE_CONST;
  virtual void SetCellCenterArrayName(std::string name);
  ///@}

  ///@{
  /**
   * Enable/disable the computation of the TotalVisibleVolume array.
   * Default is true.
   */
  virtual bool GetComputeTotalVisibleVolumeArray() VTK_FUTURE_CONST;
  virtual void SetComputeTotalVisibleVolumeArray(bool enable);
  vtkBooleanMacro(ComputeTotalVisibleVolumeArray, bool);
  ///@}

  ///@{
  /**
   * Get/Set the name used for the total visible volume array.
   * Defaults to 'TotalVisibleVolume'
   */
  virtual std::string GetTotalVisibleVolumeArrayName() VTK_FUTURE_CONST;
  virtual void SetTotalVisibleVolumeArrayName(std::string name);
  ///@}

protected:
  vtkHyperTreeGridGenerateFields();
  ~vtkHyperTreeGridGenerateFields() override = default;

  /**
   * Main filter routine : process the HTG cell data and then field data
   */
  int ProcessTrees(vtkHyperTreeGrid*, vtkDataObject*) override;

private:
  vtkHyperTreeGridGenerateFields(const vtkHyperTreeGridGenerateFields&) = delete;
  void operator=(const vtkHyperTreeGridGenerateFields&) = delete;

  /**
   * Iterate over the trees and fill output array structures. Output arrays are used as CellData or
   * FieldData depending on `type`.
   */
  void ProcessFields(
    vtkHyperTreeGrid* outputHTG, vtkHyperTreeGrid* input, vtkDataObject::AttributeTypes type);

  /**
   * Process a single tree, recursively descending into the tree, down to leaves
   */
  void ProcessNode(vtkHyperTreeGridNonOrientedGeometryCursor* cursor,
    vtkDataObject::AttributeTypes type, vtkCellData* outputCellData);

  // Cell Data
  std::string DefaultCellSizeArrayName = "CellSize";
  std::string DefaultValidCellArrayName = "ValidCell";
  std::string DefaultCellCenterArrayName = "CellCenter";

  // Field Data
  std::string DefaultTotalVisibleVolumeArrayName = "TotalVisibleVolume";

  std::unordered_map<std::string, vtkHyperTreeGridGenerateFieldStrategy::Field> Fields;
};

VTK_ABI_NAMESPACE_END
#endif