]> SALOME platform Git repositories - tools/paravisaddons_common.git/blob - src/CellDataContour/plugin/CellDataContourModule/vtkMyCellDataToPointData.h
Salome HOME
initial commit from paravisaddons
[tools/paravisaddons_common.git] / src / CellDataContour / plugin / CellDataContourModule / vtkMyCellDataToPointData.h
1 // Copyright (C) 2021  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 /*=========================================================================
21
22   Program:   Visualization Toolkit
23   Module:    vtkMyCellDataToPointData.h
24
25   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
26   All rights reserved.
27   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
28
29      This software is distributed WITHOUT ANY WARRANTY; without even
30      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
31      PURPOSE.  See the above copyright notice for more information.
32
33 =========================================================================*/
34 /**
35  * @class   vtkMyCellDataToPointData
36  * @brief   map cell data to point data
37  *
38  * vtkMyCellDataToPointData is a filter that transforms cell data (i.e., data
39  * specified per cell) into point data (i.e., data specified at cell
40  * points). The method of transformation is based on averaging the data
41  * values of all cells using a particular point. For large datasets with
42  * several cell data arrays, the filter optionally supports selective
43  * processing to speed up processing. Optionally, the input cell data can
44  * be passed through to the output as well.
45  * Unstructured grids and polydata can have cells of different dimensions.
46  * To handle different use cases in this situation, the user can specify
47  * which cells contribute to the computation. The options for this are
48  * All (default), Patch and DataSetMax. Patch uses only the highest dimension
49  * cells attached to a point. DataSetMax uses the highest cell dimension in
50  * the entire data set.
51  *
52  * @warning
53  * This filter is an abstract filter, that is, the output is an abstract type
54  * (i.e., vtkDataSet). Use the convenience methods (e.g.,
55  * GetPolyDataOutput(), GetStructuredPointsOutput(), etc.) to get the type
56  * of output you want.
57  *
58  * @sa
59  * vtkPointData vtkCellData vtkPointDataToCellData
60 */
61
62 #ifndef vtkMyCellDataToPointData_h
63 #define vtkMyCellDataToPointData_h
64
65 #include <vtkDataSetAlgorithm.h>
66
67 class vtkDataSet;
68
69 class VTK_EXPORT vtkMyCellDataToPointData : public vtkDataSetAlgorithm
70 {
71 public:
72   static vtkMyCellDataToPointData *New();
73   vtkTypeMacro(vtkMyCellDataToPointData,vtkDataSetAlgorithm);
74   void PrintSelf(ostream& os, vtkIndent indent) override;
75
76   /// Options to choose what cells contribute to the calculation
77   enum ContributingCellEnum {
78     All=0,        //!< All cells
79     Patch=1,      //!< Highest dimension cells in the patch of cells contributing to the calculation
80     DataSetMax=2  //!< Highest dimension cells in the data set
81   };
82
83   //@{
84   /**
85    * Control whether the input cell data is to be passed to the output. If
86    * on, then the input cell data is passed through to the output; otherwise,
87    * only generated point data is placed into the output.
88    */
89   vtkSetMacro(PassCellData, bool);
90   vtkGetMacro(PassCellData, bool);
91   vtkBooleanMacro(PassCellData, bool);
92   //@}
93
94   //@{
95   /**
96    * Option to specify what cells to include in the gradient computation.
97    * Options are all cells (All, Patch and DataSetMax). The default is All.
98    */
99   vtkSetClampMacro(ContributingCellOption, int, 0, 2);
100   vtkGetMacro(ContributingCellOption, int);
101   //@}
102
103   //@{
104   /**
105    * Activate selective processing of arrays. If inactive, only arrays selected
106    * by the user will be considered by this filter. The default is true.
107    */
108   vtkSetMacro(ProcessAllArrays, bool);
109   vtkGetMacro(ProcessAllArrays, bool);
110   vtkBooleanMacro(ProcessAllArrays, bool);
111   //@}
112
113   /**
114    * Adds an array to be processed. This only has an effect if the
115    * ProcessAllArrays option is turned off. If a name is already present,
116    * nothing happens.
117    */
118   virtual void AddCellDataArray(const char *name);
119
120   /**
121    * Removes an array to be processed. This only has an effect if the
122    * ProcessAllArrays option is turned off. If the specified name is not
123    * present, nothing happens.
124    */
125   virtual void RemoveCellDataArray(const char *name);
126
127   /**
128    * Removes all arrays to be processed from the list. This only has an effect
129    * if the ProcessAllArrays option is turned off.
130    */
131   virtual void ClearCellDataArrays();
132
133 protected:
134   vtkMyCellDataToPointData();
135   ~vtkMyCellDataToPointData() override;
136
137   int RequestData(vtkInformation* request,
138                   vtkInformationVector** inputVector,
139                   vtkInformationVector* outputVector) override;
140
141   //@{
142   /**
143    * Special algorithm for unstructured grids and polydata to make sure
144    * that we properly take into account ContributingCellOption.
145    */
146   int RequestDataForUnstructuredData
147     (vtkInformation*, vtkInformationVector**, vtkInformationVector*);
148   //@}
149
150   int InterpolatePointData(vtkDataSet *input, vtkDataSet *output);
151
152   //@{
153   /**
154    * Option to pass cell data arrays through to the output. Default is 0/off.
155    */
156   bool PassCellData;
157   //@}
158
159   //@{
160   /**
161    * Option to specify what cells to include in the computation.
162    * Options are all cells (All, Patch and DataSet). The default is All.
163    */
164   int ContributingCellOption;
165   //@}
166
167   /**
168    * Option to activate selective processing of arrays.
169    */
170   bool ProcessAllArrays;
171
172   class Internals;
173   Internals *Implementation;
174
175 private:
176   vtkMyCellDataToPointData(const vtkMyCellDataToPointData&) = delete;
177   void operator=(const vtkMyCellDataToPointData&) = delete;
178 };
179
180 #endif
181
182