annotate DEPENDENCIES/generic/include/boost/graph/distributed/adjlist/handlers.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // Copyright (C) 2007 Douglas Gregor
Chris@16 2
Chris@16 3 // Use, modification and distribution is subject to the Boost Software
Chris@16 4 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 5 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 6
Chris@16 7 // This file contains code for the distributed adjacency list's
Chris@16 8 // message handlers. It should not be included directly by users.
Chris@16 9
Chris@16 10 #ifndef BOOST_GRAPH_DISTRIBUTED_ADJLIST_HANDLERS_HPP
Chris@16 11 #define BOOST_GRAPH_DISTRIBUTED_ADJLIST_HANDLERS_HPP
Chris@16 12
Chris@16 13 #ifndef BOOST_GRAPH_USE_MPI
Chris@16 14 #error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included"
Chris@16 15 #endif
Chris@16 16
Chris@16 17 #include <boost/graph/parallel/simple_trigger.hpp>
Chris@16 18 #include <boost/graph/parallel/detail/untracked_pair.hpp>
Chris@16 19
Chris@16 20 namespace boost {
Chris@16 21
Chris@16 22 template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS>
Chris@16 23 void
Chris@16 24 PBGL_DISTRIB_ADJLIST_TYPE::
Chris@16 25 setup_triggers()
Chris@16 26 {
Chris@16 27 using boost::graph::parallel::simple_trigger;
Chris@16 28
Chris@16 29 simple_trigger(process_group_, msg_add_vertex_with_property, this,
Chris@16 30 &adjacency_list::handle_add_vertex_with_property);
Chris@16 31 simple_trigger(process_group_, msg_add_vertex_with_property_and_reply, this,
Chris@16 32 &adjacency_list::handle_add_vertex_with_property_and_reply);
Chris@16 33 simple_trigger(process_group_, msg_add_edge, this,
Chris@16 34 &adjacency_list::handle_add_edge);
Chris@16 35 simple_trigger(process_group_, msg_add_edge_with_reply, this,
Chris@16 36 &adjacency_list::handle_add_edge_with_reply);
Chris@16 37 simple_trigger(process_group_, msg_add_edge_with_property, this,
Chris@16 38 &adjacency_list::handle_add_edge_with_property);
Chris@16 39 simple_trigger(process_group_, msg_add_edge_with_property_and_reply, this,
Chris@16 40 &adjacency_list::handle_add_edge_with_property_and_reply);
Chris@16 41 simple_trigger(process_group_, msg_nonlocal_edge, this,
Chris@16 42 &adjacency_list::handle_nonlocal_edge);
Chris@16 43 simple_trigger(process_group_, msg_remove_edge, this,
Chris@16 44 &adjacency_list::handle_remove_edge);
Chris@16 45 }
Chris@16 46
Chris@16 47 template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS>
Chris@16 48 void
Chris@16 49 PBGL_DISTRIB_ADJLIST_TYPE::
Chris@16 50 handle_add_vertex_with_property(int source, int tag,
Chris@16 51 const vertex_property_type& data,
Chris@16 52 trigger_receive_context)
Chris@16 53 {
Chris@16 54 vertex_descriptor v(this->processor(),
Chris@16 55 add_vertex(this->build_vertex_property(data),
Chris@16 56 this->base()));
Chris@16 57 if (on_add_vertex)
Chris@16 58 on_add_vertex(v, *this);
Chris@16 59 }
Chris@16 60
Chris@16 61 template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS>
Chris@16 62 typename PBGL_DISTRIB_ADJLIST_TYPE::local_vertex_descriptor
Chris@16 63 PBGL_DISTRIB_ADJLIST_TYPE::
Chris@16 64 handle_add_vertex_with_property_and_reply(int source, int tag,
Chris@16 65 const vertex_property_type& data,
Chris@16 66 trigger_receive_context)
Chris@16 67 {
Chris@16 68 // Try to find a vertex with this name
Chris@16 69 local_vertex_descriptor local_v
Chris@16 70 = add_vertex(this->build_vertex_property(data), this->base());
Chris@16 71
Chris@16 72 vertex_descriptor v(processor(), local_v);
Chris@16 73 if (on_add_vertex)
Chris@16 74 on_add_vertex(v, *this);
Chris@16 75
Chris@16 76 return local_v;
Chris@16 77 }
Chris@16 78
Chris@16 79 template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS>
Chris@16 80 void
Chris@16 81 PBGL_DISTRIB_ADJLIST_TYPE::
Chris@16 82 handle_add_edge(int source, int tag, const msg_add_edge_data& data,
Chris@16 83 trigger_receive_context)
Chris@16 84 {
Chris@16 85 add_edge(vertex_descriptor(processor(), data.source),
Chris@16 86 data.target, *this);
Chris@16 87 }
Chris@16 88
Chris@16 89 template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS>
Chris@16 90 boost::parallel::detail::untracked_pair<typename PBGL_DISTRIB_ADJLIST_TYPE::edge_descriptor, bool>
Chris@16 91 PBGL_DISTRIB_ADJLIST_TYPE::
Chris@16 92 handle_add_edge_with_reply(int source, int tag, const msg_add_edge_data& data,
Chris@16 93 trigger_receive_context)
Chris@16 94 {
Chris@16 95 std::pair<typename PBGL_DISTRIB_ADJLIST_TYPE::edge_descriptor, bool> p =
Chris@16 96 add_edge(vertex_descriptor(processor(), data.source),data.target, *this);
Chris@16 97 return p;
Chris@16 98 }
Chris@16 99
Chris@16 100 template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS>
Chris@16 101 void
Chris@16 102 PBGL_DISTRIB_ADJLIST_TYPE::
Chris@16 103 handle_add_edge_with_property(int source, int tag,
Chris@16 104 const msg_add_edge_with_property_data& data,
Chris@16 105 trigger_receive_context)
Chris@16 106 {
Chris@16 107 add_edge(vertex_descriptor(processor(), data.source),
Chris@16 108 data.target, data.get_property(), *this);
Chris@16 109 }
Chris@16 110
Chris@16 111 template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS>
Chris@16 112 boost::parallel::detail::untracked_pair<typename PBGL_DISTRIB_ADJLIST_TYPE::edge_descriptor, bool>
Chris@16 113 PBGL_DISTRIB_ADJLIST_TYPE::
Chris@16 114 handle_add_edge_with_property_and_reply
Chris@16 115 (int source, int tag,
Chris@16 116 const msg_add_edge_with_property_data& data,
Chris@16 117 trigger_receive_context)
Chris@16 118 {
Chris@16 119 std::pair<typename PBGL_DISTRIB_ADJLIST_TYPE::edge_descriptor, bool> p =
Chris@16 120 add_edge(vertex_descriptor(processor(), data.source),
Chris@16 121 data.target, data.get_property(), *this);
Chris@16 122 return p;
Chris@16 123 }
Chris@16 124
Chris@16 125 template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS>
Chris@16 126 void
Chris@16 127 PBGL_DISTRIB_ADJLIST_TYPE::
Chris@16 128 handle_nonlocal_edge(int source, int tag,
Chris@16 129 const msg_nonlocal_edge_data& data,
Chris@16 130 trigger_receive_context)
Chris@16 131 {
Chris@16 132 add_remote_edge(data, source, directed_selector());
Chris@16 133 }
Chris@16 134
Chris@16 135 template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS>
Chris@16 136 void
Chris@16 137 PBGL_DISTRIB_ADJLIST_TYPE::
Chris@16 138 handle_remove_edge(int source, int tag,
Chris@16 139 const msg_remove_edge_data& data,
Chris@16 140 trigger_receive_context)
Chris@16 141 {
Chris@16 142 remove_local_edge(data, source, directed_selector());
Chris@16 143 }
Chris@16 144
Chris@16 145 }
Chris@16 146
Chris@16 147 #endif // BOOST_GRAPH_DISTRIBUTED_ADJLIST_HANDLERS_HPP
Chris@16 148