File: vtkPartitionedDataSetSource.h

package info (click to toggle)
vtk9 9.5.2%2Bdfsg3-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 205,916 kB
  • sloc: cpp: 2,336,565; ansic: 327,116; python: 111,200; yacc: 4,104; java: 3,977; sh: 3,032; xml: 2,771; perl: 2,189; lex: 1,787; makefile: 178; javascript: 165; objc: 153; tcl: 59
file content (100 lines) | stat: -rw-r--r-- 3,249 bytes parent folder | download | duplicates (6)
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
// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
// SPDX-License-Identifier: BSD-3-Clause
/**
 * @class vtkPartitionedDataSetSource
 * @brief a source that produces a vtkPartitionedDataSet.
 *
 * vtkPartitionedDataSetSource generates a vtkPartitionedDataSet which is
 * composed of partitions of a given vtkParametricFunction.
 * The resulting partitioned dataset is split among ranks in an even fashion
 * by default.
 *
 * The user can pass the parametric function to be used using SetParametricFunction.
 * Otherwise it will default to vtkParametricKlein as its Parametric function.
 *
 * The partitioning scheme for the produced vtkPartitionedDataSet can be controlled
 * with the methods: SetNumberOfPartitiones, EnableRank, DisableRank, EnableAllRanks,
 * DisableAllRanks.
 *
 * @see vtkParametricFunction
 * @see vtkPartitionedDataSet
 */

#ifndef vtkPartitionedDataSetSource_h
#define vtkPartitionedDataSetSource_h

#include "vtkFiltersSourcesModule.h" // For export macro
#include "vtkPartitionedDataSetAlgorithm.h"

#include <map> // For std::map

VTK_ABI_NAMESPACE_BEGIN
class vtkParametricFunction;
class vtkPartitionedDataSet;

class VTKFILTERSSOURCES_EXPORT vtkPartitionedDataSetSource : public vtkPartitionedDataSetAlgorithm
{
public:
  static vtkPartitionedDataSetSource* New();
  vtkTypeMacro(vtkPartitionedDataSetSource, vtkPartitionedDataSetAlgorithm);
  void PrintSelf(ostream& os, vtkIndent indent) override;

  ///@{
  /**
   * Enable/Disable ranks.
   *
   * By default every rank is enabled, this default policy will be
   * changed if DisableAllRanks is used, and again reverted when
   * EnableAllRanks is used.
   *
   * EnableRank/DisableRank are used to specify individual exceptions
   * of the default policy.
   */
  void EnableRank(int rank);
  void EnableAllRanks();
  void DisableRank(int rank);
  void DisableAllRanks();
  bool IsEnabledRank(int rank);
  ///@}

  ///@{
  /**
   * Set/Get the number of partitions of the resulting PartitionedDataSet.
   * If not specified, the number of partitions will be the number of enabled
   * ranks.
   *
   * SetNumberOfPartitions(0) means auto in this context, the implementation
   * will decided the optimal number of partitions which by default will be
   * one partition per each rank.
   */
  vtkSetClampMacro(NumberOfPartitions, int, 0, VTK_INT_MAX);
  vtkGetMacro(NumberOfPartitions, int);
  ///@}

  ///@{
  /**
   * Set/Get the parametric function to be used for this source.
   */
  void SetParametricFunction(vtkParametricFunction*);
  vtkGetObjectMacro(ParametricFunction, vtkParametricFunction);
  ///@}

protected:
  vtkPartitionedDataSetSource();
  ~vtkPartitionedDataSetSource() override;

  int RequestInformation(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
  int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;

private:
  vtkPartitionedDataSetSource(const vtkPartitionedDataSetSource&) = delete;
  void operator=(const vtkPartitionedDataSetSource&) = delete;

  bool RanksEnabledByDefault = true;
  int NumberOfPartitions = 0;
  std::map<int, int> Allocations;
  vtkParametricFunction* ParametricFunction = nullptr;
};

VTK_ABI_NAMESPACE_END
#endif