VTK  9.0.20200603
vtkDistributedGraphHelper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkDistributedGraphHelper.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /*
16  * Copyright (C) 2008 The Trustees of Indiana University.
17  * Use, modification and distribution is subject to the Boost Software
18  * License, Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt)
19  */
20 
53 #ifndef vtkDistributedGraphHelper_h
54 #define vtkDistributedGraphHelper_h
55 
56 #include "vtkCommonDataModelModule.h" // For export macro
57 #include "vtkObject.h"
58 
59 class vtkDistributedGraphHelperInternals;
60 struct vtkEdgeType;
61 class vtkGraph;
62 class vtkVariant;
63 class vtkVariantArray;
65 
66 // .NAME vtkVertexPedigreeIdDistributionFunction - The type of a
67 // function used to determine how to distribute vertex pedigree IDs
68 // across processors in a vtkGraph. The pedigree ID distribution
69 // function takes the pedigree ID of the vertex and a user-supplied
70 // void pointer and returns a hash value V. A vertex with that
71 // pedigree ID will reside on processor V % P, where P is the number
72 // of processors. This type is used in conjunction with the
73 // vtkDistributedGraphHelper class.
74 typedef vtkIdType (*vtkVertexPedigreeIdDistribution)(const vtkVariant& pedigreeId, void* userData);
75 
76 class VTKCOMMONDATAMODEL_EXPORT vtkDistributedGraphHelper : public vtkObject
77 {
78 public:
80  void PrintSelf(ostream& os, vtkIndent indent) override;
81 
85  vtkIdType GetVertexOwner(vtkIdType v) const;
86 
90  vtkIdType GetVertexIndex(vtkIdType v) const;
91 
95  vtkIdType GetEdgeOwner(vtkIdType e_id) const;
96 
101  vtkIdType GetEdgeIndex(vtkIdType e_id) const;
102 
106  vtkIdType MakeDistributedId(int owner, vtkIdType local);
107 
115  void SetVertexPedigreeIdDistribution(vtkVertexPedigreeIdDistribution Func, void* userData);
116 
120  vtkIdType GetVertexOwnerByPedigreeId(const vtkVariant& pedigreeId);
121 
130  virtual void Synchronize() = 0;
131 
137  virtual vtkDistributedGraphHelper* Clone() = 0;
138 
140 
147  static vtkInformationIntegerKey* DISTRIBUTEDVERTEXIDS();
148  static vtkInformationIntegerKey* DISTRIBUTEDEDGEIDS();
150 
151 protected:
153  ~vtkDistributedGraphHelper() override;
154 
162  virtual void AddVertexInternal(vtkVariantArray* propertyArr, vtkIdType* vertex) = 0;
163 
168  virtual void AddVertexInternal(const vtkVariant& pedigreeId, vtkIdType* vertex) = 0;
169 
176  virtual void AddEdgeInternal(
177  vtkIdType u, vtkIdType v, bool directed, vtkVariantArray* propertyArr, vtkEdgeType* edge) = 0;
178 
187  virtual void AddEdgeInternal(const vtkVariant& uPedigreeId, vtkIdType v, bool directed,
188  vtkVariantArray* propertyArr, vtkEdgeType* edge) = 0;
189 
198  virtual void AddEdgeInternal(vtkIdType u, const vtkVariant& vPedigreeId, bool directed,
199  vtkVariantArray* propertyArr, vtkEdgeType* edge) = 0;
200 
210  virtual void AddEdgeInternal(const vtkVariant& uPedigreeId, const vtkVariant& vPedigreeId,
211  bool directed, vtkVariantArray* propertyArr, vtkEdgeType* edge) = 0;
212 
218  virtual vtkIdType FindVertex(const vtkVariant& pedigreeId) = 0;
219 
225  virtual void FindEdgeSourceAndTarget(vtkIdType id, vtkIdType* source, vtkIdType* target) = 0;
226 
231  virtual void AttachToGraph(vtkGraph* graph);
232 
237 
242 
247 
252 
257 
261  int procBits;
262 
267 
268 private:
270  void operator=(const vtkDistributedGraphHelper&) = delete;
271 
272  friend class vtkGraph;
273 };
274 
275 #endif // vtkDistributedGraphHelper_h
vtkDistributedGraphHelper
helper for the vtkGraph class that allows the graph to be distributed across multiple memory spaces.
Definition: vtkDistributedGraphHelper.h:76
vtkIdType
int vtkIdType
Definition: vtkType.h:330
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkVariantArray
An array holding vtkVariants.
Definition: vtkVariantArray.h:49
vtkEdgeType
Definition: vtkGraph.h:276
target
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Definition: vtkBoostGraphAdapter.h:965
vtkDistributedGraphHelper::VertexDistributionUserData
void * VertexDistributionUserData
Extra, user-specified data to be passed into the distribution function.
Definition: vtkDistributedGraphHelper.h:246
vtkDistributedGraphHelper::highBitShiftMask
vtkIdType highBitShiftMask
Bit mask to speed up decoding graph info {owner,index}.
Definition: vtkDistributedGraphHelper.h:256
vtkInformationIntegerKey
Key for integer values in vtkInformation.
Definition: vtkInformationIntegerKey.h:31
vtkDistributedGraphHelper::indexBits
int indexBits
Number of bits required to represent {vertex,edge} index.
Definition: vtkDistributedGraphHelper.h:266
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkVariant
A atomic type representing the union of many types.
Definition: vtkVariant.h:65
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkObject.h
vtkVertexPedigreeIdDistribution
vtkIdType(* vtkVertexPedigreeIdDistribution)(const vtkVariant &pedigreeId, void *userData)
Definition: vtkDistributedGraphHelper.h:74
vtkDistributedGraphHelper::procBits
int procBits
Number of bits required to represent # of processors (owner)
Definition: vtkDistributedGraphHelper.h:261
source
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Definition: vtkBoostGraphAdapter.h:959
vtkGraph
Base class for graph data types.
Definition: vtkGraph.h:289
vtkDistributedGraphHelper::signBitMask
vtkIdType signBitMask
Bit mask to speed up decoding graph info {owner,index}.
Definition: vtkDistributedGraphHelper.h:251
vtkDistributedGraphHelper::Graph
vtkGraph * Graph
The graph to which this distributed graph helper is already attached.
Definition: vtkDistributedGraphHelper.h:236
vtkDistributedGraphHelper::VertexDistribution
vtkVertexPedigreeIdDistribution VertexDistribution
The distribution function used to map a pedigree ID to a processor.
Definition: vtkDistributedGraphHelper.h:241