VTK  9.7.1
vtkAppendPolyData.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
30 #ifndef vtkAppendPolyData_h
31 #define vtkAppendPolyData_h
32 
33 #include "vtkFiltersCoreModule.h" // For export macro
34 #include "vtkPolyDataAlgorithm.h"
35 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
36 
37 VTK_ABI_NAMESPACE_BEGIN
38 class vtkCellArray;
39 class vtkDataArray;
40 class vtkPoints;
41 class vtkPolyData;
42 
43 class VTKFILTERSCORE_EXPORT VTK_MARSHALAUTO vtkAppendPolyData : public vtkPolyDataAlgorithm
44 {
45 public:
46  static vtkAppendPolyData* New();
47 
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50 
52 
58  vtkSetMacro(UserManagedInputs, vtkTypeBool);
59  vtkGetMacro(UserManagedInputs, vtkTypeBool);
60  vtkBooleanMacro(UserManagedInputs, vtkTypeBool);
62 
64 
70  vtkGetMacro(UseImplicitArray, bool);
71  vtkSetMacro(UseImplicitArray, bool);
72  vtkBooleanMacro(UseImplicitArray, bool);
74 
80 
85  void RemoveInputData(vtkPolyData*);
86 
88 
91  vtkPolyData* GetInput(int idx);
92  vtkPolyData* GetInput() { return this->GetInput(0); }
94 
99  void SetNumberOfInputs(int num);
100 
101  // Set Nth input, should only be used when UserManagedInputs is true.
102  void SetInputConnectionByNumber(int num, vtkAlgorithmOutput* input);
103  void SetInputDataByNumber(int num, vtkPolyData* ds);
104 
106 
116  vtkSetMacro(ParallelStreaming, vtkTypeBool);
117  vtkGetMacro(ParallelStreaming, vtkTypeBool);
118  vtkBooleanMacro(ParallelStreaming, vtkTypeBool);
120 
122 
127  vtkSetMacro(OutputPointsPrecision, int);
128  vtkGetMacro(OutputPointsPrecision, int);
130 
131  int ExecuteAppend(vtkPolyData* output, vtkPolyData* inputs[], int numInputs)
132  VTK_SIZEHINT(inputs, numInputs);
133 
146  {
147  PolyDataOffsets(const std::vector<vtkPolyData*>& datasets);
148 
149  vtkIdType TotalNumberOfPoints = 0;
150  vtkIdType TotalNumberOfCells = 0;
151  vtkIdType TotalNumberOfVerts = 0;
152  vtkIdType TotalNumberOfVertsConnectivity = 0;
153  vtkIdType TotalNumberOfLines = 0;
154  vtkIdType TotalNumberOfLinesConnectivity = 0;
155  vtkIdType TotalNumberOfPolys = 0;
156  vtkIdType TotalNumberOfPolysConnectivity = 0;
157  vtkIdType TotalNumberOfStrips = 0;
158  vtkIdType TotalNumberOfStripsConnectivity = 0;
159  std::vector<vtkIdType> PointOffsets;
160  std::vector<vtkIdType> VertOffsets;
161  std::vector<vtkIdType> VertConnectivityOffsets;
162  std::vector<vtkIdType> LineOffsets;
163  std::vector<vtkIdType> LineConnectivityOffsets;
164  std::vector<vtkIdType> PolyOffsets;
165  std::vector<vtkIdType> PolyConnectivityOffsets;
166  std::vector<vtkIdType> StripOffsets;
167  std::vector<vtkIdType> StripConnectivityOffsets;
168  };
169 
170  static void AppendCellData(const PolyDataOffsets& stats, const std::vector<vtkPolyData*>& inputs,
171  vtkPolyData* output, bool useImplicit);
172 
173 protected:
175  ~vtkAppendPolyData() override;
176 
177  // Flag for selecting parallel streaming behavior
180 
181  // Usual data generation method
184  int FillInputPortInformation(int, vtkInformation*) override;
185 
186 private:
187  // hide the superclass' AddInput() from the user and the compiler
189  {
190  vtkErrorMacro(<< "AddInput() must be called with a vtkPolyData not a vtkDataObject.");
191  }
192 
196  void AppendPoints(
197  const PolyDataOffsets& stats, const std::vector<vtkPolyData*>& inputs, vtkPolyData* output);
198 
203  void AppendCells(
204  const PolyDataOffsets& stats, const std::vector<vtkPolyData*>& inputs, vtkPolyData* output);
205 
206  vtkTypeBool UserManagedInputs;
207 
208  bool UseImplicitArray = false;
209 
210  vtkAppendPolyData(const vtkAppendPolyData&) = delete;
211  void operator=(const vtkAppendPolyData&) = delete;
212 };
213 
214 VTK_ABI_NAMESPACE_END
215 #endif
std::vector< vtkIdType > PointOffsets
Store vtkAlgorithm input/output information.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
vtkTypeBool ParallelStreaming
std::vector< vtkIdType > LineConnectivityOffsets
std::vector< vtkIdType > PolyOffsets
void AddInputData(vtkDataObject *)
Assign a data object as input.
std::vector< vtkIdType > VertOffsets
int vtkIdType
Definition: vtkType.h:363
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
std::vector< vtkIdType > StripConnectivityOffsets
Proxy object to connect input/output ports.
static vtkPolyDataAlgorithm * New()
int vtkTypeBool
Definition: vtkABI.h:64
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
Superclass for algorithms that produce only polydata as output.
vtkPolyData * GetInput()
Get any input of this filter.
a simple class to control print indentation
Definition: vtkIndent.h:28
appends one or more polygonal datasets together
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
std::vector< vtkIdType > VertConnectivityOffsets
#define VTK_SIZEHINT(...)
vtkDataObject * GetInput()
object to represent cell connectivity
Definition: vtkCellArray.h:177
std::vector< vtkIdType > StripOffsets
std::vector< vtkIdType > PolyConnectivityOffsets
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
Store zero or more vtkInformation instances.
#define VTK_MARSHALAUTO
std::vector< vtkIdType > LineOffsets
general representation of visualization data
Definition: vtkDataObject.h:55
PolyDataOffsets agregates cell array information from the input polydata list.
represent and manipulate 3D points
Definition: vtkPoints.h:30
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.