1 // (C) Copyright Jeremy Siek 1999-2001.
2 // Copyright (C) 2006 Trustees of Indiana University
3 // Authors: Douglas Gregor and Jeremy Siek
5 // Distributed under the Boost Software License, Version 1.0. (See
6 // accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 // See http://www.boost.org/libs/property_map for documentation.
11 #ifndef BOOST_PROPERTY_MAP_PARALLEL_PROPERTY_MAPS_HPP
12 #define BOOST_PROPERTY_MAP_PARALLEL_PROPERTY_MAPS_HPP
14 // Parallel property maps moved over from <boost/property_map/property_map.hpp>
15 // as part of refactoring out all parallel code from sequential property map
18 #include <boost/assert.hpp>
19 #include <boost/config.hpp>
20 #include <boost/static_assert.hpp>
22 #include <boost/concept_archetype.hpp>
23 #include <boost/mpl/assert.hpp>
24 #include <boost/mpl/or.hpp>
25 #include <boost/mpl/and.hpp>
26 #include <boost/mpl/has_xxx.hpp>
27 #include <boost/type_traits/is_same.hpp>
28 #include <boost/property_map/property_map.hpp>
30 #include <boost/property_map/parallel/distributed_property_map.hpp>
31 #include <boost/property_map/parallel/local_property_map.hpp>
34 /** Distributed iterator property map.
36 * This specialization of @ref iterator_property_map builds a
37 * distributed iterator property map given the local index maps
38 * generated by distributed graph types that automatically have index
41 * This specialization is useful when creating external distributed
42 * property maps via the same syntax used to create external
43 * sequential property maps.
45 template<typename RandomAccessIterator, typename ProcessGroup,
46 typename GlobalMap, typename StorageMap,
47 typename ValueType, typename Reference>
48 class iterator_property_map
49 <RandomAccessIterator,
50 local_property_map<ProcessGroup, GlobalMap, StorageMap>,
52 : public parallel::distributed_property_map
55 iterator_property_map<RandomAccessIterator, StorageMap,
56 ValueType, Reference> >
58 typedef iterator_property_map<RandomAccessIterator, StorageMap,
59 ValueType, Reference> local_iterator_map;
61 typedef parallel::distributed_property_map<ProcessGroup, GlobalMap,
62 local_iterator_map> inherited;
64 typedef local_property_map<ProcessGroup, GlobalMap, StorageMap>
66 typedef iterator_property_map self_type;
69 iterator_property_map() { }
71 iterator_property_map(RandomAccessIterator cc, const index_map_type& id)
72 : inherited(id.process_group(), id.global(),
73 local_iterator_map(cc, id.base())) { }
76 /** Distributed iterator property map.
78 * This specialization of @ref iterator_property_map builds a
79 * distributed iterator property map given a distributed index
80 * map. Only the local portion of the distributed index property map
83 * This specialization is useful when creating external distributed
84 * property maps via the same syntax used to create external
85 * sequential property maps.
87 template<typename RandomAccessIterator, typename ProcessGroup,
88 typename GlobalMap, typename StorageMap,
89 typename ValueType, typename Reference>
90 class iterator_property_map<
92 parallel::distributed_property_map<ProcessGroup,GlobalMap,StorageMap>,
95 : public parallel::distributed_property_map
98 iterator_property_map<RandomAccessIterator, StorageMap,
99 ValueType, Reference> >
101 typedef iterator_property_map<RandomAccessIterator, StorageMap,
102 ValueType, Reference> local_iterator_map;
104 typedef parallel::distributed_property_map<ProcessGroup, GlobalMap,
105 local_iterator_map> inherited;
107 typedef parallel::distributed_property_map<ProcessGroup, GlobalMap,
112 iterator_property_map() { }
114 iterator_property_map(RandomAccessIterator cc, const index_map_type& id)
115 : inherited(id.process_group(), id.global(),
116 local_iterator_map(cc, id.base())) { }
120 // Generate an iterator property map with a specific kind of ghost
122 template<typename RandomAccessIterator, typename ProcessGroup,
123 typename GlobalMap, typename StorageMap>
124 distributed_property_map<ProcessGroup,
126 iterator_property_map<RandomAccessIterator,
128 make_iterator_property_map(RandomAccessIterator cc,
129 local_property_map<ProcessGroup, GlobalMap,
130 StorageMap> index_map)
132 typedef distributed_property_map<
133 ProcessGroup, GlobalMap,
134 iterator_property_map<RandomAccessIterator, StorageMap> >
136 return result_type(index_map.process_group(), index_map.global(),
137 make_iterator_property_map(cc, index_map.base()));
140 } // end namespace parallel
142 /** Distributed safe iterator property map.
144 * This specialization of @ref safe_iterator_property_map builds a
145 * distributed iterator property map given the local index maps
146 * generated by distributed graph types that automatically have index
149 * This specialization is useful when creating external distributed
150 * property maps via the same syntax used to create external
151 * sequential property maps.
153 template<typename RandomAccessIterator, typename ProcessGroup,
154 typename GlobalMap, typename StorageMap, typename ValueType,
156 class safe_iterator_property_map
157 <RandomAccessIterator,
158 local_property_map<ProcessGroup, GlobalMap, StorageMap>,
159 ValueType, Reference>
160 : public parallel::distributed_property_map
163 safe_iterator_property_map<RandomAccessIterator, StorageMap,
164 ValueType, Reference> >
166 typedef safe_iterator_property_map<RandomAccessIterator, StorageMap,
167 ValueType, Reference> local_iterator_map;
169 typedef parallel::distributed_property_map<ProcessGroup, GlobalMap,
170 local_iterator_map> inherited;
172 typedef local_property_map<ProcessGroup, GlobalMap, StorageMap> index_map_type;
175 safe_iterator_property_map() { }
177 safe_iterator_property_map(RandomAccessIterator cc, std::size_t n,
178 const index_map_type& id)
179 : inherited(id.process_group(), id.global(),
180 local_iterator_map(cc, n, id.base())) { }
183 /** Distributed safe iterator property map.
185 * This specialization of @ref safe_iterator_property_map builds a
186 * distributed iterator property map given a distributed index
187 * map. Only the local portion of the distributed index property map
190 * This specialization is useful when creating external distributed
191 * property maps via the same syntax used to create external
192 * sequential property maps.
194 template<typename RandomAccessIterator, typename ProcessGroup,
195 typename GlobalMap, typename StorageMap,
196 typename ValueType, typename Reference>
197 class safe_iterator_property_map<
198 RandomAccessIterator,
199 parallel::distributed_property_map<ProcessGroup,GlobalMap,StorageMap>,
200 ValueType, Reference>
201 : public parallel::distributed_property_map
204 safe_iterator_property_map<RandomAccessIterator, StorageMap,
205 ValueType, Reference> >
207 typedef safe_iterator_property_map<RandomAccessIterator, StorageMap,
208 ValueType, Reference> local_iterator_map;
210 typedef parallel::distributed_property_map<ProcessGroup, GlobalMap,
211 local_iterator_map> inherited;
213 typedef parallel::distributed_property_map<ProcessGroup, GlobalMap,
218 safe_iterator_property_map() { }
220 safe_iterator_property_map(RandomAccessIterator cc, std::size_t n,
221 const index_map_type& id)
222 : inherited(id.process_group(), id.global(),
223 local_iterator_map(cc, n, id.base())) { }
228 #include <boost/property_map/vector_property_map.hpp>
230 #endif /* BOOST_PROPERTY_MAP_PARALLEL_PROPERTY_MAPS_HPP */