File: vtkPeriodicFilter.h

package info (click to toggle)
vtk6 6.3.0%2Bdfsg1-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 118,532 kB
  • ctags: 138,251
  • sloc: cpp: 1,443,749; ansic: 113,395; python: 72,383; tcl: 46,998; xml: 8,127; yacc: 4,525; java: 4,239; perl: 3,108; lex: 1,694; sh: 1,093; asm: 471; makefile: 95; objc: 17
file content (124 lines) | stat: -rw-r--r-- 4,652 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkPeriodicFiler.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.

=========================================================================*/

// .NAME vtkPeriodicFilter - A filter to produce mapped  periodic
// multiblock dataset from a single block
//
// .SECTION Description:
// Generate periodic dataset by transforming points, vectors, tensors
// data arrays from an original data array.
// The generated dataset is of the same type than the input (float or double).
// This is an abstract class wich do not implement the actual transformation.
// Point coordinates are transformed, as well as all vectors (3-components) and
// tensors (9 components) in points and cell data arrays.
// The generated multiblock will have the same tree architecture than the input,
// except transformed leaves are replaced by a vtkMultipieceDataSet.
// Supported input leaf dataset type are: vtkPolyData, vtkStructuredGrid
// and vtkUnstructuredGrid. Other data objects are transformed using the
// transform filter (at a high cost!).

#ifndef vtkPeriodicFilter_h
#define vtkPeriodicFilter_h

#include "vtkFiltersParallelModule.h" // For export macro
#include "vtkMultiBlockDataSetAlgorithm.h"

#include <set> // For block selection
#include <vector> // For pieces number

class vtkCompositeDataIterator;
class vtkCompositeDataSet;
class vtkDataObjectTreeIterator;
class vtkMultiPieceDataSet;

#define VTK_ITERATION_MODE_DIRECT_NB 0    // Generate a user-provided number of periods
#define VTK_ITERATION_MODE_MAX       1    // Generate a maximum of periods, i.e. a full period.

class VTKFILTERSPARALLEL_EXPORT vtkPeriodicFilter : public vtkMultiBlockDataSetAlgorithm
{
public:
  vtkTypeMacro(vtkPeriodicFilter, vtkMultiBlockDataSetAlgorithm);
  void PrintSelf(ostream& os, vtkIndent indent);

  // Description:
  // Set/Get Iteration mode.
  // VTK_ITERATION_MODE_DIRECT_NB to specify the number of periods,
  // VTK_ITERATION_MODE_MAX to generate a full period (default).
  vtkSetClampMacro(IterationMode, int,
                   VTK_ITERATION_MODE_DIRECT_NB,
                   VTK_ITERATION_MODE_MAX);
  vtkGetMacro(IterationMode, int);
  void SetIterationModeToDirectNb()
    { this->SetIterationMode(VTK_ITERATION_MODE_DIRECT_NB); }
  void SetIterationModeToMax()
    { this->SetIterationMode(VTK_ITERATION_MODE_MAX); }

  // Description:
  // Set/Get Number of periods.
  // Used only with ITERATION_MODE_DIRECT_NB.
  vtkSetMacro(NumberOfPeriods, int);
  vtkGetMacro(NumberOfPeriods, int);

  // Description:
  // Select the periodic pieces indices.
  // Each node in the multi - block tree is identified by an \c index. The index can
  // be obtained by performing a preorder traversal of the tree (including empty
  // nodes). eg. A(B (D, E), C(F, G)).
  // Inorder traversal yields: A, B, D, E, C, F, G
  // Index of A is 0, while index of C is 4.
  virtual void AddIndex(unsigned int index);

  // Description:
  // Remove an index from selected indices tress
  virtual void RemoveIndex(unsigned int index);

  // Description:
  // Clear selected indices tree
  virtual void RemoveAllIndices();

protected:
  vtkPeriodicFilter();
  ~vtkPeriodicFilter();

  virtual int RequestData(vtkInformation *,
                          vtkInformationVector **,
                          vtkInformationVector *);

  // Description:
  // Create a periodic data, leaf of the tree
  virtual void CreatePeriodicDataSet(vtkCompositeDataIterator* loc,
                                     vtkCompositeDataSet* output,
                                     vtkCompositeDataSet* input) = 0;

  // Description:
  // Manually set the number of period on a specific leaf
  virtual void SetPeriodNumber(vtkCompositeDataIterator* loc,
                               vtkCompositeDataSet* output,
                               int nbPeriod) = 0;

  std::vector<int> PeriodNumbers;     // Periods numbers by leaf
  bool ReducePeriodNumbers;

private:
  vtkPeriodicFilter(const vtkPeriodicFilter&); // Not implemented.
  void operator=(const vtkPeriodicFilter&); // Not implemented.

  int IterationMode;
  int NumberOfPeriods;      // User provided number of periods

  std::set<vtkIdType> Indices;          // Selected indices
};

#endif