VTK
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
vtkDistributedGraphHelper Class Referenceabstract

helper for the vtkGraph class that allows the graph to be distributed across multiple memory spaces. More...

#include <vtkDistributedGraphHelper.h>

Inheritance diagram for vtkDistributedGraphHelper:
[legend]
Collaboration diagram for vtkDistributedGraphHelper:
[legend]

Public Types

typedef vtkObject Superclass
 

Public Member Functions

virtual vtkTypeBool IsA (const char *type)
 Return 1 if this class is the same type of (or a subclass of) the named class. More...
 
vtkDistributedGraphHelperNewInstance () const
 
void PrintSelf (ostream &os, vtkIndent indent) override
 Methods invoked by print to print information about the object including superclasses. More...
 
vtkIdType GetVertexOwner (vtkIdType v) const
 Returns owner of vertex v, by extracting top ceil(log2 P) bits of v. More...
 
vtkIdType GetVertexIndex (vtkIdType v) const
 Returns local index of vertex v, by masking off top ceil(log2 P) bits of v. More...
 
vtkIdType GetEdgeOwner (vtkIdType e_id) const
 Returns owner of edge with ID e_id, by extracting top ceil(log2 P) bits of e_id. More...
 
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. More...
 
vtkIdType MakeDistributedId (int owner, vtkIdType local)
 Builds a distributed ID consisting of the given owner and the local ID. More...
 
void SetVertexPedigreeIdDistribution (vtkVertexPedigreeIdDistribution Func, void *userData)
 Set the pedigreeId -> processor distribution function that determines how vertices are distributed when they are associated with pedigree ID, which must be a unique label such as a URL or IP address. More...
 
vtkIdType GetVertexOwnerByPedigreeId (const vtkVariant &pedigreeId)
 Determine which processor owns the vertex with the given pedigree ID. More...
 
virtual void Synchronize ()=0
 Synchronizes all of the processors involved in this distributed graph, so that all processors have a consistent view of the distributed graph for the computation that follows. More...
 
virtual vtkDistributedGraphHelperClone ()=0
 Clones the distributed graph helper, returning another distributed graph helper of the same kind that can be used in another vtkGraph. More...
 
- Public Member Functions inherited from vtkObject
 vtkBaseTypeMacro (vtkObject, vtkObjectBase)
 
virtual void DebugOn ()
 Turn debugging output on. More...
 
virtual void DebugOff ()
 Turn debugging output off. More...
 
bool GetDebug ()
 Get the value of the debug flag. More...
 
void SetDebug (bool debugFlag)
 Set the value of the debug flag. More...
 
virtual void Modified ()
 Update the modification time for this object. More...
 
virtual vtkMTimeType GetMTime ()
 Return this object's modified time. More...
 
unsigned long AddObserver (unsigned long event, vtkCommand *, float priority=0.0f)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
unsigned long AddObserver (const char *event, vtkCommand *, float priority=0.0f)
 
vtkCommandGetCommand (unsigned long tag)
 
void RemoveObserver (vtkCommand *)
 
void RemoveObservers (unsigned long event, vtkCommand *)
 
void RemoveObservers (const char *event, vtkCommand *)
 
vtkTypeBool HasObserver (unsigned long event, vtkCommand *)
 
vtkTypeBool HasObserver (const char *event, vtkCommand *)
 
void RemoveObserver (unsigned long tag)
 
void RemoveObservers (unsigned long event)
 
void RemoveObservers (const char *event)
 
void RemoveAllObservers ()
 
vtkTypeBool HasObserver (unsigned long event)
 
vtkTypeBool HasObserver (const char *event)
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
 Overloads to AddObserver that allow developers to add class member functions as callbacks for events. More...
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 Allow user to set the AbortFlagOn() with the return value of the callback method. More...
 
int InvokeEvent (unsigned long event, void *callData)
 This method invokes an event and return whether the event was aborted or not. More...
 
int InvokeEvent (const char *event, void *callData)
 
int InvokeEvent (unsigned long event)
 
int InvokeEvent (const char *event)
 
- Public Member Functions inherited from vtkObjectBase
const char * GetClassName () const
 Return the class name as a string. More...
 
virtual void Delete ()
 Delete a VTK object. More...
 
virtual void FastDelete ()
 Delete a reference to this object. More...
 
void InitializeObjectBase ()
 
void Print (ostream &os)
 Print an object to an ostream. More...
 
virtual void PrintHeader (ostream &os, vtkIndent indent)
 
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 
virtual void Register (vtkObjectBase *o)
 Increase the reference count (mark as used by another object). More...
 
virtual void UnRegister (vtkObjectBase *o)
 Decrease the reference count (release by another object). More...
 
int GetReferenceCount ()
 Return the current reference count of this object. More...
 
void SetReferenceCount (int)
 Sets the reference count. More...
 
void PrintRevisions (ostream &)
 Legacy. More...
 

Static Public Member Functions

static vtkTypeBool IsTypeOf (const char *type)
 
static vtkDistributedGraphHelperSafeDownCast (vtkObjectBase *o)
 
static vtkInformationIntegerKeyDISTRIBUTEDVERTEXIDS ()
 Information Keys that distributed graphs can append to attribute arrays to flag them as containing distributed IDs. More...
 
static vtkInformationIntegerKeyDISTRIBUTEDEDGEIDS ()
 
- Static Public Member Functions inherited from vtkObject
static vtkObjectNew ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on. More...
 
static void BreakOnError ()
 This method is called when vtkErrorMacro executes. More...
 
static void SetGlobalWarningDisplay (int val)
 This is a global flag that controls whether any debug, warning or error messages are displayed. More...
 
static void GlobalWarningDisplayOn ()
 
static void GlobalWarningDisplayOff ()
 
static int GetGlobalWarningDisplay ()
 
- Static Public Member Functions inherited from vtkObjectBase
static vtkTypeBool IsTypeOf (const char *name)
 Return 1 if this class type is the same type of (or a subclass of) the named class. More...
 
static vtkObjectBaseNew ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on. More...
 

Protected Member Functions

virtual vtkObjectBaseNewInstanceInternal () const
 
 vtkDistributedGraphHelper ()
 
 ~vtkDistributedGraphHelper () override
 
virtual void AddVertexInternal (vtkVariantArray *propertyArr, vtkIdType *vertex)=0
 Add a vertex, optionally with properties, to the distributed graph. More...
 
virtual void AddVertexInternal (const vtkVariant &pedigreeId, vtkIdType *vertex)=0
 Add a vertex with the given pedigreeId to the distributed graph. More...
 
virtual void AddEdgeInternal (vtkIdType u, vtkIdType v, bool directed, vtkVariantArray *propertyArr, vtkEdgeType *edge)=0
 Add an edge (u, v) to the distributed graph. More...
 
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. More...
 
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. More...
 
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. More...
 
virtual vtkIdType FindVertex (const vtkVariant &pedigreeId)=0
 Try to find the vertex with the given pedigree ID. More...
 
virtual void FindEdgeSourceAndTarget (vtkIdType id, vtkIdType *source, vtkIdType *target)=0
 Determine the source and target of the edge with the given ID. More...
 
virtual void AttachToGraph (vtkGraph *graph)
 Attach this distributed graph helper to the given graph. More...
 
- Protected Member Functions inherited from vtkObject
 vtkObject ()
 
 ~vtkObject () override
 
void RegisterInternal (vtkObjectBase *, vtkTypeBool check) override
 
void UnRegisterInternal (vtkObjectBase *, vtkTypeBool check) override
 
void InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr)
 These methods allow a command to exclusively grab all events. More...
 
void InternalReleaseFocus ()
 
- Protected Member Functions inherited from vtkObjectBase
 vtkObjectBase ()
 
virtual ~vtkObjectBase ()
 
virtual void CollectRevisions (ostream &)
 
virtual void ReportReferences (vtkGarbageCollector *)
 
 vtkObjectBase (const vtkObjectBase &)
 
void operator= (const vtkObjectBase &)
 

Protected Attributes

vtkGraphGraph
 The graph to which this distributed graph helper is already attached. More...
 
vtkVertexPedigreeIdDistribution VertexDistribution
 The distribution function used to map a pedigree ID to a processor. More...
 
void * VertexDistributionUserData
 Extra, user-specified data to be passed into the distribution function. More...
 
vtkIdType signBitMask
 Bit mask to speed up decoding graph info {owner,index}. More...
 
vtkIdType highBitShiftMask
 Bit mask to speed up decoding graph info {owner,index}. More...
 
int procBits
 Number of bits required to represent # of processors (owner) More...
 
int indexBits
 Number of bits required to represent {vertex,edge} index. More...
 
- Protected Attributes inherited from vtkObject
bool Debug
 
vtkTimeStamp MTime
 
vtkSubjectHelper * SubjectHelper
 
- Protected Attributes inherited from vtkObjectBase
std::atomic< int32_t > ReferenceCount
 
vtkWeakPointerBase ** WeakPointers
 

Friends

class vtkGraph
 

Detailed Description

helper for the vtkGraph class that allows the graph to be distributed across multiple memory spaces.

A distributed graph helper can be attached to an empty vtkGraph object to turn the vtkGraph into a distributed graph, whose vertices and edges are distributed across several different processors. vtkDistributedGraphHelper is an abstract class. Use a subclass of vtkDistributedGraphHelper, such as vtkPBGLDistributedGraphHelper, to build distributed graphs.

The distributed graph helper provides facilities used by vtkGraph to communicate with other processors that store other parts of the same distributed graph. The only user-level functionality provided by vtkDistributedGraphHelper involves this communication among processors and the ability to map between "distributed" vertex and edge IDs and their component parts (processor and local index). For example, the Synchronize() method provides a barrier that allows all processors to catch up to the same point in the code before any processor can leave that Synchronize() call. For example, one would call Synchronize() after adding many edges to a distributed graph, so that all processors can handle the addition of inter-processor edges and continue, after the Synchronize() call, with a consistent view of the distributed graph. For more information about manipulating (distributed) graphs, see the vtkGraph documentation.

See also
vtkGraph

Definition at line 76 of file vtkDistributedGraphHelper.h.

Member Typedef Documentation

◆ Superclass

Definition at line 79 of file vtkDistributedGraphHelper.h.

Constructor & Destructor Documentation

◆ vtkDistributedGraphHelper()

vtkDistributedGraphHelper::vtkDistributedGraphHelper ( )
protected

◆ ~vtkDistributedGraphHelper()

vtkDistributedGraphHelper::~vtkDistributedGraphHelper ( )
overrideprotected

Member Function Documentation

◆ IsTypeOf()

static vtkTypeBool vtkDistributedGraphHelper::IsTypeOf ( const char *  type)
static

◆ IsA()

virtual vtkTypeBool vtkDistributedGraphHelper::IsA ( const char *  name)
virtual

Return 1 if this class is the same type of (or a subclass of) the named class.

Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkObjectBase.

◆ SafeDownCast()

static vtkDistributedGraphHelper* vtkDistributedGraphHelper::SafeDownCast ( vtkObjectBase o)
static

◆ NewInstanceInternal()

virtual vtkObjectBase* vtkDistributedGraphHelper::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkDistributedGraphHelper* vtkDistributedGraphHelper::NewInstance ( ) const

◆ PrintSelf()

void vtkDistributedGraphHelper::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
overridevirtual

Methods invoked by print to print information about the object including superclasses.

Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from vtkObject.

◆ GetVertexOwner()

vtkIdType vtkDistributedGraphHelper::GetVertexOwner ( vtkIdType  v) const

Returns owner of vertex v, by extracting top ceil(log2 P) bits of v.

◆ GetVertexIndex()

vtkIdType vtkDistributedGraphHelper::GetVertexIndex ( vtkIdType  v) const

Returns local index of vertex v, by masking off top ceil(log2 P) bits of v.

◆ GetEdgeOwner()

vtkIdType vtkDistributedGraphHelper::GetEdgeOwner ( vtkIdType  e_id) const

Returns owner of edge with ID e_id, by extracting top ceil(log2 P) bits of e_id.

◆ GetEdgeIndex()

vtkIdType vtkDistributedGraphHelper::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.

◆ MakeDistributedId()

vtkIdType vtkDistributedGraphHelper::MakeDistributedId ( int  owner,
vtkIdType  local 
)

Builds a distributed ID consisting of the given owner and the local ID.

◆ SetVertexPedigreeIdDistribution()

void vtkDistributedGraphHelper::SetVertexPedigreeIdDistribution ( vtkVertexPedigreeIdDistribution  Func,
void *  userData 
)

Set the pedigreeId -> processor distribution function that determines how vertices are distributed when they are associated with pedigree ID, which must be a unique label such as a URL or IP address.

If a nullptr function pointer is provided, the default hashed distribution will be used.

◆ GetVertexOwnerByPedigreeId()

vtkIdType vtkDistributedGraphHelper::GetVertexOwnerByPedigreeId ( const vtkVariant pedigreeId)

Determine which processor owns the vertex with the given pedigree ID.

◆ Synchronize()

virtual void vtkDistributedGraphHelper::Synchronize ( )
pure virtual

Synchronizes all of the processors involved in this distributed graph, so that all processors have a consistent view of the distributed graph for the computation that follows.

This routine should be invoked after adding new edges into the distributed graph, so that other processors will see those edges (or their corresponding back-edges).

◆ Clone()

virtual vtkDistributedGraphHelper* vtkDistributedGraphHelper::Clone ( )
pure virtual

Clones the distributed graph helper, returning another distributed graph helper of the same kind that can be used in another vtkGraph.

◆ DISTRIBUTEDVERTEXIDS()

static vtkInformationIntegerKey* vtkDistributedGraphHelper::DISTRIBUTEDVERTEXIDS ( )
static

Information Keys that distributed graphs can append to attribute arrays to flag them as containing distributed IDs.

These can be used to let routines that migrate vertices (either repartitioning or collecting graphs to single nodes) to also modify the ids contained in the attribute arrays to maintain consistency.

◆ DISTRIBUTEDEDGEIDS()

static vtkInformationIntegerKey* vtkDistributedGraphHelper::DISTRIBUTEDEDGEIDS ( )
static

◆ AddVertexInternal() [1/2]

virtual void vtkDistributedGraphHelper::AddVertexInternal ( vtkVariantArray propertyArr,
vtkIdType vertex 
)
protectedpure virtual

Add a vertex, optionally with properties, to the distributed graph.

If vertex is non-nullptr, it will be set to the newly-added (or found) vertex. Note that if propertyArr is non-nullptr and the vertex data contains pedigree IDs, a vertex will only be added if there is no vertex with that pedigree ID.

◆ AddVertexInternal() [2/2]

virtual void vtkDistributedGraphHelper::AddVertexInternal ( const vtkVariant pedigreeId,
vtkIdType vertex 
)
protectedpure virtual

Add a vertex with the given pedigreeId to the distributed graph.

If vertex is non-nullptr, it will receive the newly-created vertex.

◆ AddEdgeInternal() [1/4]

virtual void vtkDistributedGraphHelper::AddEdgeInternal ( vtkIdType  u,
vtkIdType  v,
bool  directed,
vtkVariantArray propertyArr,
vtkEdgeType edge 
)
protectedpure virtual

Add an edge (u, v) to the distributed graph.

The edge may be directed undirected. If edge is non-null, it will receive the newly-created edge. If propertyArr is non-null, it specifies the properties that will be attached to the newly-created edge.

◆ AddEdgeInternal() [2/4]

virtual void vtkDistributedGraphHelper::AddEdgeInternal ( const vtkVariant uPedigreeId,
vtkIdType  v,
bool  directed,
vtkVariantArray propertyArr,
vtkEdgeType edge 
)
protectedpure virtual

Adds an edge (u, v) and returns the new edge.

The graph edge may or may not be directed, depending on the given flag. If edge is non-null, it will receive the newly-created edge. uPedigreeId is the pedigree ID of vertex u, which will be added if no vertex by that pedigree ID exists. If propertyArr is non-null, it specifies the properties that will be attached to the newly-created edge.

◆ AddEdgeInternal() [3/4]

virtual void vtkDistributedGraphHelper::AddEdgeInternal ( vtkIdType  u,
const vtkVariant vPedigreeId,
bool  directed,
vtkVariantArray propertyArr,
vtkEdgeType edge 
)
protectedpure virtual

Adds an edge (u, v) and returns the new edge.

The graph edge may or may not be directed, depending on the given flag. If edge is non-null, it will receive the newly-created edge. vPedigreeId is the pedigree ID of vertex u, which will be added if no vertex with that pedigree ID exists. If propertyArr is non-null, it specifies the properties that will be attached to the newly-created edge.

◆ AddEdgeInternal() [4/4]

virtual void vtkDistributedGraphHelper::AddEdgeInternal ( const vtkVariant uPedigreeId,
const vtkVariant vPedigreeId,
bool  directed,
vtkVariantArray propertyArr,
vtkEdgeType edge 
)
protectedpure virtual

Adds an edge (u, v) and returns the new edge.

The graph edge may or may not be directed, depending on the given flag. If edge is non-null, it will receive the newly-created edge. uPedigreeId is the pedigree ID of vertex u and vPedigreeId is the pedigree ID of vertex u, each of which will be added if no vertex by that pedigree ID exists. If propertyArr is non-null, it specifies the properties that will be attached to the newly-created edge.

◆ FindVertex()

virtual vtkIdType vtkDistributedGraphHelper::FindVertex ( const vtkVariant pedigreeId)
protectedpure virtual

Try to find the vertex with the given pedigree ID.

Returns the vertex ID if the vertex is found, or -1 if there is no vertex with that pedigree ID.

◆ FindEdgeSourceAndTarget()

virtual void vtkDistributedGraphHelper::FindEdgeSourceAndTarget ( vtkIdType  id,
vtkIdType source,
vtkIdType target 
)
protectedpure virtual

Determine the source and target of the edge with the given ID.

Used internally by vtkGraph::GetSourceVertex and vtkGraph::GetTargetVertex.

◆ AttachToGraph()

virtual void vtkDistributedGraphHelper::AttachToGraph ( vtkGraph graph)
protectedvirtual

Attach this distributed graph helper to the given graph.

This will be called as part of vtkGraph::SetDistributedGraphHelper.

Friends And Related Function Documentation

◆ vtkGraph

friend class vtkGraph
friend

Definition at line 272 of file vtkDistributedGraphHelper.h.

Member Data Documentation

◆ Graph

vtkGraph* vtkDistributedGraphHelper::Graph
protected

The graph to which this distributed graph helper is already attached.

Definition at line 236 of file vtkDistributedGraphHelper.h.

◆ VertexDistribution

vtkVertexPedigreeIdDistribution vtkDistributedGraphHelper::VertexDistribution
protected

The distribution function used to map a pedigree ID to a processor.

Definition at line 241 of file vtkDistributedGraphHelper.h.

◆ VertexDistributionUserData

void* vtkDistributedGraphHelper::VertexDistributionUserData
protected

Extra, user-specified data to be passed into the distribution function.

Definition at line 246 of file vtkDistributedGraphHelper.h.

◆ signBitMask

vtkIdType vtkDistributedGraphHelper::signBitMask
protected

Bit mask to speed up decoding graph info {owner,index}.

Definition at line 251 of file vtkDistributedGraphHelper.h.

◆ highBitShiftMask

vtkIdType vtkDistributedGraphHelper::highBitShiftMask
protected

Bit mask to speed up decoding graph info {owner,index}.

Definition at line 256 of file vtkDistributedGraphHelper.h.

◆ procBits

int vtkDistributedGraphHelper::procBits
protected

Number of bits required to represent # of processors (owner)

Definition at line 261 of file vtkDistributedGraphHelper.h.

◆ indexBits

int vtkDistributedGraphHelper::indexBits
protected

Number of bits required to represent {vertex,edge} index.

Definition at line 266 of file vtkDistributedGraphHelper.h.


The documentation for this class was generated from the following file: