VTK
dox/Infovis/Parallel/vtkPBGLDistributedGraphHelper.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkPBGLDistributedGraphHelper.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  */
00040 #ifndef __vtkPBGLDistributedGraphHelper_h
00041 #define __vtkPBGLDistributedGraphHelper_h
00042 
00043 #include "vtkInfovisParallelModule.h" // For export macro
00044 #include "vtkDistributedGraphHelper.h"
00045 
00046 class vtkPBGLDistributedGraphHelperInternals;
00047 
00048 //BTX
00049 namespace boost { namespace graph { namespace distributed {
00050   class mpi_process_group;
00051 } } } 
00052 //ETX
00053 
00054 class VTKINFOVISPARALLEL_EXPORT vtkPBGLDistributedGraphHelper : public vtkDistributedGraphHelper
00055 {
00056  public:
00057   vtkTypeMacro(vtkPBGLDistributedGraphHelper,vtkDistributedGraphHelper);
00058 
00060   static vtkPBGLDistributedGraphHelper* New();
00061 
00068   void Synchronize();
00069 
00071   vtkDistributedGraphHelper *Clone();
00072 
00073   //BTX
00075 
00076   boost::graph::distributed::mpi_process_group GetProcessGroup();
00077   //ETX
00079 
00082   vtkPBGLDistributedGraphHelperInternals *Internals;
00083 
00084   void PrintSelf(ostream& os, vtkIndent indent);
00085 
00086  protected:
00087   vtkPBGLDistributedGraphHelper();
00088   ~vtkPBGLDistributedGraphHelper();
00089 
00090   //BTX
00091   enum Tags
00092   {
00093     // Find a vertex by pedigree ID. This always has a reply.
00094     FIND_VERTEX_TAG,
00095 
00096     // Find the source and target by edge ID. This always has a reply.
00097     FIND_EDGE_SOURCE_TARGET_TAG,
00098 
00099     // Add a vertex with the given pedigree ID.
00100     ADD_VERTEX_NO_REPLY_TAG,
00101     ADD_VERTEX_WITH_REPLY_TAG,
00102 
00103     // Add a vertex with the given property array.
00104     ADD_VERTEX_PROPS_NO_REPLY_TAG,
00105     ADD_VERTEX_PROPS_WITH_REPLY_TAG,
00106 
00107     // Add a back edge; the forward edge has already been added.
00108     ADD_DIRECTED_BACK_EDGE_TAG,
00109     ADD_UNDIRECTED_BACK_EDGE_TAG,
00110 
00111     // Add an edge; don't reply.
00112     ADD_DIRECTED_EDGE_NO_REPLY_TAG,
00113     ADD_UNDIRECTED_EDGE_NO_REPLY_TAG,
00114 
00115     // Add an edge; return the edge ID.
00116     ADD_DIRECTED_EDGE_WITH_REPLY_TAG,
00117     ADD_UNDIRECTED_EDGE_WITH_REPLY_TAG,
00118 
00119     // Add an edge via (pedigree, id); don't reply.
00120     ADD_DIRECTED_EDGE_NI_NO_REPLY_TAG,
00121     ADD_UNDIRECTED_EDGE_NI_NO_REPLY_TAG,
00122 
00123     // Add an edge via (pedigree, id); return the edge ID.
00124     ADD_DIRECTED_EDGE_NI_WITH_REPLY_TAG,
00125     ADD_UNDIRECTED_EDGE_NI_WITH_REPLY_TAG,
00126 
00127     // Add an edge via (id, pedigree); don't reply.
00128     ADD_DIRECTED_EDGE_IN_NO_REPLY_TAG,
00129     ADD_UNDIRECTED_EDGE_IN_NO_REPLY_TAG,
00130 
00131     // Add an edge via (pedigree, pedigree); don't reply.
00132     ADD_DIRECTED_EDGE_NN_NO_REPLY_TAG,
00133     ADD_UNDIRECTED_EDGE_NN_NO_REPLY_TAG
00134 
00135   };
00136 
00138 
00143   void AddVertexInternal(vtkVariantArray *propertyArr,
00144                          vtkIdType *vertex);
00146 
00149   void AddVertexInternal(const vtkVariant& pedigreeId, vtkIdType *vertex);
00150 
00152 
00156   void AddEdgeInternal(vtkIdType u, vtkIdType v, bool directed,
00157                        vtkVariantArray *propertyArr,
00158                        vtkEdgeType *edge);
00160 
00162 
00168   void AddEdgeInternal(const vtkVariant& uPedigreeId, vtkIdType v,
00169                        bool directed, vtkVariantArray *propertyArr,
00170                        vtkEdgeType *edge);
00172 
00174 
00180   void AddEdgeInternal(vtkIdType u, const vtkVariant& vPedigreeId,
00181                        bool directed, vtkVariantArray *propertyArr,
00182                        vtkEdgeType *edge);
00184 
00186 
00193   void AddEdgeInternal(const vtkVariant& uPedigreeId,
00194                        const vtkVariant& vPedigreeId,
00195                        bool directed, vtkVariantArray *propertyArr,
00196                        vtkEdgeType *edge);
00198 
00201   vtkIdType FindVertex(const vtkVariant& pedigreeId);
00202 
00204 
00207   void FindEdgeSourceAndTarget(vtkIdType id,
00208                                vtkIdType *source, vtkIdType *target);
00210 
00212 
00214   void AttachToGraph(vtkGraph *graph);
00215   //ETX
00217 
00218  private:
00219   vtkPBGLDistributedGraphHelper(const vtkPBGLDistributedGraphHelper&); // Not implemented
00220   void operator=(const vtkPBGLDistributedGraphHelper&); // Not implemented
00221 
00222   //BTX
00223   friend class vtkPBGLDistributedGraphHelperInternals;
00224   //ETX
00225 };
00226 
00227 #endif // __vtkPBGLDistributedGraphHelper_h