VTK  9.7.1
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 
102 VTK_ABI_NAMESPACE_BEGIN
103 
104 class vtkAbstractArray;
105 class vtkCellAttribute;
106 class vtkCellGrid;
107 class vtkIdList;
108 
109 class VTKCOMMONDATAMODEL_EXPORT vtkCellGridCopyQuery : public vtkCellGridQuery
110 {
111 public:
112  static vtkCellGridCopyQuery* New();
114  void PrintSelf(ostream& os, vtkIndent indent) override;
115 
119  bool Initialize() override;
120 
122  bool Finalize() override;
124 
127 
129  virtual void SetSource(vtkCellGrid* source);
130  vtkGetObjectMacro(Source, vtkCellGrid);
131 
133  virtual void SetTarget(vtkCellGrid* target);
134  vtkGetObjectMacro(Target, vtkCellGrid);
135 
137 
140 
145  vtkGetMacro(CopyCellTypes, int);
146  vtkSetMacro(CopyCellTypes, int);
147  vtkBooleanMacro(CopyCellTypes, int);
148 
153  vtkGetMacro(CopyCells, int);
154  vtkSetMacro(CopyCells, int);
155  vtkBooleanMacro(CopyCells, int);
156 
174  vtkGetMacro(CopyOnlyShape, int);
175  vtkSetMacro(CopyOnlyShape, int);
176  vtkBooleanMacro(CopyOnlyShape, int);
177 
183  vtkGetMacro(CopyArrays, int);
184  vtkSetMacro(CopyArrays, int);
185  vtkBooleanMacro(CopyArrays, int);
186 
192  vtkGetMacro(CopyArrayValues, int);
193  vtkSetMacro(CopyArrayValues, int);
194  vtkBooleanMacro(CopyArrayValues, int);
195 
204  vtkGetMacro(DeepCopyArrays, int);
205  vtkSetMacro(DeepCopyArrays, int);
206  vtkBooleanMacro(DeepCopyArrays, int);
207 
211  vtkGetMacro(CopySchema, int);
212  vtkSetMacro(CopySchema, int);
213  vtkBooleanMacro(CopySchema, int);
214 
216 
222 
225  virtual bool AddSourceCellAttributeId(int attributeId);
226 
228  virtual bool RemoveSourceCellAttributeId(int attributeId);
229 
233  virtual bool AddAllSourceCellAttributeIds();
234 
236  const std::set<int>& GetCellAttributeIds() const { return this->CellAttributeIds; }
237 
239  void GetCellAttributeIds(vtkIdList* ids) const;
240 
242  virtual void ResetCellAttributeIds();
243 
245 
249 
254  const std::map<vtkAbstractArray*, vtkAbstractArray*>& GetArrayMap() const
255  {
256  return this->ArrayMap;
257  }
258  std::map<vtkAbstractArray*, vtkAbstractArray*>& GetArrayMap() { return this->ArrayMap; }
259 
264  const std::map<vtkCellAttribute*, vtkCellAttribute*>& GetAttributeMap() const
265  {
266  return this->AttributeMap;
267  }
268  std::map<vtkCellAttribute*, vtkCellAttribute*>& GetAttributeMap() { return this->AttributeMap; }
269 
271 
278 
288  void CopyAttributeArrays(vtkCellAttribute* srcAtt, vtkStringToken cellType);
289 
301  vtkCellAttribute* CopyOrUpdateAttributeRecord(vtkCellAttribute* srcAtt, vtkStringToken cellType);
302 
304 
305 protected:
306  vtkCellGridCopyQuery() = default;
307  ~vtkCellGridCopyQuery() override;
308 
309  vtkCellGrid* Source{ nullptr };
310  vtkCellGrid* Target{ nullptr };
311  std::set<int> CellAttributeIds;
312  std::map<vtkAbstractArray*, vtkAbstractArray*> ArrayMap;
313  std::map<vtkCellAttribute*, vtkCellAttribute*> AttributeMap;
314  int CopyCellTypes{ 1 };
315  int CopyCells{ 1 };
316  int CopyOnlyShape{ 1 };
317  int CopyArrays{ 1 };
318  int CopyArrayValues{ 1 };
319  int DeepCopyArrays{ 0 };
320  int CopySchema{ 1 };
321 
322 private:
324  void operator=(const vtkCellGridCopyQuery&) = delete;
325 };
326 
327 VTK_ABI_NAMESPACE_END
328 #endif // vtkCellGridCopyQuery_h
const std::set< int > & GetCellAttributeIds() const
Return the set of attribute IDs scheduled to be copied when the query is run.
Perform an operation on cells in a vtkCellMetadata instance.
std::map< vtkCellAttribute *, vtkCellAttribute * > & GetAttributeMap()
Return the map from source to target arrays.
Copy the cell metadata and attribute(s) of one cell-grid into another.
Abstract superclass for all arrays.
std::map< vtkCellAttribute *, vtkCellAttribute * > AttributeMap
virtual bool Finalize()
Override this if your query-result state requires finalization.
Visualization data composed of cells of arbitrary type.
Definition: vtkCellGrid.h:48
a simple class to control print indentation
Definition: vtkIndent.h:28
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
A function defined over the physical domain of a vtkCellGrid.
list of point or cell ids
Definition: vtkIdList.h:25
std::set< int > CellAttributeIds
std::map< vtkAbstractArray *, vtkAbstractArray * > ArrayMap
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
const std::map< vtkAbstractArray *, vtkAbstractArray * > & GetArrayMap() const
Return the map from source to target arrays.
Represent a string by its integer hash.
std::map< vtkAbstractArray *, vtkAbstractArray * > & GetArrayMap()
Return the map from source to target arrays.
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
const std::map< vtkCellAttribute *, vtkCellAttribute * > & GetAttributeMap() const
Return the map from source to target cell-attributes.
virtual bool Initialize()
Override this if your query-result state requires initialization.