Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r82010 - in trunk/boost/graph: . detail distributed
From: jewillco_at_[hidden]
Date: 2012-12-16 00:16:48


Author: jewillco
Date: 2012-12-16 00:16:47 EST (Sun, 16 Dec 2012)
New Revision: 82010
URL: http://svn.boost.org/trac/boost/changeset/82010

Log:
Trying to fix property map ambiguities with distributed graphs on Intel compiler
Added:
   trunk/boost/graph/detail/is_distributed_selector.hpp (contents, props changed)
Text files modified:
   trunk/boost/graph/adjacency_list.hpp | 1 +
   trunk/boost/graph/compressed_sparse_row_graph.hpp | 15 +++++++++------
   trunk/boost/graph/distributed/selector.hpp | 8 ++++++++
   trunk/boost/graph/properties.hpp | 2 +-
   4 files changed, 19 insertions(+), 7 deletions(-)

Modified: trunk/boost/graph/adjacency_list.hpp
==============================================================================
--- trunk/boost/graph/adjacency_list.hpp (original)
+++ trunk/boost/graph/adjacency_list.hpp 2012-12-16 00:16:47 EST (Sun, 16 Dec 2012)
@@ -188,6 +188,7 @@
 
   } // namespace detail
 
+ template <typename Selector> struct is_distributed_selector: mpl::false_ {};
 
 
   //===========================================================================

Modified: trunk/boost/graph/compressed_sparse_row_graph.hpp
==============================================================================
--- trunk/boost/graph/compressed_sparse_row_graph.hpp (original)
+++ trunk/boost/graph/compressed_sparse_row_graph.hpp 2012-12-16 00:16:47 EST (Sun, 16 Dec 2012)
@@ -37,7 +37,9 @@
 #include <boost/integer.hpp>
 #include <boost/iterator/iterator_facade.hpp>
 #include <boost/mpl/if.hpp>
+#include <boost/utility/enable_if.hpp>
 #include <boost/graph/graph_selectors.hpp>
+#include <boost/graph/detail/is_distributed_selector.hpp>
 #include <boost/graph/properties.hpp>
 #include <boost/static_assert.hpp>
 #include <boost/functional/hash.hpp>
@@ -1322,8 +1324,9 @@
   typedef transform_value_property_map<detail::lookup_one_property_f<const plist_type, Tag>, all_const_type> const_type;
 };
 
+// disable_if isn't truly necessary but required to avoid ambiguity with specializations below
 template <BOOST_CSR_GRAPH_TEMPLATE_PARMS, typename Tag>
-struct property_map<BOOST_CSR_GRAPH_TYPE, Tag>:
+struct property_map<BOOST_CSR_GRAPH_TYPE, Tag, typename disable_if<detail::is_distributed_selector<Vertex> >::type>:
   csr_property_map_helper<
     BOOST_CSR_GRAPH_TYPE,
     Tag,
@@ -1370,35 +1373,35 @@
 }
 
 template<BOOST_CSR_GRAPH_TEMPLATE_PARMS>
-struct property_map<BOOST_CSR_GRAPH_TYPE, vertex_index_t>
+struct property_map<BOOST_CSR_GRAPH_TYPE, vertex_index_t, typename disable_if<detail::is_distributed_selector<Vertex> >::type>
 {
   typedef typed_identity_property_map<Vertex> type;
   typedef type const_type;
 };
 
 template<BOOST_CSR_GRAPH_TEMPLATE_PARMS>
-struct property_map<BOOST_CSR_GRAPH_TYPE, edge_index_t>
+struct property_map<BOOST_CSR_GRAPH_TYPE, edge_index_t, typename disable_if<detail::is_distributed_selector<Vertex> >::type>
 {
   typedef detail::csr_edge_index_map<Vertex, EdgeIndex> type;
   typedef type const_type;
 };
 
 template<BOOST_CSR_GRAPH_TEMPLATE_PARMS>
-struct property_map<BOOST_CSR_GRAPH_TYPE, vertex_all_t>
+struct property_map<BOOST_CSR_GRAPH_TYPE, vertex_all_t, typename disable_if<detail::is_distributed_selector<Vertex> >::type>
 {
   typedef typename BOOST_CSR_GRAPH_TYPE::inherited_vertex_properties::vertex_map_type type;
   typedef typename BOOST_CSR_GRAPH_TYPE::inherited_vertex_properties::const_vertex_map_type const_type;
 };
 
 template<BOOST_CSR_GRAPH_TEMPLATE_PARMS>
-struct property_map<BOOST_CSR_GRAPH_TYPE, edge_all_t>
+struct property_map<BOOST_CSR_GRAPH_TYPE, edge_all_t, typename disable_if<detail::is_distributed_selector<Vertex> >::type>
 {
   typedef typename BOOST_CSR_GRAPH_TYPE::forward_type::inherited_edge_properties::edge_map_type type;
   typedef typename BOOST_CSR_GRAPH_TYPE::forward_type::inherited_edge_properties::const_edge_map_type const_type;
 };
 
 template<BOOST_CSR_GRAPH_TEMPLATE_PARMS>
-struct property_map<BOOST_CSR_GRAPH_TYPE, graph_all_t>
+struct property_map<BOOST_CSR_GRAPH_TYPE, graph_all_t, typename disable_if<detail::is_distributed_selector<Vertex> >::type>
 {
   typedef boost::ref_property_map<BOOST_CSR_GRAPH_TYPE*, typename BOOST_CSR_GRAPH_TYPE::graph_property_type> type;
   typedef boost::ref_property_map<BOOST_CSR_GRAPH_TYPE*, const typename BOOST_CSR_GRAPH_TYPE::graph_property_type> const_type;

Added: trunk/boost/graph/detail/is_distributed_selector.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/graph/detail/is_distributed_selector.hpp 2012-12-16 00:16:47 EST (Sun, 16 Dec 2012)
@@ -0,0 +1,26 @@
+// Copyright 2012 The Trustees of Indiana University.
+
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// Authors: Jeremiah Willcock
+// Andrew Lumsdaine
+
+// Selector to determine whether a selector is distributedS (can only be true
+// if <boost/graph/distributed/selector.hpp> has been included) so that we can
+// disable various sequential-graph-only traits specializations for distributed
+// graphs.
+
+#ifndef BOOST_GRAPH_DETAIL_IS_DISTRIBUTED_SELECTOR_HPP
+#define BOOST_GRAPH_DETAIL_IS_DISTRIBUTED_SELECTOR_HPP
+
+#include <boost/mpl/bool.hpp>
+
+namespace boost {
+ namespace detail {
+ template <typename> struct is_distributed_selector: boost::mpl::false_ {};
+ }
+}
+
+#endif // BOOST_GRAPH_DETAIL_IS_DISTRIBUTED_SELECTOR_HPP

Modified: trunk/boost/graph/distributed/selector.hpp
==============================================================================
--- trunk/boost/graph/distributed/selector.hpp (original)
+++ trunk/boost/graph/distributed/selector.hpp 2012-12-16 00:16:47 EST (Sun, 16 Dec 2012)
@@ -13,6 +13,8 @@
 #error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included"
 #endif
 
+#include <boost/graph/detail/is_distributed_selector.hpp>
+
 namespace boost {
 
   /* The default local selector for a distributedS selector. */
@@ -31,6 +33,12 @@
     typedef LocalS local_selector;
     typedef DistributionS distribution;
   };
+
+ namespace detail {
+ template<typename ProcessGroup, typename LocalS, typename DistributionS>
+ struct is_distributed_selector<distributedS<ProcessGroup, LocalS, DistributionS> >: mpl::true_ {};
+ }
+
 }
 
 #endif // BOOST_GRAPH_DISTRIBUTED_SELECTOR_HPP

Modified: trunk/boost/graph/properties.hpp
==============================================================================
--- trunk/boost/graph/properties.hpp (original)
+++ trunk/boost/graph/properties.hpp 2012-12-16 00:16:47 EST (Sun, 16 Dec 2012)
@@ -224,7 +224,7 @@
       {};
   } // namespace detail
 
- template <class Graph, class Property>
+ template <class Graph, class Property, class Enable = void>
   struct property_map:
     mpl::if_<
       is_same<typename detail::property_kind_from_graph<Graph, Property>::type, edge_property_tag>,


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk