VTK  9.5.20251120
vtkCellGridSidesQuery.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
3#ifndef vtkCellGridSidesQuery_h
4#define vtkCellGridSidesQuery_h
5
6#include "vtkCellGridQuery.h"
7
8#include "vtkStringToken.h" // For API.
9
10#include <functional>
11#include <map>
12#include <set>
13#include <unordered_map>
14#include <vector>
15
16VTK_ABI_NAMESPACE_BEGIN
17
19class vtkIdTypeArray;
20
37class VTKCOMMONDATAMODEL_EXPORT vtkCellGridSidesQuery : public vtkCellGridQuery
38{
39public:
42 void PrintSelf(ostream& os, vtkIndent indent) override;
43
45 enum SideFlags : int
46 {
47 // Individual bits
54
55 // Useful (but not exhaustive) combinations
59 AllSides = 0x3f,
61 };
62
64 enum PassWork : int
65 {
76 };
77
96
103
114
125
139
146 vtkSetMacro(OutputDimensionControl, int);
147 vtkGetMacro(OutputDimensionControl, int);
148 vtkBooleanMacro(OutputDimensionControl, int);
149
160 virtual void SetStrategy(int strategy)
161 {
162 this->SetStrategy(static_cast<SummaryStrategy>(strategy));
163 }
164
178 virtual void SetSelectionType(int selnType)
179 {
180 this->SetSelectionType(static_cast<SelectionMode>(selnType));
181 }
182
183 bool Initialize() override;
184 void StartPass() override;
185 bool IsAnotherPassRequired() override;
186 bool Finalize() override;
187
188 std::unordered_map<vtkStringToken,
189 std::unordered_map<vtkStringToken, std::unordered_map<vtkIdType, std::set<int>>>>&
191 {
192 return this->Sides;
193 }
194
196 std::vector<SideSetArray> GetSideSetArrays(vtkStringToken cellType);
197
201
205
215 vtkGetObjectMacro(SideCache, vtkCellGridSidesCache);
217
218protected:
221
228 bool TemporarySideCache{ false };
229 std::unordered_map<vtkStringToken,
230 std::unordered_map<vtkStringToken, std::unordered_map<vtkIdType, std::set<int>>>>
232
233private:
235 void operator=(const vtkCellGridSidesQuery&) = delete;
236};
237
238VTK_ABI_NAMESPACE_END
239#endif // vtkCellGridSidesQuery_h
vtkCellGridQuery()=default
Hold a map from hash-ids (representing sides of cells of multiple types) to details on the cells that...
PassWork
An enum specifying the work responders should perform for each pass.
@ HashSides
Responders should call AddSide() on each cell's sides to insert entries into this->SideCache.
@ GenerateSideSets
Responders should insert new side sets into their parent cell-grid by examining this->Sides.
@ Summarize
Responders should claim entries in this->SideCache by transcribing them to this->Sides and then delet...
vtkGetEnumMacro(Strategy, SummaryStrategy)
std::vector< SideSetArray > GetSideSetArrays(vtkStringToken cellType)
Return arrays of cell+side IDs for the given cellType.
vtkSetEnumMacro(SelectionType, SelectionMode)
Set/get whether the extracted sides should be marked as selectable or whether their originating data ...
virtual void SetSelectionType(int selnType)
This method exists for ParaView to set the selection mode.
vtkCellGridSidesQuery()=default
~vtkCellGridSidesQuery() override
SideFlags
An enum specifying which side(s) each responder should generate.
@ VerticesOfVolumes
Input volumes should produce corner vertices.
@ EdgesOfInputs
Produce edges of inputs of higher dimension.
@ SurfacesOfVolumes
Input volumes should produce bounding surfaces.
@ SurfacesOfInputs
Produce surfaces (i.e., omit sides of renderable geometry).
@ EdgesOfVolumes
Input volumes should produce edges bounding faces.
@ NextLowestDimension
Given an input of dimension D, produce sides of dimension D-1.
@ AllSides
Produce all sides of inputs that have any sides.
@ VerticesOfInputs
Produce vertices of inputs of higher dimension.
@ EdgesOfSurfaces
Input surfaces should produce bounding edges.
@ VerticesOfSurfaces
Input surfaces should produce corner vertices.
@ VerticesOfEdges
Input edges should produce endpoint vertices.
vtkSetEnumMacro(Strategy, SummaryStrategy)
Set/get the strategy responders should use to generate entries in Sides from entries in SideCache.
static vtkStringToken SelectionModeToLabel(SelectionMode mode)
Return a string-token with the given selection mode or vice-versa.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
SummaryStrategy
An enum specifying the strategy by which input hashes are summarized into output Sides entries.
@ Boundary
Hashes for shapes (a) of dimension (d-1) that occur an odd number of times and (b) of dimension < (d-...
@ Winding
The number of hash entries for a given side should be used to decide whether to include a hash's side...
@ AnyOccurrence
If a hash entry entry exists, a single side should be included in the output.
std::unordered_map< vtkStringToken, std::unordered_map< vtkStringToken, std::unordered_map< vtkIdType, std::set< int > > > > Sides
static SelectionMode SelectionModeFromLabel(vtkStringToken token)
bool Initialize() override
Override this if your query-result state requires initialization.
static vtkCellGridSidesQuery * New()
virtual void SetStrategy(int strategy)
This method exists for ParaView to set the strategy.
std::unordered_map< vtkStringToken, std::unordered_map< vtkStringToken, std::unordered_map< vtkIdType, std::set< int > > > > & GetSides()
bool IsAnotherPassRequired() override
Override this if your query allows responders to execute in multiple phases.
static vtkStringToken SummaryStrategyToLabel(SummaryStrategy strategy)
Return a string-token with the given summarization strategy or vice-versa.
SelectionMode
Indicate how output should be generated or marked so selection works as expected.
@ Input
Input shapes should be selected when output sides are picked.
@ Output
Output sides should be selected when they are picked.
bool Finalize() override
Override this if your query-result state requires finalization.
static SummaryStrategy SummaryStrategyFromLabel(vtkStringToken token)
virtual void SetSideCache(vtkCellGridSidesCache *cache)
void StartPass() override
Mark the start of a pass through each cell type.
vtkCellGridSidesCache * SideCache
vtkGetEnumMacro(SelectionType, SelectionMode)
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition vtkIndent.h:108
Hold a reference to a vtkObjectBase instance.
Represent a string by its integer hash.
A structure created by the GetSideSetArrays() method for responders to use.
vtkStringToken CellType
The type of parent cell which created the sides.
vtkSmartPointer< vtkIdTypeArray > Sides
An array of tuples of (cell-id, side-id) specifying sides.
vtkStringToken SideShape
The shape of all the sides in the Sides array.
int vtkTypeBool
Definition vtkABI.h:64