diff --git a/include/boost/graph/distributed/one_bit_color_map.hpp b/include/boost/graph/distributed/one_bit_color_map.hpp new file mode 100644 index 0000000..0a5704a --- /dev/null +++ b/include/boost/graph/distributed/one_bit_color_map.hpp @@ -0,0 +1,116 @@ +// Copyright (C) 2006-2010 The Trustees of Indiana University. + +// Use, modification and distribution is subject to 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: Douglas Gregor +// Jeremiah Willcock +// Andrew Lumsdaine + +// Distributed version of the one-bit color map +#ifndef BOOST_DISTRIBUTED_ONE_BIT_COLOR_MAP_HPP +#define BOOST_DISTRIBUTED_ONE_BIT_COLOR_MAP_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include +#include +#include + +namespace boost { + +template +class one_bit_color_map > + : public parallel::distributed_property_map > +{ + typedef one_bit_color_map local_map; + + typedef parallel::distributed_property_map + inherited; + + typedef local_property_map + index_map_type; + +public: + one_bit_color_map(std::size_t inital_size, + const index_map_type& index = index_map_type()) + : inherited(index.process_group(), index.global(), + local_map(inital_size, index.base())) { } + + inherited& base() { return *this; } + const inherited& base() const { return *this; } +}; + +template +inline one_bit_color_type +get(one_bit_color_map > + const& pm, + typename property_traits::key_type key) +{ + return get(pm.base(), key); +} + +template +inline void +put(one_bit_color_map > + const& pm, + typename property_traits::key_type key, + one_bit_color_type value) +{ + put(pm.base(), key, value); +} + +template +class one_bit_color_map > + : public parallel::distributed_property_map< + ProcessGroup, GlobalMap, one_bit_color_map > +{ + typedef one_bit_color_map local_map; + + typedef parallel::distributed_property_map + inherited; + + typedef parallel::distributed_property_map + index_map_type; + +public: + one_bit_color_map(std::size_t inital_size, + const index_map_type& index = index_map_type()) + : inherited(index.process_group(), index.global(), + local_map(inital_size, index.base())) { } + + inherited& base() { return *this; } + const inherited& base() const { return *this; } +}; + +template +inline one_bit_color_type +get(one_bit_color_map< + parallel::distributed_property_map< + ProcessGroup, GlobalMap, one_bit_color_map > > const& pm, + typename property_traits::key_type key) +{ + return get(pm.base(), key); +} + +template +inline void +put(one_bit_color_map< + parallel::distributed_property_map< + ProcessGroup, GlobalMap, one_bit_color_map > > const& pm, + typename property_traits::key_type key, + one_bit_color_type value) +{ + put(pm.base(), key, value); +} + +} // end namespace boost + +#endif // BOOST_DISTRIBUTED_ONE_BIT_COLOR_MAP_HPP diff --git a/include/boost/graph/distributed/two_bit_color_map.hpp b/include/boost/graph/distributed/two_bit_color_map.hpp index eb8e29e..d7ec6bd 100644 --- a/include/boost/graph/distributed/two_bit_color_map.hpp +++ b/include/boost/graph/distributed/two_bit_color_map.hpp @@ -50,7 +50,7 @@ template inline two_bit_color_type get(two_bit_color_map > const& pm, - typename two_bit_color_map::key_type key) + typename property_traits::key_type key) { return get(pm.base(), key); } @@ -59,7 +59,7 @@ template inline void put(two_bit_color_map > const& pm, - typename two_bit_color_map::key_type key, + typename property_traits::key_type key, two_bit_color_type value) { put(pm.base(), key, value); @@ -95,7 +95,7 @@ inline two_bit_color_type get(two_bit_color_map< parallel::distributed_property_map< ProcessGroup, GlobalMap, two_bit_color_map > > const& pm, - typename two_bit_color_map::key_type key) + typename property_traits::key_type key) { return get(pm.base(), key); } @@ -105,7 +105,7 @@ inline void put(two_bit_color_map< parallel::distributed_property_map< ProcessGroup, GlobalMap, two_bit_color_map > > const& pm, - typename two_bit_color_map::key_type key, + typename property_traits::key_type key, two_bit_color_type value) { put(pm.base(), key, value); diff --git a/test/distributed_connected_components_test.cpp b/test/distributed_connected_components_test.cpp index 5486fa0..68ba53c 100644 --- a/test/distributed_connected_components_test.cpp +++ b/test/distributed_connected_components_test.cpp @@ -98,7 +98,7 @@ test_distributed_connected_components(int n, double _p, bool verify, bool emit_d // erdos_renyi_iterator(), // n, pg, distrib); - int m = n * n * _p/2; + int m = int(n * n * _p/2); double a = 0.57, b = 0.19, c = 0.19, d = 0.05; // Last boolean parameter makes R-MAT bidirectional diff --git a/test/distributed_csr_algorithm_test.cpp b/test/distributed_csr_algorithm_test.cpp index 0fc770e..fffb947 100644 --- a/test/distributed_csr_algorithm_test.cpp +++ b/test/distributed_csr_algorithm_test.cpp @@ -243,7 +243,7 @@ int test_main(int argc, char* argv[]) make_generator_iterator(gen, uniform_int(0, C)), n); Digraph g2(SWIter(gen, n, k, prob), SWIter(), n); - Digraph g3(RMATIter(gen, n, (n*n*prob), a, b, c, d), RMATIter(), n); + Digraph g3(RMATIter(gen, n, size_t(n*n*prob), a, b, c, d), RMATIter(), n); // Test BFS breadth_first_search(g, vertex(0, g), visitor(bfs_visitor<>()));