VTK
|
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 "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 vtkTypeMacro(vtkPBGLDistributedGraphHelper,vtkDistributedGraphHelper); 00057 00059 static vtkPBGLDistributedGraphHelper* New(); 00060 00067 void Synchronize(); 00068 00070 vtkDistributedGraphHelper *Clone(); 00071 00072 //BTX 00074 00075 boost::graph::distributed::mpi_process_group GetProcessGroup(); 00076 //ETX 00078 00081 vtkPBGLDistributedGraphHelperInternals *Internals; 00082 00083 void PrintSelf(ostream& os, vtkIndent indent); 00084 00085 protected: 00086 vtkPBGLDistributedGraphHelper(); 00087 ~vtkPBGLDistributedGraphHelper(); 00088 00089 //BTX 00090 enum Tags 00091 { 00092 // Find a vertex by pedigree ID. This always has a reply. 00093 FIND_VERTEX_TAG, 00094 00095 // Find the source and target by edge ID. This always has a reply. 00096 FIND_EDGE_SOURCE_TARGET_TAG, 00097 00098 // Add a vertex with the given pedigree ID. 00099 ADD_VERTEX_NO_REPLY_TAG, 00100 ADD_VERTEX_WITH_REPLY_TAG, 00101 00102 // Add a vertex with the given property array. 00103 ADD_VERTEX_PROPS_NO_REPLY_TAG, 00104 ADD_VERTEX_PROPS_WITH_REPLY_TAG, 00105 00106 // Add a back edge; the forward edge has already been added. 00107 ADD_DIRECTED_BACK_EDGE_TAG, 00108 ADD_UNDIRECTED_BACK_EDGE_TAG, 00109 00110 // Add an edge; don't reply. 00111 ADD_DIRECTED_EDGE_NO_REPLY_TAG, 00112 ADD_UNDIRECTED_EDGE_NO_REPLY_TAG, 00113 00114 // Add an edge; return the edge ID. 00115 ADD_DIRECTED_EDGE_WITH_REPLY_TAG, 00116 ADD_UNDIRECTED_EDGE_WITH_REPLY_TAG, 00117 00118 // Add an edge via (pedigree, id); don't reply. 00119 ADD_DIRECTED_EDGE_NI_NO_REPLY_TAG, 00120 ADD_UNDIRECTED_EDGE_NI_NO_REPLY_TAG, 00121 00122 // Add an edge via (pedigree, id); return the edge ID. 00123 ADD_DIRECTED_EDGE_NI_WITH_REPLY_TAG, 00124 ADD_UNDIRECTED_EDGE_NI_WITH_REPLY_TAG, 00125 00126 // Add an edge via (id, pedigree); don't reply. 00127 ADD_DIRECTED_EDGE_IN_NO_REPLY_TAG, 00128 ADD_UNDIRECTED_EDGE_IN_NO_REPLY_TAG, 00129 00130 // Add an edge via (pedigree, pedigree); don't reply. 00131 ADD_DIRECTED_EDGE_NN_NO_REPLY_TAG, 00132 ADD_UNDIRECTED_EDGE_NN_NO_REPLY_TAG 00133 00134 }; 00135 00137 00142 void AddVertexInternal(vtkVariantArray *propertyArr, 00143 vtkIdType *vertex); 00145 00148 void AddVertexInternal(const vtkVariant& pedigreeId, vtkIdType *vertex); 00149 00151 00155 void AddEdgeInternal(vtkIdType u, vtkIdType v, bool directed, 00156 vtkVariantArray *propertyArr, 00157 vtkEdgeType *edge); 00159 00161 00167 void AddEdgeInternal(const vtkVariant& uPedigreeId, vtkIdType v, 00168 bool directed, vtkVariantArray *propertyArr, 00169 vtkEdgeType *edge); 00171 00173 00179 void AddEdgeInternal(vtkIdType u, const vtkVariant& vPedigreeId, 00180 bool directed, vtkVariantArray *propertyArr, 00181 vtkEdgeType *edge); 00183 00185 00192 void AddEdgeInternal(const vtkVariant& uPedigreeId, 00193 const vtkVariant& vPedigreeId, 00194 bool directed, vtkVariantArray *propertyArr, 00195 vtkEdgeType *edge); 00197 00200 vtkIdType FindVertex(const vtkVariant& pedigreeId); 00201 00203 00206 void FindEdgeSourceAndTarget(vtkIdType id, 00207 vtkIdType *source, vtkIdType *target); 00209 00211 00213 void AttachToGraph(vtkGraph *graph); 00214 //ETX 00216 00217 private: 00218 vtkPBGLDistributedGraphHelper(const vtkPBGLDistributedGraphHelper&); // Not implemented 00219 void operator=(const vtkPBGLDistributedGraphHelper&); // Not implemented 00220 00221 //BTX 00222 friend class vtkPBGLDistributedGraphHelperInternals; 00223 //ETX 00224 }; 00225 00226 #endif // __vtkPBGLDistributedGraphHelper_h