VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkPBGLDistributedGraphHelper.h,v $ 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 "vtkDistributedGraphHelper.h" 00044 00045 class vtkPBGLDistributedGraphHelperInternals; 00046 00047 //BTX 00048 namespace boost { namespace graph { namespace distributed { 00049 class mpi_process_group; 00050 } } } 00051 //ETX 00052 00053 class VTK_PARALLEL_EXPORT vtkPBGLDistributedGraphHelper : public vtkDistributedGraphHelper 00054 { 00055 public: 00056 vtkTypeRevisionMacro (vtkPBGLDistributedGraphHelper, 00057 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 protected: 00085 vtkPBGLDistributedGraphHelper(); 00086 ~vtkPBGLDistributedGraphHelper(); 00087 00088 //BTX 00089 enum Tags 00090 { 00091 // Find a vertex by pedigree ID. This always has a reply. 00092 FIND_VERTEX_TAG, 00093 // Find the source and target by edge ID. This always has a reply. 00094 FIND_EDGE_SOURCE_TARGET_TAG, 00095 // Add a vertex with the given pedigree ID. 00096 ADD_VERTEX_NO_REPLY_TAG, 00097 ADD_VERTEX_WITH_REPLY_TAG, 00098 // Add a vertex with the given property array. 00099 ADD_VERTEX_PROPS_NO_REPLY_TAG, 00100 ADD_VERTEX_PROPS_WITH_REPLY_TAG, 00101 // Add a back edge; the forward edge has already been added. 00102 ADD_DIRECTED_BACK_EDGE_TAG, 00103 ADD_UNDIRECTED_BACK_EDGE_TAG, 00104 // Add an edge; don't reply. 00105 ADD_DIRECTED_EDGE_NO_REPLY_TAG, 00106 ADD_UNDIRECTED_EDGE_NO_REPLY_TAG, 00107 // Add an edge; return the edge ID. 00108 ADD_DIRECTED_EDGE_WITH_REPLY_TAG, 00109 ADD_UNDIRECTED_EDGE_WITH_REPLY_TAG, 00110 // Add an edge via (pedigree, id); don't reply. 00111 ADD_DIRECTED_EDGE_NI_NO_REPLY_TAG, 00112 ADD_UNDIRECTED_EDGE_NI_NO_REPLY_TAG, 00113 // Add an edge via (pedigree, id); return the edge ID. 00114 ADD_DIRECTED_EDGE_NI_WITH_REPLY_TAG, 00115 ADD_UNDIRECTED_EDGE_NI_WITH_REPLY_TAG, 00116 // Add an edge via (id, pedigree); don't reply. 00117 ADD_DIRECTED_EDGE_IN_NO_REPLY_TAG, 00118 ADD_UNDIRECTED_EDGE_IN_NO_REPLY_TAG, 00119 // Add an edge via (pedigree, pedigree); don't reply. 00120 ADD_DIRECTED_EDGE_NN_NO_REPLY_TAG, 00121 ADD_UNDIRECTED_EDGE_NN_NO_REPLY_TAG 00122 }; 00123 00125 00130 void AddVertexInternal(vtkVariantArray *propertyArr, 00131 vtkIdType *vertex); 00133 00136 void AddVertexInternal(const vtkVariant& pedigreeId, vtkIdType *vertex); 00137 00139 00143 void AddEdgeInternal(vtkIdType u, vtkIdType v, bool directed, 00144 vtkVariantArray *propertyArr, 00145 vtkEdgeType *edge); 00147 00149 00155 void AddEdgeInternal(const vtkVariant& uPedigreeId, vtkIdType v, 00156 bool directed, vtkVariantArray *propertyArr, 00157 vtkEdgeType *edge); 00159 00161 00167 void AddEdgeInternal(vtkIdType u, const vtkVariant& vPedigreeId, 00168 bool directed, vtkVariantArray *propertyArr, 00169 vtkEdgeType *edge); 00171 00173 00180 void AddEdgeInternal(const vtkVariant& uPedigreeId, 00181 const vtkVariant& vPedigreeId, 00182 bool directed, vtkVariantArray *propertyArr, 00183 vtkEdgeType *edge); 00184 // Description: 00185 // Try to find the vertex with the given pedigree ID. Returns true and 00186 // fills in the vertex ID if the vertex is found, and returns false 00187 // otherwise; 00188 vtkIdType FindVertex(const vtkVariant& pedigreeId); 00190 00192 00195 void FindEdgeSourceAndTarget(vtkIdType id, 00196 vtkIdType *source, vtkIdType *target); 00198 00200 00202 void AttachToGraph(vtkGraph *graph); 00203 //ETX 00205 00206 private: 00207 vtkPBGLDistributedGraphHelper(const vtkPBGLDistributedGraphHelper&); // Not implemented 00208 void operator=(const vtkPBGLDistributedGraphHelper&); // Not implemented 00209 00210 //BTX 00211 friend class vtkPBGLDistributedGraphHelperInternals; 00212 //ETX 00213 }; 00214 00215 #endif // __vtkPBGLDistributedGraphHelper_h