VTK  9.3.20240918
vtkCellGridCopyQuery.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
93#ifndef vtkCellGridCopyQuery_h
94#define vtkCellGridCopyQuery_h
95
96#include "vtkCellGridQuery.h"
97#include "vtkStringToken.h" // For API.
98
99#include <map> // For ArrayMap ivar.
100#include <set> // For CellAttributeIds ivar.
101
102VTK_ABI_NAMESPACE_BEGIN
103
104class vtkAbstractArray;
105class vtkCellAttribute;
106class vtkCellGrid;
107class vtkIdList;
108
109class VTKCOMMONDATAMODEL_EXPORT vtkCellGridCopyQuery : public vtkCellGridQuery
110{
111public:
114 void PrintSelf(ostream& os, vtkIndent indent) override;
115
119 bool Initialize() override;
120
122 bool Finalize() override;
124
127
130 vtkGetObjectMacro(Source, vtkCellGrid);
131
134 vtkGetObjectMacro(Target, vtkCellGrid);
135
137
140
145 vtkGetMacro(CopyCells, int);
146 vtkSetMacro(CopyCells, int);
147 vtkBooleanMacro(CopyCells, int);
148
166 vtkGetMacro(CopyOnlyShape, int);
167 vtkSetMacro(CopyOnlyShape, int);
168 vtkBooleanMacro(CopyOnlyShape, int);
169
175 vtkGetMacro(CopyArrays, int);
176 vtkSetMacro(CopyArrays, int);
177 vtkBooleanMacro(CopyArrays, int);
178
184 vtkGetMacro(CopyArrayValues, int);
185 vtkSetMacro(CopyArrayValues, int);
186 vtkBooleanMacro(CopyArrayValues, int);
187
196 vtkGetMacro(DeepCopyArrays, int);
197 vtkSetMacro(DeepCopyArrays, int);
198 vtkBooleanMacro(DeepCopyArrays, int);
199
203 vtkGetMacro(CopySchema, int);
204 vtkSetMacro(CopySchema, int);
205 vtkBooleanMacro(CopySchema, int);
206
208
214
217 virtual bool AddSourceCellAttributeId(int attributeId);
218
220 virtual bool RemoveSourceCellAttributeId(int attributeId);
221
226
228 const std::set<int>& GetCellAttributeIds() const { return this->CellAttributeIds; }
229
232
234 virtual void ResetCellAttributeIds();
235
237
241
246 const std::map<vtkAbstractArray*, vtkAbstractArray*>& GetArrayMap() const
247 {
248 return this->ArrayMap;
249 }
250 std::map<vtkAbstractArray*, vtkAbstractArray*>& GetArrayMap() { return this->ArrayMap; }
251
256 const std::map<vtkCellAttribute*, vtkCellAttribute*>& GetAttributeMap() const
257 {
258 return this->AttributeMap;
259 }
260 std::map<vtkCellAttribute*, vtkCellAttribute*>& GetAttributeMap() { return this->AttributeMap; }
261
263
270
281
294
296
297protected:
300
301 vtkCellGrid* Source{ nullptr };
302 vtkCellGrid* Target{ nullptr };
303 std::set<int> CellAttributeIds;
304 std::map<vtkAbstractArray*, vtkAbstractArray*> ArrayMap;
305 std::map<vtkCellAttribute*, vtkCellAttribute*> AttributeMap;
306 int CopyCells{ 1 };
307 int CopyOnlyShape{ 1 };
308 int CopyArrays{ 1 };
309 int CopyArrayValues{ 1 };
310 int DeepCopyArrays{ 0 };
311 int CopySchema{ 1 };
312
313private:
315 void operator=(const vtkCellGridCopyQuery&) = delete;
316};
317
318VTK_ABI_NAMESPACE_END
319#endif // vtkCellGridCopyQuery_h
Abstract superclass for all arrays.
A function defined over the physical domain of a vtkCellGrid.
Copy the cell metadata and attribute(s) of one cell-grid into another.
bool Finalize() override
This clears the ArrayMap ivar after the algorithm completes (to save space).
virtual bool AddSourceCellAttributeId(int attributeId)
virtual void SetTarget(vtkCellGrid *target)
Set/get the target cell-grid into which the source should be copied.
vtkCellGridCopyQuery()=default
vtkCellAttribute * CopyOrUpdateAttributeRecord(vtkCellAttribute *srcAtt, vtkStringToken cellType)
Copy a cell-attribute (srcAtt) from the source into the target.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
std::map< vtkCellAttribute *, vtkCellAttribute * > & GetAttributeMap()
Return the map from source to target arrays.
std::map< vtkAbstractArray *, vtkAbstractArray * > ArrayMap
std::set< int > CellAttributeIds
virtual void SetSource(vtkCellGrid *source)
Set/get the source cell-grid to copy into the cell-grid on which this query is run.
const std::map< vtkAbstractArray *, vtkAbstractArray * > & GetArrayMap() const
Return the map from source to target arrays.
const std::map< vtkCellAttribute *, vtkCellAttribute * > & GetAttributeMap() const
Return the map from source to target cell-attributes.
static vtkCellGridCopyQuery * New()
virtual void ResetCellAttributeIds()
Reset the query so that no cell-attributes will be copied from the source.
const std::set< int > & GetCellAttributeIds() const
Return the set of attribute IDs scheduled to be copied when the query is run.
virtual bool AddAllSourceCellAttributeIds()
Add all of the source cell-grid's attributes to the list of IDs to be copied.
~vtkCellGridCopyQuery() override
void GetCellAttributeIds(vtkIdList *ids) const
Populate ids with the attribute IDs scheduled to be copied when the query is run.
bool Initialize() override
This clears the ArrayMap ivar after the algorithm completes (to save space).
virtual bool RemoveSourceCellAttributeId(int attributeId)
Remove attributeId from the list of cell-attributes to be copied from the source.
std::map< vtkCellAttribute *, vtkCellAttribute * > AttributeMap
std::map< vtkAbstractArray *, vtkAbstractArray * > & GetArrayMap()
Return the map from source to target arrays.
void CopyAttributeArrays(vtkCellAttribute *srcAtt, vtkStringToken cellType)
Copy the arrays for a single attribute from the source to the target.
Perform an operation on cells in a vtkCellMetadata instance.
Visualization data composed of cells of arbitrary type.
Definition vtkCellGrid.h:46
list of point or cell ids
Definition vtkIdList.h:133
a simple class to control print indentation
Definition vtkIndent.h:108
Represent a string by its integer hash.
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)