1 // Copyright (C) 2021 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 /*=========================================================================
22 Program: Visualization Toolkit
23 Module: vtkMyCellDataToPointData.h
25 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
27 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
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.
33 =========================================================================*/
35 * @class vtkMyCellDataToPointData
36 * @brief map cell data to point data
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.
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
59 * vtkPointData vtkCellData vtkPointDataToCellData
62 #ifndef vtkMyCellDataToPointData_h
63 #define vtkMyCellDataToPointData_h
65 #include <vtkDataSetAlgorithm.h>
69 class VTK_EXPORT vtkMyCellDataToPointData : public vtkDataSetAlgorithm
72 static vtkMyCellDataToPointData *New();
73 vtkTypeMacro(vtkMyCellDataToPointData,vtkDataSetAlgorithm);
74 void PrintSelf(ostream& os, vtkIndent indent) override;
76 /// Options to choose what cells contribute to the calculation
77 enum ContributingCellEnum {
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
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.
89 vtkSetMacro(PassCellData, bool);
90 vtkGetMacro(PassCellData, bool);
91 vtkBooleanMacro(PassCellData, bool);
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.
99 vtkSetClampMacro(ContributingCellOption, int, 0, 2);
100 vtkGetMacro(ContributingCellOption, int);
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.
108 vtkSetMacro(ProcessAllArrays, bool);
109 vtkGetMacro(ProcessAllArrays, bool);
110 vtkBooleanMacro(ProcessAllArrays, bool);
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,
118 virtual void AddCellDataArray(const char *name);
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.
125 virtual void RemoveCellDataArray(const char *name);
128 * Removes all arrays to be processed from the list. This only has an effect
129 * if the ProcessAllArrays option is turned off.
131 virtual void ClearCellDataArrays();
134 vtkMyCellDataToPointData();
135 ~vtkMyCellDataToPointData() override;
137 int RequestData(vtkInformation* request,
138 vtkInformationVector** inputVector,
139 vtkInformationVector* outputVector) override;
143 * Special algorithm for unstructured grids and polydata to make sure
144 * that we properly take into account ContributingCellOption.
146 int RequestDataForUnstructuredData
147 (vtkInformation*, vtkInformationVector**, vtkInformationVector*);
150 int InterpolatePointData(vtkDataSet *input, vtkDataSet *output);
154 * Option to pass cell data arrays through to the output. Default is 0/off.
161 * Option to specify what cells to include in the computation.
162 * Options are all cells (All, Patch and DataSet). The default is All.
164 int ContributingCellOption;
168 * Option to activate selective processing of arrays.
170 bool ProcessAllArrays;
173 Internals *Implementation;
176 vtkMyCellDataToPointData(const vtkMyCellDataToPointData&) = delete;
177 void operator=(const vtkMyCellDataToPointData&) = delete;