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/detail/iterator.hpp>
23 #include <boost/concept_archetype.hpp>
24 #include <boost/mpl/assert.hpp>
25 #include <boost/mpl/or.hpp>
26 #include <boost/mpl/and.hpp>
27 #include <boost/mpl/has_xxx.hpp>
28 #include <boost/type_traits/is_same.hpp>
29 #include <boost/property_map/property_map.hpp>
31 #include <boost/property_map/parallel/distributed_property_map.hpp>
32 #include <boost/property_map/parallel/local_property_map.hpp>
35 /** Distributed iterator property map.
37 * This specialization of @ref iterator_property_map builds a
38 * distributed iterator property map given the local index maps
39 * generated by distributed graph types that automatically have index
42 * This specialization is useful when creating external distributed
43 * property maps via the same syntax used to create external
44 * sequential property maps.
46 template<typename RandomAccessIterator, typename ProcessGroup,
47 typename GlobalMap, typename StorageMap,
48 typename ValueType, typename Reference>
49 class iterator_property_map
50 <RandomAccessIterator,
51 local_property_map<ProcessGroup, GlobalMap, StorageMap>,
53 : public parallel::distributed_property_map
56 iterator_property_map<RandomAccessIterator, StorageMap,
57 ValueType, Reference> >
59 typedef iterator_property_map<RandomAccessIterator, StorageMap,
60 ValueType, Reference> local_iterator_map;
62 typedef parallel::distributed_property_map<ProcessGroup, GlobalMap,
63 local_iterator_map> inherited;
65 typedef local_property_map<ProcessGroup, GlobalMap, StorageMap>
67 typedef iterator_property_map self_type;
70 iterator_property_map() { }
72 iterator_property_map(RandomAccessIterator cc, const index_map_type& id)
73 : inherited(id.process_group(), id.global(),
74 local_iterator_map(cc, id.base())) { }
77 /** Distributed iterator property map.
79 * This specialization of @ref iterator_property_map builds a
80 * distributed iterator property map given a distributed index
81 * map. Only the local portion of the distributed index property map
84 * This specialization is useful when creating external distributed
85 * property maps via the same syntax used to create external
86 * sequential property maps.
88 template<typename RandomAccessIterator, typename ProcessGroup,
89 typename GlobalMap, typename StorageMap,
90 typename ValueType, typename Reference>
91 class iterator_property_map<
93 parallel::distributed_property_map<ProcessGroup,GlobalMap,StorageMap>,
96 : public parallel::distributed_property_map
99 iterator_property_map<RandomAccessIterator, StorageMap,
100 ValueType, Reference> >
102 typedef iterator_property_map<RandomAccessIterator, StorageMap,
103 ValueType, Reference> local_iterator_map;
105 typedef parallel::distributed_property_map<ProcessGroup, GlobalMap,
106 local_iterator_map> inherited;
108 typedef parallel::distributed_property_map<ProcessGroup, GlobalMap,
113 iterator_property_map() { }
115 iterator_property_map(RandomAccessIterator cc, const index_map_type& id)
116 : inherited(id.process_group(), id.global(),
117 local_iterator_map(cc, id.base())) { }
121 // Generate an iterator property map with a specific kind of ghost
123 template<typename RandomAccessIterator, typename ProcessGroup,
124 typename GlobalMap, typename StorageMap>
125 distributed_property_map<ProcessGroup,
127 iterator_property_map<RandomAccessIterator,
129 make_iterator_property_map(RandomAccessIterator cc,
130 local_property_map<ProcessGroup, GlobalMap,
131 StorageMap> index_map)
133 typedef distributed_property_map<
134 ProcessGroup, GlobalMap,
135 iterator_property_map<RandomAccessIterator, StorageMap> >
137 return result_type(index_map.process_group(), index_map.global(),
138 make_iterator_property_map(cc, index_map.base()));
141 } // end namespace parallel
143 /** Distributed safe iterator property map.
145 * This specialization of @ref safe_iterator_property_map builds a
146 * distributed iterator property map given the local index maps
147 * generated by distributed graph types that automatically have index
150 * This specialization is useful when creating external distributed
151 * property maps via the same syntax used to create external
152 * sequential property maps.
154 template<typename RandomAccessIterator, typename ProcessGroup,
155 typename GlobalMap, typename StorageMap, typename ValueType,
157 class safe_iterator_property_map
158 <RandomAccessIterator,
159 local_property_map<ProcessGroup, GlobalMap, StorageMap>,
160 ValueType, Reference>
161 : public parallel::distributed_property_map
164 safe_iterator_property_map<RandomAccessIterator, StorageMap,
165 ValueType, Reference> >
167 typedef safe_iterator_property_map<RandomAccessIterator, StorageMap,
168 ValueType, Reference> local_iterator_map;
170 typedef parallel::distributed_property_map<ProcessGroup, GlobalMap,
171 local_iterator_map> inherited;
173 typedef local_property_map<ProcessGroup, GlobalMap, StorageMap> index_map_type;
176 safe_iterator_property_map() { }
178 safe_iterator_property_map(RandomAccessIterator cc, std::size_t n,
179 const index_map_type& id)
180 : inherited(id.process_group(), id.global(),
181 local_iterator_map(cc, n, id.base())) { }
184 /** Distributed safe iterator property map.
186 * This specialization of @ref safe_iterator_property_map builds a
187 * distributed iterator property map given a distributed index
188 * map. Only the local portion of the distributed index property map
191 * This specialization is useful when creating external distributed
192 * property maps via the same syntax used to create external
193 * sequential property maps.
195 template<typename RandomAccessIterator, typename ProcessGroup,
196 typename GlobalMap, typename StorageMap,
197 typename ValueType, typename Reference>
198 class safe_iterator_property_map<
199 RandomAccessIterator,
200 parallel::distributed_property_map<ProcessGroup,GlobalMap,StorageMap>,
201 ValueType, Reference>
202 : public parallel::distributed_property_map
205 safe_iterator_property_map<RandomAccessIterator, StorageMap,
206 ValueType, Reference> >
208 typedef safe_iterator_property_map<RandomAccessIterator, StorageMap,
209 ValueType, Reference> local_iterator_map;
211 typedef parallel::distributed_property_map<ProcessGroup, GlobalMap,
212 local_iterator_map> inherited;
214 typedef parallel::distributed_property_map<ProcessGroup, GlobalMap,
219 safe_iterator_property_map() { }
221 safe_iterator_property_map(RandomAccessIterator cc, std::size_t n,
222 const index_map_type& id)
223 : inherited(id.process_group(), id.global(),
224 local_iterator_map(cc, n, id.base())) { }
229 #include <boost/property_map/vector_property_map.hpp>
231 #endif /* BOOST_PROPERTY_MAP_PARALLEL_PROPERTY_MAPS_HPP */