VTK  9.5.20251216
vtkGenerateStatistics.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2// SPDX-FileCopyrightText: Copyright 2025 Sandia Corporation
3// SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
51
52#ifndef vtkGenerateStatistics_h
53#define vtkGenerateStatistics_h
54
55#include "vtkFiltersParallelStatisticsModule.h" //needed for exports
57
58#include <memory>
59#include <unordered_map>
60#include <vector>
61
62VTK_ABI_NAMESPACE_BEGIN
63
65class vtkDataObjectToTable;
66class vtkFieldData;
70class vtkCellGrid;
71class vtkDataSet;
72class vtkGraph;
73class vtkTable;
76class vtkStatisticsAccumulator;
80
81class VTKFILTERSPARALLELSTATISTICS_EXPORT vtkGenerateStatistics
83{
84public:
87 void PrintSelf(ostream& os, vtkIndent indent) override;
88
90
96 vtkGetMacro(AttributeMode, int);
97 vtkSetMacro(AttributeMode, int);
99
104
108 const char* GetAttributeArrayName(int nn);
109
113 int GetAttributeArrayStatus(const char* arrName);
114
116
119 void EnableAttributeArray(const char* arrName);
122
124
140 vtkSetClampMacro(TrainingFraction, double, 0.0, 1.0);
141 vtkGetMacro(TrainingFraction, double);
143
145
151
153
159
171
177 vtkBooleanMacro(SingleModel, vtkTypeBool);
179
180protected:
183
184 int FillInputPortInformation(int port, vtkInformation* info) override;
185 // int FillOutputPortInformation(int port, vtkInformation* info) override;
186
188 vtkInformation* request, vtkInformationVector** input, vtkInformationVector* output) override;
189
199
206 vtkDataObject* dataObject, vtkPartitionedDataSetCollection* modelTree);
207
214
227
237
248
255
262 void GenerateSubset(std::unordered_map<vtkIdType, vtkIdType>& subset, vtkIdType numberOfTuples,
263 double trainingFraction, vtkUnsignedCharArray* ghostMarks, unsigned char ghostMask);
264
266 std::unordered_map<vtkIdType, std::unordered_map<vtkIdType, double>>;
272 void ComputeCellToPointWeights(PointsOfCellsWeightMap& cellToPointsToWeights, vtkDataSet* dataSet,
273 const std::unordered_map<vtkIdType, vtkIdType>& subset);
274
281 std::unordered_map<vtkIdType, std::unordered_map<vtkIdType, double>>& edgesToVertsToWeights,
282 vtkGraph* graph, const std::unordered_map<vtkIdType, vtkIdType>& subset);
283
288 const std::unordered_map<vtkIdType, vtkIdType>& subset);
289
294 vtkDataSet* data, const std::unordered_map<vtkIdType, vtkIdType>& subset,
295 const PointsOfCellsWeightMap& cellsToPointsToWeights);
296
298 vtkGraph* data, const std::unordered_map<vtkIdType, vtkIdType>& subset,
299 const std::unordered_map<vtkIdType, std::unordered_map<vtkIdType, double>>&
300 edgesToVertsToWeights);
301
303 vtkDataObject* data, const std::unordered_map<vtkIdType, vtkIdType>& subset,
304 vtkIdType numberOfSamples);
305
312
320
323
328 std::unique_ptr<vtkStatisticsAlgorithmPrivate> P;
331
332private:
333 // This class is internal so it can access protected data.
334 class StatisticsAccumulator;
335
337 void operator=(const vtkGenerateStatistics&) = delete;
338};
339
340VTK_ABI_NAMESPACE_END
341
342#endif // vtkGenerateStatistics_h
Visualization data composed of cells of arbitrary type.
Definition vtkCellGrid.h:49
abstract superclass for composite (multi-block or AMR) datasets
general representation of visualization data
abstract class to specify dataset behavior
Definition vtkDataSet.h:166
Represents and manipulates a collection of data arrays.
int RequestDataPlain(vtkDataObject *dataObject, vtkStatisticalModel *model)
Populate model with the statistics of a "plain" data object, dataObject.
virtual vtkIdType GetNumberOfObservationsForTraining(vtkIdType N)
Subclasses may (but need not) override this function to guarantee that some minimum number of observa...
int RequestData(vtkInformation *request, vtkInformationVector **input, vtkInformationVector *output) override
Methods for subclasses to override to handle different pipeline requests.
static vtkGenerateStatistics * New()
std::unordered_map< vtkIdType, std::unordered_map< vtkIdType, double > > PointsOfCellsWeightMap
void ComputeCellToPointWeights(PointsOfCellsWeightMap &cellToPointsToWeights, vtkDataSet *dataSet, const std::unordered_map< vtkIdType, vtkIdType > &subset)
Given a vtkDataSet, compute weights for each point of each cell in subset (or all cells if subset is ...
int MergeModelTrees(vtkPartitionedDataSetCollection *other, vtkPartitionedDataSetCollection *target)
Merge all the models from other into target.
int RequestDataCellGrid(vtkCellGrid *cellGrid, vtkStatisticalModel *model)
Populate model with the statistics of a cell-grid, cellGrid.
void ShallowCopy(vtkDataObject *out, vtkDataObject *in)
A variant of shallow copy that calls vtkDataObject::ShallowCopy() and then for composite datasets,...
void PrepareAlgorithmRequests(const std::vector< vtkSmartPointer< vtkAbstractArray > > &columns)
This method translates input-array specifications made on vtkGenerateStatistics into requests on its ...
vtkSmartPointer< vtkAbstractArray > FieldDataToSamples(vtkSmartPointer< vtkAbstractArray > fullArray, vtkDataObject *data, const std::unordered_map< vtkIdType, vtkIdType > &subset, vtkIdType numberOfSamples)
void ComputeEdgeToVertexWeights(std::unordered_map< vtkIdType, std::unordered_map< vtkIdType, double > > &edgesToVertsToWeights, vtkGraph *graph, const std::unordered_map< vtkIdType, vtkIdType > &subset)
Given a vtkGraph, compute weights for each vertex of each edge in subset (or all edges if subset is e...
int MergeRemoteModels(vtkPartitionedDataSetCollection *modelTree)
Communicate with other ranks to merge all remote models into modelTree.
int RequestDataPDC(vtkPartitionedDataSetCollection *pdc, vtkPartitionedDataSetCollection *modelTree)
Populate model with the statistics of a partitioned dataset collection, \ a pdc.
std::unique_ptr< vtkStatisticsAlgorithmPrivate > P
vtkMultiProcessController * Controller
vtkSmartPointer< vtkAbstractArray > CellToPointSamples(vtkSmartPointer< vtkAbstractArray > fullArray, vtkDataSet *data, const std::unordered_map< vtkIdType, vtkIdType > &subset, const PointsOfCellsWeightMap &cellsToPointsToWeights)
Resample a cell array to points.
void GenerateSubset(std::unordered_map< vtkIdType, vtkIdType > &subset, vtkIdType numberOfTuples, double trainingFraction, vtkUnsignedCharArray *ghostMarks, unsigned char ghostMask)
Generate a subset of IDs according to the training fraction and ghost markings.
int RequestDataAMR(vtkUniformGridAMR *amr, vtkPartitionedDataSetCollection *modelTree)
Populate model with the statistics of a uniform-grid AMR dataset, amr.
void ClearAttributeArrays()
An alternate interface for preparing a selection of arrays to process.
int RequestLocalDataDispatch(vtkDataObject *dataObject, vtkPartitionedDataSetCollection *modelTree)
Determine the type of dataObject and call the matching variant below.
void TranslateRequests(vtkDataObject *data)
Translate requests from field names to "field_component" names for vector/tensor fields.
virtual void SetController(vtkMultiProcessController *)
Get/Set the multiprocess controller.
void EnableAttributeArray(const char *arrName)
An alternate interface for preparing a selection of arrays to process.
~vtkGenerateStatistics() override
const char * GetAttributeArrayName(int nn)
Get the name of the nn-th array ffor the current value of AttributeMode.
vtkStatisticsAlgorithm * StatisticsAlgorithm
int RequestDataNonComposite(vtkDataObject *dataObject, vtkStatisticalModel *model)
Determine the type of non-composite dataObject and call the matching variant below.
int GetNumberOfAttributeArrays()
Return the number of columns available for the current value of AttributeMode.
vtkSmartPointer< vtkAbstractArray > SubsetArray(vtkSmartPointer< vtkAbstractArray > fullArray, const std::unordered_map< vtkIdType, vtkIdType > &subset)
Return the array itself or a subset as specified.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
virtual void SetStatisticsAlgorithm(vtkStatisticsAlgorithm *)
Get/set the statistics filter used to create a model of the data.
int ComputeDerivedData(vtkPartitionedDataSetCollection *modelTree)
Once remote model(s) have been merged, derived information is computed on all ranks.
vtkSmartPointer< vtkAbstractArray > EdgeToVertexSamples(vtkSmartPointer< vtkAbstractArray > fullArray, vtkGraph *data, const std::unordered_map< vtkIdType, vtkIdType > &subset, const std::unordered_map< vtkIdType, std::unordered_map< vtkIdType, double > > &edgesToVertsToWeights)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int RequestDataPD(vtkPartitionedDataSet *pd, vtkStatisticalModel *model)
Populate model with the statistics of a partitioned dataset, \ a pd.
int GetAttributeArrayStatus(const char *arrName)
Get the status of the specified array (i.e., whether or not it is a column of interest).
Base class for graph data types.
Definition vtkGraph.h:342
a simple class to control print indentation
Definition vtkIndent.h:108
Key for integer values in vtkInformation.
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Multiprocessing communication superclass.
Composite dataset that groups datasets as a collection.
composite dataset to encapsulates a dataset consisting of partitions.
Hold a reference to a vtkObjectBase instance.
a base class for statistical modeling of other data
Base class for statistics algorithms.
A table, which contains similar-typed columns of data.
Definition vtkTable.h:169
Legacy, empty shell inheriting vtkAMRDataObject.
dynamic, self-adjusting array of unsigned char
int vtkTypeBool
Definition vtkABI.h:64
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
int vtkIdType
Definition vtkType.h:368