VTK  9.4.20250221
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
20VTK_ABI_NAMESPACE_BEGIN
21
22class VTKFILTERSHYPERTREE_EXPORT vtkHyperTreeGridGenerateFieldStrategy : public vtkObject
23{
24public:
25 struct Field
26 {
27 std::string name;
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
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(vtkHyperTreeGrid* vtkMaybeUnused(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
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
102protected:
103 std::string ArrayName;
105
106private:
107 void operator=(const vtkHyperTreeGridGenerateFieldStrategy&) = delete;
109};
110
111VTK_ABI_NAMESPACE_END
112#endif // vtkHyperTreeGridGenerateFieldStrategy_h
represent and manipulate cell attribute data
abstract superclass for arrays of numeric data
AttributeTypes
Possible attribute types.
Abstract class for field definition used by vtkHyperTreeGridGenerateFields.
virtual void Compute(vtkHyperTreeGridNonOrientedGeometryCursor *)
Reimplement to compute the data for the current cell.
vtkDataObject::AttributeTypes GetArrayType()
Get/Set type of the data array.
vtkAbstractTypeMacro(vtkHyperTreeGridGenerateFieldStrategy, vtkObject)
std::string GetArrayName()
Get/Set the name of the array containing the data.
virtual void Compute(vtkHyperTreeGridNonOrientedGeometryCursor *, vtkCellData *, std::unordered_map< std::string, Field >)
Reimplement to compute the data for the current cell.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual vtkDataArray * GetAndFinalizeArray()=0
Reimplement to build the output array from internally stored values.
virtual void Initialize(vtkHyperTreeGrid *vtkMaybeUnused(inputHTG))
Reimplement to initialize internal structures based on the given input HTG.
void SetArrayType(vtkDataObject::AttributeTypes arrayType)
Get/Set type of the data array.
void SetArrayName(std::string arrayName)
Get/Set the name of the array containing the data.
virtual bool Initialize(std::unordered_map< std::string, Field >)
Reimplement to initialize internal structures based on the given input HTG.
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
a simple class to control print indentation
Definition vtkIndent.h:108
abstract base class for most VTK objects
Definition vtkObject.h:162
Hold a reference to a vtkObjectBase instance.
vtkSmartPointer< vtkHyperTreeGridGenerateFieldStrategy > strategy