00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
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 
00068 
00069 
00070 
00071 
00072 
00073 
00074 
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   
00105 
00110   void SetVertexPedigreeIdDistribution(vtkVertexPedigreeIdDistribution Func,
00111                                        void *userData);
00112   
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   
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   
00249 
00250  private:
00251   vtkDistributedGraphHelper(const vtkDistributedGraphHelper&); 
00252   void operator=(const vtkDistributedGraphHelper&); 
00253 
00254   
00255   friend class vtkGraph;
00256   
00257 };
00258 
00259 #endif // __vtkDistributedGraphHelper_h