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 
87 
92 
97 
103 
108 
117  void *userData);
118 
123 
132  virtual void Synchronize() = 0;
133 
140 
142 
152 
153  protected:
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
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
vtkDistributedGraphHelper::AddVertexInternal
virtual void AddVertexInternal(vtkVariantArray *propertyArr, vtkIdType *vertex)=0
Add a vertex, optionally with properties, to the distributed graph.
vtkDistributedGraphHelper::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkDistributedGraphHelper
helper for the vtkGraph class that allows the graph to be distributed across multiple memory spaces.
Definition: vtkDistributedGraphHelper.h:78
vtkDistributedGraphHelper::DISTRIBUTEDVERTEXIDS
static vtkInformationIntegerKey * DISTRIBUTEDVERTEXIDS()
Information Keys that distributed graphs can append to attribute arrays to flag them as containing di...
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkDistributedGraphHelper::AddEdgeInternal
virtual void AddEdgeInternal(const vtkVariant &uPedigreeId, vtkIdType v, bool directed, vtkVariantArray *propertyArr, vtkEdgeType *edge)=0
Adds an edge (u, v) and returns the new edge.
vtkDistributedGraphHelper::Synchronize
virtual void Synchronize()=0
Synchronizes all of the processors involved in this distributed graph, so that all processors have a ...
vtkDistributedGraphHelper::AddEdgeInternal
virtual void AddEdgeInternal(vtkIdType u, const vtkVariant &vPedigreeId, bool directed, vtkVariantArray *propertyArr, vtkEdgeType *edge)=0
Adds an edge (u, v) and returns the new edge.
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:60
vtkDistributedGraphHelper::AddVertexInternal
virtual void AddVertexInternal(const vtkVariant &pedigreeId, vtkIdType *vertex)=0
Add a vertex with the given pedigreeId to the distributed graph.
vtkVariantArray
An array holding vtkVariants.
Definition: vtkVariantArray.h:47
vtkDistributedGraphHelper::AttachToGraph
virtual void AttachToGraph(vtkGraph *graph)
Attach this distributed graph helper to the given graph.
vtkDistributedGraphHelper::FindVertex
virtual vtkIdType FindVertex(const vtkVariant &pedigreeId)=0
Try to find the vertex with the given pedigree ID.
source
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Definition: vtkBoostGraphAdapter.h:825
vtkEdgeType
Definition: vtkGraph.h:277
vtkDistributedGraphHelper::GetVertexOwner
vtkIdType GetVertexOwner(vtkIdType v) const
Returns owner of vertex v, by extracting top ceil(log2 P) bits of v.
vtkDistributedGraphHelper::VertexDistributionUserData
void * VertexDistributionUserData
Extra, user-specified data to be passed into the distribution function.
Definition: vtkDistributedGraphHelper.h:256
vtkDistributedGraphHelper::GetVertexOwnerByPedigreeId
vtkIdType GetVertexOwnerByPedigreeId(const vtkVariant &pedigreeId)
Determine which processor owns the vertex with the given pedigree ID.
vtkDistributedGraphHelper::highBitShiftMask
vtkIdType highBitShiftMask
Bit mask to speed up decoding graph info {owner,index}.
Definition: vtkDistributedGraphHelper.h:266
vtkInformationIntegerKey
Key for integer values in vtkInformation.
Definition: vtkInformationIntegerKey.h:35
vtkDistributedGraphHelper::GetVertexIndex
vtkIdType GetVertexIndex(vtkIdType v) const
Returns local index of vertex v, by masking off top ceil(log2 P) bits of v.
vtkDistributedGraphHelper::indexBits
int indexBits
Number of bits required to represent {vertex,edge} index.
Definition: vtkDistributedGraphHelper.h:276
vtkDistributedGraphHelper::~vtkDistributedGraphHelper
~vtkDistributedGraphHelper() override
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkDistributedGraphHelper::GetEdgeIndex
vtkIdType GetEdgeIndex(vtkIdType e_id) const
Returns local index of edge with ID e_id, by masking off top ceil(log2 P) bits of e_id.
vtkVariant
A atomic type representing the union of many types.
Definition: vtkVariant.h:72
vtkDistributedGraphHelper::SetVertexPedigreeIdDistribution
void SetVertexPedigreeIdDistribution(vtkVertexPedigreeIdDistribution Func, void *userData)
Set the pedigreeId -> processor distribution function that determines how vertices are distributed wh...
vtkDistributedGraphHelper::MakeDistributedId
vtkIdType MakeDistributedId(int owner, vtkIdType local)
Builds a distributed ID consisting of the given owner and the local ID.
vtkDistributedGraphHelper::FindEdgeSourceAndTarget
virtual void FindEdgeSourceAndTarget(vtkIdType id, vtkIdType *source, vtkIdType *target)=0
Determine the source and target of the edge with the given ID.
vtkObject.h
vtkDistributedGraphHelper::Clone
virtual vtkDistributedGraphHelper * Clone()=0
Clones the distributed graph helper, returning another distributed graph helper of the same kind that...
vtkVertexPedigreeIdDistribution
vtkIdType(* vtkVertexPedigreeIdDistribution)(const vtkVariant &pedigreeId, void *userData)
Definition: vtkDistributedGraphHelper.h:75
vtkDistributedGraphHelper::procBits
int procBits
Number of bits required to represent # of processors (owner)
Definition: vtkDistributedGraphHelper.h:271
vtkDistributedGraphHelper::AddEdgeInternal
virtual void AddEdgeInternal(vtkIdType u, vtkIdType v, bool directed, vtkVariantArray *propertyArr, vtkEdgeType *edge)=0
Add an edge (u, v) to the distributed graph.
vtkGraph
Base class for graph data types.
Definition: vtkGraph.h:288
vtkDistributedGraphHelper::GetEdgeOwner
vtkIdType GetEdgeOwner(vtkIdType e_id) const
Returns owner of edge with ID e_id, by extracting top ceil(log2 P) bits of e_id.
vtkDistributedGraphHelper::vtkDistributedGraphHelper
vtkDistributedGraphHelper()
target
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Definition: vtkBoostGraphAdapter.h:832
vtkDistributedGraphHelper::signBitMask
vtkIdType signBitMask
Bit mask to speed up decoding graph info {owner,index}.
Definition: vtkDistributedGraphHelper.h:261
vtkDistributedGraphHelper::Graph
vtkGraph * Graph
The graph to which this distributed graph helper is already attached.
Definition: vtkDistributedGraphHelper.h:246
vtkDistributedGraphHelper::VertexDistribution
vtkVertexPedigreeIdDistribution VertexDistribution
The distribution function used to map a pedigree ID to a processor.
Definition: vtkDistributedGraphHelper.h:251
vtkDistributedGraphHelper::AddEdgeInternal
virtual void AddEdgeInternal(const vtkVariant &uPedigreeId, const vtkVariant &vPedigreeId, bool directed, vtkVariantArray *propertyArr, vtkEdgeType *edge)=0
Adds an edge (u, v) and returns the new edge.
vtkDistributedGraphHelper::DISTRIBUTEDEDGEIDS
static vtkInformationIntegerKey * DISTRIBUTEDEDGEIDS()