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 00103 //BTX 00105 00110 void SetVertexPedigreeIdDistribution(vtkVertexPedigreeIdDistribution Func, 00111 void *userData); 00112 //ETX 00114 00116 vtkIdType GetVertexOwnerByPedigreeId(const vtkVariant& pedigreeId); 00117 00124 virtual void Synchronize() = 0; 00125 00128 virtual vtkDistributedGraphHelper *Clone() = 0; 00129 00131 00136 static vtkInformationIntegerKey * DISTRIBUTEDVERTEXIDS(); 00137 static vtkInformationIntegerKey * DISTRIBUTEDEDGEIDS(); 00139 00140 protected: 00141 vtkDistributedGraphHelper(); 00142 virtual ~vtkDistributedGraphHelper(); 00143 00145 00150 virtual void AddVertexInternal(vtkVariantArray *propertyArr, 00151 vtkIdType *vertex) = 0; 00153 00156 virtual void AddVertexInternal(const vtkVariant& pedigreeId, vtkIdType *vertex) = 0; 00157 00159 00163 virtual void AddEdgeInternal(vtkIdType u, vtkIdType v, bool directed, 00164 vtkVariantArray *propertyArr, 00165 vtkEdgeType *edge) = 0; 00167 00169 00175 virtual void AddEdgeInternal(const vtkVariant& uPedigreeId, vtkIdType v, 00176 bool directed, vtkVariantArray *propertyArr, 00177 vtkEdgeType *edge) = 0; 00179 00181 00187 virtual void AddEdgeInternal(vtkIdType u, const vtkVariant& vPedigreeId, 00188 bool directed, vtkVariantArray *propertyArr, 00189 vtkEdgeType *edge) = 0; 00191 00193 00200 virtual void AddEdgeInternal(const vtkVariant& uPedigreeId, 00201 const vtkVariant& vPedigreeId, 00202 bool directed, vtkVariantArray *propertyArr, 00203 vtkEdgeType *edge) = 0; 00205 00209 virtual vtkIdType FindVertex(const vtkVariant& pedigreeId) = 0; 00210 00212 00215 virtual void 00216 FindEdgeSourceAndTarget(vtkIdType id, 00217 vtkIdType *source, vtkIdType *target) = 0; 00219 00222 virtual void AttachToGraph(vtkGraph *graph); 00223 00225 vtkGraph *Graph; 00226 00227 //BTX 00229 vtkVertexPedigreeIdDistribution VertexDistribution; 00230 00233 void *VertexDistributionUserData; 00234 00236 vtkIdType signBitMask; 00237 00239 vtkIdType highBitShiftMask; 00240 00242 int procBits; 00243 00245 00246 int indexBits; 00247 //ETX 00249 00250 private: 00251 vtkDistributedGraphHelper(const vtkDistributedGraphHelper&); // Not implemented 00252 void operator=(const vtkDistributedGraphHelper&); // Not implemented 00253 00254 //BTX 00255 friend class vtkGraph; 00256 //ETX 00257 }; 00258 00259 #endif // __vtkDistributedGraphHelper_h