vtkAppendCompositeDataLeaves.h 5.35 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkAppendCompositeDataLeaves.h

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
/**
 * @class   vtkAppendCompositeDataLeaves
 * @brief   appends one or more composite datasets with the same structure together into a single output composite dataset
 *
 * vtkAppendCompositeDataLeaves is a filter that takes input composite datasets with the same
 * structure: (1) the same number of entries and -- if any children are composites -- the
 * same constraint holds from them; and (2) the same type of dataset at each position.
 * It then creates an output dataset with the same structure whose leaves contain all the
 * cells from the datasets at the corresponding leaves of the input datasets.
 *
 * Currently, this filter only supports "appending" of a few types for the leaf
 * nodes and the logic used for each supported data type is as follows:
 *
 * \li vtkUnstructuredGrid - appends all unstructured grids from the leaf
 *     location on all inputs into a single unstructured grid for the
 *     corresponding location in the output composite dataset. PointData and
 *     CellData arrays are extracted and appended only if they are available in
 *     all datasets.(For example, if one dataset has scalars but another does
 *     not, scalars will not be appended.)
 *
 * \li vtkPolyData - appends all polydatas from the leaf location on all inputs
 *     into a single polydata for the corresponding location in the output
 *     composite dataset. PointData and CellData arrays are extracted and
 *     appended only if they are available in all datasets.(For example, if one
 *     dataset has scalars but another does not, scalars will not be appended.)
 *
 * \li vtkImageData/vtkUniformGrid - simply passes the first non-null
 *     grid for a particular location to corresponding location in the output.
 *
 * \li vtkTable - simply passes the first non-null vtkTable for a particular
 *     location to the corresponding location in the output.
 *
 * Other types of leaf datasets will be ignored and their positions in the
48
 * output dataset will be nullptr pointers.
49 50 51 52
 *
 * @sa
 * vtkAppendPolyData vtkAppendFilter
*/
53

54 55
#ifndef vtkAppendCompositeDataLeaves_h
#define vtkAppendCompositeDataLeaves_h
56

57
#include "vtkFiltersCoreModule.h" // For export macro
58 59 60 61 62
#include "vtkCompositeDataSetAlgorithm.h"

class vtkCompositeDataIterator;
class vtkDataSet;

63
class VTKFILTERSCORE_EXPORT vtkAppendCompositeDataLeaves : public vtkCompositeDataSetAlgorithm
64 65 66 67
{
public:
  static vtkAppendCompositeDataLeaves* New();

68
  vtkTypeMacro(vtkAppendCompositeDataLeaves,vtkCompositeDataSetAlgorithm);
69
  void PrintSelf( ostream& os, vtkIndent indent ) override;
70

71 72 73 74 75 76
  //@{
  /**
   * Set/get whether the field data of each dataset in the composite dataset is copied to the output.
   * If AppendFieldData is non-zero, then field data arrays from all the inputs are added
   * to the output. If there are duplicates, the array on the first input encountered is taken.
   */
77 78 79
  vtkSetMacro(AppendFieldData,vtkTypeBool);
  vtkGetMacro(AppendFieldData,vtkTypeBool);
  vtkBooleanMacro(AppendFieldData,vtkTypeBool);
80
  //@}
81 82 83

protected:
  vtkAppendCompositeDataLeaves();
84
  ~vtkAppendCompositeDataLeaves() override;
85

86 87 88 89
  /**
   * Since vtkCompositeDataSet is an abstract class and we output the same types as the input,
   * we must override the default implementation.
   */
90
  int RequestDataObject( vtkInformation*, vtkInformationVector**, vtkInformationVector* ) override;
91

92 93 94
  /**
   * Iterates over the datasets and appends corresponding notes.
   */
95
  int RequestData( vtkInformation*, vtkInformationVector**, vtkInformationVector* ) override;
96

97 98 99
  /**
   * The input is repeatable, so we override the default implementation.
   */
100
  int FillInputPortInformation( int port, vtkInformation* info ) override;
101

102 103 104
  /**
   * When leaf nodes are unstructured grids, this uses a vtkAppendFilter to merge them.
   */
105 106
  virtual void AppendUnstructuredGrids(vtkInformationVector* inputVector,
    int i, int numInputs, vtkCompositeDataIterator* iter, vtkCompositeDataSet* output );
107

108 109 110
  /**
   * When leaf nodes are polydata, this uses a vtkAppendPolyData to merge them.
   */
111 112
  virtual void AppendPolyData(vtkInformationVector* inputVector,
    int i, int numInputs, vtkCompositeDataIterator* iter, vtkCompositeDataSet* output );
113

114 115 116 117 118 119
  /**
   * Both AppendUnstructuredGrids and AppendPolyData call AppendFieldDataArrays. If
   * AppendFieldData is non-zero, then field data arrays from all the inputs are added
   * to the output. If there are duplicates, the array on the first input encountered
   * is taken.
   */
120 121
  virtual void AppendFieldDataArrays(vtkInformationVector* inputVector,
    int i, int numInputs, vtkCompositeDataIterator* iter, vtkDataSet* dset );
122

123
  vtkTypeBool AppendFieldData;
124 125

private:
126 127
  vtkAppendCompositeDataLeaves ( const vtkAppendCompositeDataLeaves& ) = delete;
  void operator = ( const vtkAppendCompositeDataLeaves& ) = delete;
128 129
};

130
#endif // vtkAppendCompositeDataLeaves_h