VTK  9.3.1
vtkDistributedGraphHelper.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright (C) 2008 The Trustees of Indiana University.
3 // SPDX-License-Identifier: BSD-3-Clause AND BSL-1.0
36 #ifndef vtkDistributedGraphHelper_h
37 #define vtkDistributedGraphHelper_h
38 
39 #include "vtkCommonDataModelModule.h" // For export macro
40 #include "vtkObject.h"
41 
42 VTK_ABI_NAMESPACE_BEGIN
43 class vtkDistributedGraphHelperInternals;
44 struct vtkEdgeType;
45 class vtkGraph;
46 class vtkVariant;
47 class vtkVariantArray;
49 
50 // .NAME vtkVertexPedigreeIdDistributionFunction - The type of a
51 // function used to determine how to distribute vertex pedigree IDs
52 // across processors in a vtkGraph. The pedigree ID distribution
53 // function takes the pedigree ID of the vertex and a user-supplied
54 // void pointer and returns a hash value V. A vertex with that
55 // pedigree ID will reside on processor V % P, where P is the number
56 // of processors. This type is used in conjunction with the
57 // vtkDistributedGraphHelper class.
58 typedef vtkIdType (*vtkVertexPedigreeIdDistribution)(const vtkVariant& pedigreeId, void* userData);
59 
60 class VTKCOMMONDATAMODEL_EXPORT vtkDistributedGraphHelper : public vtkObject
61 {
62 public:
64  void PrintSelf(ostream& os, vtkIndent indent) override;
65 
69  vtkIdType GetVertexOwner(vtkIdType v) const;
70 
74  vtkIdType GetVertexIndex(vtkIdType v) const;
75 
79  vtkIdType GetEdgeOwner(vtkIdType e_id) const;
80 
85  vtkIdType GetEdgeIndex(vtkIdType e_id) const;
86 
90  vtkIdType MakeDistributedId(int owner, vtkIdType local);
91 
99  void SetVertexPedigreeIdDistribution(vtkVertexPedigreeIdDistribution Func, void* userData);
100 
104  vtkIdType GetVertexOwnerByPedigreeId(const vtkVariant& pedigreeId);
105 
114  virtual void Synchronize() = 0;
115 
121  virtual vtkDistributedGraphHelper* Clone() = 0;
122 
124 
131  static vtkInformationIntegerKey* DISTRIBUTEDVERTEXIDS();
132  static vtkInformationIntegerKey* DISTRIBUTEDEDGEIDS();
134 
135 protected:
137  ~vtkDistributedGraphHelper() override;
138 
146  virtual void AddVertexInternal(vtkVariantArray* propertyArr, vtkIdType* vertex) = 0;
147 
152  virtual void AddVertexInternal(const vtkVariant& pedigreeId, vtkIdType* vertex) = 0;
153 
160  virtual void AddEdgeInternal(
161  vtkIdType u, vtkIdType v, bool directed, vtkVariantArray* propertyArr, vtkEdgeType* edge) = 0;
162 
171  virtual void AddEdgeInternal(const vtkVariant& uPedigreeId, vtkIdType v, bool directed,
172  vtkVariantArray* propertyArr, vtkEdgeType* edge) = 0;
173 
182  virtual void AddEdgeInternal(vtkIdType u, const vtkVariant& vPedigreeId, bool directed,
183  vtkVariantArray* propertyArr, vtkEdgeType* edge) = 0;
184 
194  virtual void AddEdgeInternal(const vtkVariant& uPedigreeId, const vtkVariant& vPedigreeId,
195  bool directed, vtkVariantArray* propertyArr, vtkEdgeType* edge) = 0;
196 
202  virtual vtkIdType FindVertex(const vtkVariant& pedigreeId) = 0;
203 
209  virtual void FindEdgeSourceAndTarget(vtkIdType id, vtkIdType* source, vtkIdType* target) = 0;
210 
215  virtual void AttachToGraph(vtkGraph* graph);
216 
221 
226 
231 
236 
241 
245  int procBits;
246 
251 
252 private:
254  void operator=(const vtkDistributedGraphHelper&) = delete;
255 
256  friend class vtkGraph;
257 };
258 
259 VTK_ABI_NAMESPACE_END
260 #endif // vtkDistributedGraphHelper_h
helper for the vtkGraph class that allows the graph to be distributed across multiple memory spaces...
int indexBits
Number of bits required to represent {vertex,edge} index.
abstract base class for most VTK objects
Definition: vtkObject.h:51
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
An array holding vtkVariants.
vtkIdType highBitShiftMask
Bit mask to speed up decoding graph info {owner,index}.
int vtkIdType
Definition: vtkType.h:315
A type representing the union of many types.
Definition: vtkVariant.h:52
Base class for graph data types.
Definition: vtkGraph.h:280
vtkIdType signBitMask
Bit mask to speed up decoding graph info {owner,index}.
vtkVertexPedigreeIdDistribution VertexDistribution
The distribution function used to map a pedigree ID to a processor.
a simple class to control print indentation
Definition: vtkIndent.h:28
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Key for integer values in vtkInformation.
void * VertexDistributionUserData
Extra, user-specified data to be passed into the distribution function.
vtkIdType(* vtkVertexPedigreeIdDistribution)(const vtkVariant &pedigreeId, void *userData)
int procBits
Number of bits required to represent # of processors (owner)
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
vtkGraph * Graph
The graph to which this distributed graph helper is already attached.