VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkDistributedGraphHelper.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 /* 00016 * Copyright (C) 2008 The Trustees of Indiana University. 00017 * Use, modification and distribution is subject to the Boost Software 00018 * License, Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt) 00019 */ 00020 00055 #ifndef __vtkDistributedGraphHelper_h 00056 #define __vtkDistributedGraphHelper_h 00057 00058 #include "vtkObject.h" 00059 00060 class vtkDistributedGraphHelperInternals; 00061 struct vtkEdgeType; 00062 class vtkGraph; 00063 class vtkVariant; 00064 class vtkVariantArray; 00065 class vtkInformationIntegerKey; 00066 00067 // .NAME vtkVertexPedigreeIdDistributionFunction - The type of a 00068 // function used to determine how to distribute vertex pedigree IDs 00069 // across processors in a vtkGraph. The pedigree ID distribution 00070 // function takes the pedigree ID of the vertex and a user-supplied 00071 // void pointer and returns a hash value V. A vertex with that 00072 // pedigree ID will reside on processor V % P, where P is the number 00073 // of processors. This type is used in conjunction with the 00074 // vtkDistributedGraphHelper class. 00075 typedef vtkIdType (*vtkVertexPedigreeIdDistribution) 00076 (const vtkVariant& pedigreeId, void* userData); 00077 00078 class VTK_FILTERING_EXPORT vtkDistributedGraphHelper : public vtkObject 00079 { 00080 public: 00081 vtkTypeMacro (vtkDistributedGraphHelper, vtkObject); 00082 void PrintSelf(ostream& os, vtkIndent indent); 00083 00085 vtkIdType GetVertexOwner(vtkIdType v) const; 00086 00089 vtkIdType GetVertexIndex(vtkIdType v) const; 00090 00093 vtkIdType GetEdgeOwner(vtkIdType e_id) const; 00094 00097 vtkIdType GetEdgeIndex(vtkIdType e_id) const; 00098 00101 vtkIdType MakeDistributedId(int owner, vtkIdType local); 00102 00104 00109 void SetVertexPedigreeIdDistribution(vtkVertexPedigreeIdDistribution Func, 00110 void *userData); 00112 00113 //BTX 00115 00116 vtkIdType GetVertexOwnerByPedigreeId(const vtkVariant& pedigreeId); 00117 //ETX 00119 00126 virtual void Synchronize() = 0; 00127 00130 virtual vtkDistributedGraphHelper *Clone() = 0; 00131 00133 00138 static vtkInformationIntegerKey * DISTRIBUTEDVERTEXIDS(); 00139 static vtkInformationIntegerKey * DISTRIBUTEDEDGEIDS(); 00141 00142 protected: 00143 vtkDistributedGraphHelper(); 00144 virtual ~vtkDistributedGraphHelper(); 00145 00147 00152 virtual void AddVertexInternal(vtkVariantArray *propertyArr, 00153 vtkIdType *vertex) = 0; 00155 00158 virtual void AddVertexInternal(const vtkVariant& pedigreeId, vtkIdType *vertex) = 0; 00159 00161 00165 virtual void AddEdgeInternal(vtkIdType u, vtkIdType v, bool directed, 00166 vtkVariantArray *propertyArr, 00167 vtkEdgeType *edge) = 0; 00169 00171 00177 virtual void AddEdgeInternal(const vtkVariant& uPedigreeId, vtkIdType v, 00178 bool directed, vtkVariantArray *propertyArr, 00179 vtkEdgeType *edge) = 0; 00181 00183 00189 virtual void AddEdgeInternal(vtkIdType u, const vtkVariant& vPedigreeId, 00190 bool directed, vtkVariantArray *propertyArr, 00191 vtkEdgeType *edge) = 0; 00193 00195 00202 virtual void AddEdgeInternal(const vtkVariant& uPedigreeId, 00203 const vtkVariant& vPedigreeId, 00204 bool directed, vtkVariantArray *propertyArr, 00205 vtkEdgeType *edge) = 0; 00207 00211 virtual vtkIdType FindVertex(const vtkVariant& pedigreeId) = 0; 00212 00214 00217 virtual void 00218 FindEdgeSourceAndTarget(vtkIdType id, 00219 vtkIdType *source, vtkIdType *target) = 0; 00221 00224 virtual void AttachToGraph(vtkGraph *graph); 00225 00227 vtkGraph *Graph; 00228 00229 //BTX 00231 vtkVertexPedigreeIdDistribution VertexDistribution; 00232 00235 void *VertexDistributionUserData; 00236 00238 vtkIdType signBitMask; 00239 00241 vtkIdType highBitShiftMask; 00242 00244 int procBits; 00245 00247 00248 int indexBits; 00249 //ETX 00251 00252 private: 00253 vtkDistributedGraphHelper(const vtkDistributedGraphHelper&); // Not implemented 00254 void operator=(const vtkDistributedGraphHelper&); // Not implemented 00255 00256 //BTX 00257 friend class vtkGraph; 00258 //ETX 00259 }; 00260 00261 #endif // __vtkDistributedGraphHelper_h