29 #ifndef vtkPBGLGraphAdapter_h
30 #define vtkPBGLGraphAdapter_h
35 #include <boost/graph/use_mpi.hpp>
36 #include <boost/graph/distributed/mpi_process_group.hpp>
37 #include <boost/graph/properties.hpp>
38 #include <boost/graph/parallel/container_traits.hpp>
39 #include <boost/property_map/parallel/local_property_map.hpp>
40 #include <boost/property_map/parallel/distributed_property_map.hpp>
41 #include <boost/serialization/base_object.hpp>
42 #include <boost/functional/hash.hpp>
52 #define SUBCLASS_PROPERTY_MAP_SPECIALIZATIONS(Property) \
54 struct property_map<vtkDirectedGraph *, Property> \
55 : property_map<vtkGraph *, Property> { }; \
58 struct property_map<vtkUndirectedGraph *, Property> \
59 : property_map<vtkGraph *, Property> { }; \
62 struct property_map<vtkDirectedGraph * const, Property> \
63 : property_map<vtkGraph *, Property> { }; \
66 struct property_map<vtkUndirectedGraph * const, Property> \
67 : property_map<vtkGraph *, Property> { }
77 :
helper(graph? graph->GetDistributedGraphHelper() : 0) { }
130 :
helper(graph? graph->GetDistributedGraphHelper() : 0) { }
180 :
helper(graph? graph->GetDistributedGraphHelper() : 0) { }
225 :
helper(graph? graph->GetDistributedGraphHelper() : 0) { }
244 return std::pair<int, vtkIdType>
264 #undef SUBCLASS_PROPERTY_MAP_SPECIALIZATIONS
273 return hash_value(edge.
Id);
283 namespace boost {
namespace graph {
namespace parallel {
287 typedef boost::graph::distributed::mpi_process_group
type;
309 inline boost::graph::distributed::mpi_process_group
315 inline boost::graph::distributed::mpi_process_group
326 template<
typename Archiver>
332 template<
typename Archiver>
335 ar & boost::serialization::base_object<vtkEdgeBase>(edge)
339 template<
typename Archiver>
342 ar & boost::serialization::base_object<vtkEdgeBase>(edge)
346 template<
typename Archiver>
349 ar & boost::serialization::base_object<vtkEdgeBase>(edge)
365 typedef boost::local_property_map<boost::graph::distributed::mpi_process_group,
380 vtkErrorWithObjectMacro(graph,
"A vtkGraph without a distributed graph helper is not a distributed graph");
389 vtkErrorWithObjectMacro(graph,
"A vtkGraph with a non-Parallel BGL distributed graph helper cannot be used with the Parallel BGL");
403 template<
typename DataArray>
406 typedef boost::parallel::distributed_property_map<
407 boost::graph::distributed::mpi_process_group,
417 template<
typename DataArray>
426 vtkErrorWithObjectMacro(graph,
"A vtkGraph without a distributed graph helper is not a distributed graph");
434 vtkErrorWithObjectMacro(graph,
"A vtkGraph with a non-Parallel BGL distributed graph helper cannot be used with the Parallel BGL");
448 template<
typename DataArray>
451 typedef boost::parallel::distributed_property_map<
452 boost::graph::distributed::mpi_process_group,
462 template<
typename DataArray>
471 vtkErrorWithObjectMacro(graph,
"A vtkGraph without a distributed graph helper is not a distributed graph");
479 vtkErrorWithObjectMacro(graph,
"A vtkGraph with a non-Parallel BGL distributed graph helper cannot be used with the Parallel BGL");
helper for the vtkGraph class that allows the graph to be distributed across multiple memory spaces.
vtkIdType GetEdgeOwner(vtkIdType e_id) const
Returns owner of edge with ID e_id, by extracting top ceil(log2 P) bits of e_id.
vtkIdType GetVertexOwner(vtkIdType v) const
Returns owner of vertex v, by extracting top ceil(log2 P) bits of v.
vtkIdType GetVertexIndex(vtkIdType v) const
Returns local index of vertex v, by masking off top ceil(log2 P) bits of v.
Base class for graph data types.
vtkDistributedGraphHelper * GetDistributedGraphHelper()
Retrieves the distributed graph helper for this graph.
end namespace boost::graph::distributed
boost::graph::distributed::mpi_process_group GetProcessGroup()
Return the process group associated with this distributed graph.
static vtkPBGLDistributedGraphHelper * SafeDownCast(vtkObjectBase *o)
Forward declaration required for Boost serialization.
double get(vtkDataArray *const &arr, vtkIdType key)
SUBCLASS_PROPERTY_MAP_SPECIALIZATIONS(vertex_owner_t)
boost::graph::distributed::mpi_process_group type
std::size_t operator()(const vtkEdgeType &edge) const
vtkEdgeGlobalMap const_type
vtkVertexGlobalMap const_type
vtkVertexLocalMap const_type
vtkVertexOwnerMap const_type
std::pair< int, vtkIdType > value_type
readable_property_map_tag category
std::pair< int, vtkIdType > value_type
readable_property_map_tag category
readable_property_map_tag category
readable_property_map_tag category
vtkDistributedGraphHelper * helper
vtkEdgeGlobalMap(vtkGraph *graph)
vtkVertexGlobalMap(vtkGraph *graph)
vtkDistributedGraphHelper * helper
vtkVertexLocalMap(vtkGraph *graph)
vtkDistributedGraphHelper * helper
vtkVertexOwnerMap(vtkGraph *graph)
vtkDistributedGraphHelper * helper
Retrieves the type of the distributed property map indexed by the edges of a distributed graph.
boost::parallel::distributed_property_map< boost::graph::distributed::mpi_process_group, boost::vtkEdgeGlobalMap, DataArray * > type
Retrieves the type of the distributed property map indexed by the vertices of a distributed graph.
boost::parallel::distributed_property_map< boost::graph::distributed::mpi_process_group, boost::vtkVertexGlobalMap, DataArray * > type
vtkGraphDistributedVertexIndexMap MakeDistributedVertexIndexMap(vtkGraph *graph)
Creates the distributed vertex index property map for a vtkGraph.
boost::graph::distributed::mpi_process_group process_group(vtkGraph *graph)
void serialize(Archiver &ar, vtkEdgeBase &edge, const unsigned int)
boost::local_property_map< boost::graph::distributed::mpi_process_group, boost::vtkVertexGlobalMap, boost::vtkGraphIndexMap > vtkGraphDistributedVertexIndexMap
A property map used as the vertex index map for distributed vtkGraphs.
vtkDistributedEdgePropertyMapType< DataArray >::type MakeDistributedEdgePropertyMap(vtkGraph *graph, DataArray *array)
Build a distributed property map indexed by the edges of the given graph, using storage from the give...
vtkDistributedVertexPropertyMapType< DataArray >::type MakeDistributedVertexPropertyMap(vtkGraph *graph, DataArray *array)
Build a distributed property map indexed by the vertices of the given graph, using storage from the g...