VTK
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.
75  (const vtkVariant& pedigreeId, void* userData);
76 
77 class VTKCOMMONDATAMODEL_EXPORT vtkDistributedGraphHelper : public vtkObject
78 {
79  public:
81  void PrintSelf(ostream& os, vtkIndent indent) override;
82 
86  vtkIdType GetVertexOwner(vtkIdType v) const;
87 
91  vtkIdType GetVertexIndex(vtkIdType v) const;
92 
96  vtkIdType GetEdgeOwner(vtkIdType e_id) const;
97 
102  vtkIdType GetEdgeIndex(vtkIdType e_id) const;
103 
107  vtkIdType MakeDistributedId(int owner, vtkIdType local);
108 
116  void SetVertexPedigreeIdDistribution(vtkVertexPedigreeIdDistribution Func,
117  void *userData);
118 
122  vtkIdType GetVertexOwnerByPedigreeId(const vtkVariant& pedigreeId);
123 
132  virtual void Synchronize() = 0;
133 
139  virtual vtkDistributedGraphHelper *Clone() = 0;
140 
142 
149  static vtkInformationIntegerKey * DISTRIBUTEDVERTEXIDS();
150  static vtkInformationIntegerKey * DISTRIBUTEDEDGEIDS();
152 
153  protected:
155  ~vtkDistributedGraphHelper() override;
156 
164  virtual void AddVertexInternal(vtkVariantArray *propertyArr,
165  vtkIdType *vertex) = 0;
166 
171  virtual void AddVertexInternal(const vtkVariant& pedigreeId, vtkIdType *vertex) = 0;
172 
179  virtual void AddEdgeInternal(vtkIdType u, vtkIdType v, bool directed,
180  vtkVariantArray *propertyArr,
181  vtkEdgeType *edge) = 0;
182 
191  virtual void AddEdgeInternal(const vtkVariant& uPedigreeId, vtkIdType v,
192  bool directed, vtkVariantArray *propertyArr,
193  vtkEdgeType *edge) = 0;
194 
203  virtual void AddEdgeInternal(vtkIdType u, const vtkVariant& vPedigreeId,
204  bool directed, vtkVariantArray *propertyArr,
205  vtkEdgeType *edge) = 0;
206 
216  virtual void AddEdgeInternal(const vtkVariant& uPedigreeId,
217  const vtkVariant& vPedigreeId,
218  bool directed, vtkVariantArray *propertyArr,
219  vtkEdgeType *edge) = 0;
220 
226  virtual vtkIdType FindVertex(const vtkVariant& pedigreeId) = 0;
227 
233  virtual void
234  FindEdgeSourceAndTarget(vtkIdType id,
236 
241  virtual void AttachToGraph(vtkGraph *graph);
242 
247 
252 
257 
262 
267 
271  int procBits;
272 
277 
278  private:
280  void operator=(const vtkDistributedGraphHelper&) = delete;
281 
282  friend class vtkGraph;
283 
284 };
285 
286 #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:59
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
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:347
A atomic type representing the union of many types.
Definition: vtkVariant.h:71
Base class for graph data types.
Definition: vtkGraph.h:287
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:39
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)
vtkGraph * Graph
The graph to which this distributed graph helper is already attached.
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)