VTK  9.7.1
vtkHyperTreeGridGenerateFieldStrategy.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
11 #ifndef vtkHyperTreeGridGenerateFieldStrategy_h
12 #define vtkHyperTreeGridGenerateFieldStrategy_h
13 
14 #include "vtkFiltersHyperTreeModule.h" // For export macro
15 #include "vtkHyperTreeGrid.h" // For vtkHyperTreeGrid
16 #include "vtkObject.h"
17 
18 #include <unordered_map>
19 
20 VTK_ABI_NAMESPACE_BEGIN
21 
22 class VTKFILTERSHYPERTREE_EXPORT vtkHyperTreeGridGenerateFieldStrategy : public vtkObject
23 {
24 public:
25  struct Field
26  {
29  bool enabled; // Whether the user asked for this array to be computed.
30  bool valid = true; // Whether the array can be computed. Only make sense for Field Data (Cell
31  // Data fields are always valid if enabled).
32  };
33 
35  vtkAbstractTypeMacro(vtkHyperTreeGridGenerateFieldStrategy, vtkObject);
36  void PrintSelf(ostream& os, vtkIndent indent) override
37  {
38  this->Superclass::PrintSelf(os, indent);
39  os << indent << "Array name: " << this->ArrayName << "\n";
40  os << indent << "Array type: "
41  << (this->ArrayType == vtkDataObject::AttributeTypes::CELL ? "CELL_DATA" : "FIELD_DATA")
42  << "\n";
43  }
44 
46 
52  virtual void Initialize([[maybe_unused]] vtkHyperTreeGrid* inputHTG) {}
53  virtual bool Initialize(std::unordered_map<std::string, Field>) { return true; }
55 
57 
66  std::unordered_map<std::string, Field>)
67  {
68  }
70 
72 
75  virtual vtkDataArray* GetAndFinalizeArray() = 0;
77 
79 
84  vtkDataObject::AttributeTypes GetArrayType() { return this->ArrayType; }
86  {
87  assert(arrayType == vtkDataObject::AttributeTypes::CELL ||
89  this->ArrayType = arrayType;
90  }
92 
94 
98  std::string GetArrayName() { return this->ArrayName; }
99  void SetArrayName(std::string arrayName) { this->ArrayName = arrayName; }
101 
102 protected:
104  vtkDataObject::AttributeTypes ArrayType = vtkDataObject::AttributeTypes::CELL;
105 
106 private:
107  void operator=(const vtkHyperTreeGridGenerateFieldStrategy&) = delete;
109 };
110 
111 VTK_ABI_NAMESPACE_END
112 #endif // vtkHyperTreeGridGenerateFieldStrategy_h
vtkSmartPointer< vtkHyperTreeGridGenerateFieldStrategy > strategy
abstract base class for most VTK objects
Definition: vtkObject.h:52
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
#define FIELD
void SetArrayType(vtkDataObject::AttributeTypes arrayType)
Get/Set type of the data array.
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
represent and manipulate cell attribute data
Definition: vtkCellData.h:31
virtual bool Initialize(std::unordered_map< std::string, Field >)
Reimplement to initialize internal structures based on the given input HTG.
std::string GetArrayName()
Get/Set the name of the array containing the data.
a simple class to control print indentation
Definition: vtkIndent.h:28
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
Abstract class for field definition used by vtkHyperTreeGridGenerateFields.
void SetArrayName(std::string arrayName)
Get/Set the name of the array containing the data.
virtual void Initialize([[maybe_unused]] vtkHyperTreeGrid *inputHTG)
Reimplement to initialize internal structures based on the given input HTG.
virtual void Compute(vtkHyperTreeGridNonOrientedGeometryCursor *)
Reimplement to compute the data for the current cell.
vtkDataObject::AttributeTypes GetArrayType()
Get/Set type of the data array.
AttributeTypes
Possible attribute types.
virtual void Compute(vtkHyperTreeGridNonOrientedGeometryCursor *, vtkCellData *, std::unordered_map< std::string, Field >)
Reimplement to compute the data for the current cell.