]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/property_map/parallel/parallel_property_maps.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / property_map / parallel / parallel_property_maps.hpp
1 // (C) Copyright Jeremy Siek 1999-2001.
2 // Copyright (C) 2006 Trustees of Indiana University
3 // Authors: Douglas Gregor and Jeremy Siek
4
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)
8
9 // See http://www.boost.org/libs/property_map for documentation.
10
11 #ifndef BOOST_PROPERTY_MAP_PARALLEL_PROPERTY_MAPS_HPP
12 #define BOOST_PROPERTY_MAP_PARALLEL_PROPERTY_MAPS_HPP
13
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
16 // library.
17
18 #include <boost/assert.hpp>
19 #include <boost/config.hpp>
20 #include <boost/static_assert.hpp>
21 #include <cstddef>
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>
30
31 #include <boost/property_map/parallel/distributed_property_map.hpp>
32 #include <boost/property_map/parallel/local_property_map.hpp>
33
34 namespace boost {
35 /** Distributed iterator property map.
36 *
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
40 * properties.
41 *
42 * This specialization is useful when creating external distributed
43 * property maps via the same syntax used to create external
44 * sequential property maps.
45 */
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>,
52 ValueType, Reference>
53 : public parallel::distributed_property_map
54 <ProcessGroup,
55 GlobalMap,
56 iterator_property_map<RandomAccessIterator, StorageMap,
57 ValueType, Reference> >
58 {
59 typedef iterator_property_map<RandomAccessIterator, StorageMap,
60 ValueType, Reference> local_iterator_map;
61
62 typedef parallel::distributed_property_map<ProcessGroup, GlobalMap,
63 local_iterator_map> inherited;
64
65 typedef local_property_map<ProcessGroup, GlobalMap, StorageMap>
66 index_map_type;
67 typedef iterator_property_map self_type;
68
69 public:
70 iterator_property_map() { }
71
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())) { }
75 };
76
77 /** Distributed iterator property map.
78 *
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
82 * is utilized.
83 *
84 * This specialization is useful when creating external distributed
85 * property maps via the same syntax used to create external
86 * sequential property maps.
87 */
88 template<typename RandomAccessIterator, typename ProcessGroup,
89 typename GlobalMap, typename StorageMap,
90 typename ValueType, typename Reference>
91 class iterator_property_map<
92 RandomAccessIterator,
93 parallel::distributed_property_map<ProcessGroup,GlobalMap,StorageMap>,
94 ValueType, Reference
95 >
96 : public parallel::distributed_property_map
97 <ProcessGroup,
98 GlobalMap,
99 iterator_property_map<RandomAccessIterator, StorageMap,
100 ValueType, Reference> >
101 {
102 typedef iterator_property_map<RandomAccessIterator, StorageMap,
103 ValueType, Reference> local_iterator_map;
104
105 typedef parallel::distributed_property_map<ProcessGroup, GlobalMap,
106 local_iterator_map> inherited;
107
108 typedef parallel::distributed_property_map<ProcessGroup, GlobalMap,
109 StorageMap>
110 index_map_type;
111
112 public:
113 iterator_property_map() { }
114
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())) { }
118 };
119
120 namespace parallel {
121 // Generate an iterator property map with a specific kind of ghost
122 // cells
123 template<typename RandomAccessIterator, typename ProcessGroup,
124 typename GlobalMap, typename StorageMap>
125 distributed_property_map<ProcessGroup,
126 GlobalMap,
127 iterator_property_map<RandomAccessIterator,
128 StorageMap> >
129 make_iterator_property_map(RandomAccessIterator cc,
130 local_property_map<ProcessGroup, GlobalMap,
131 StorageMap> index_map)
132 {
133 typedef distributed_property_map<
134 ProcessGroup, GlobalMap,
135 iterator_property_map<RandomAccessIterator, StorageMap> >
136 result_type;
137 return result_type(index_map.process_group(), index_map.global(),
138 make_iterator_property_map(cc, index_map.base()));
139 }
140
141 } // end namespace parallel
142
143 /** Distributed safe iterator property map.
144 *
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
148 * properties.
149 *
150 * This specialization is useful when creating external distributed
151 * property maps via the same syntax used to create external
152 * sequential property maps.
153 */
154 template<typename RandomAccessIterator, typename ProcessGroup,
155 typename GlobalMap, typename StorageMap, typename ValueType,
156 typename Reference>
157 class safe_iterator_property_map
158 <RandomAccessIterator,
159 local_property_map<ProcessGroup, GlobalMap, StorageMap>,
160 ValueType, Reference>
161 : public parallel::distributed_property_map
162 <ProcessGroup,
163 GlobalMap,
164 safe_iterator_property_map<RandomAccessIterator, StorageMap,
165 ValueType, Reference> >
166 {
167 typedef safe_iterator_property_map<RandomAccessIterator, StorageMap,
168 ValueType, Reference> local_iterator_map;
169
170 typedef parallel::distributed_property_map<ProcessGroup, GlobalMap,
171 local_iterator_map> inherited;
172
173 typedef local_property_map<ProcessGroup, GlobalMap, StorageMap> index_map_type;
174
175 public:
176 safe_iterator_property_map() { }
177
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())) { }
182 };
183
184 /** Distributed safe iterator property map.
185 *
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
189 * is utilized.
190 *
191 * This specialization is useful when creating external distributed
192 * property maps via the same syntax used to create external
193 * sequential property maps.
194 */
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
203 <ProcessGroup,
204 GlobalMap,
205 safe_iterator_property_map<RandomAccessIterator, StorageMap,
206 ValueType, Reference> >
207 {
208 typedef safe_iterator_property_map<RandomAccessIterator, StorageMap,
209 ValueType, Reference> local_iterator_map;
210
211 typedef parallel::distributed_property_map<ProcessGroup, GlobalMap,
212 local_iterator_map> inherited;
213
214 typedef parallel::distributed_property_map<ProcessGroup, GlobalMap,
215 StorageMap>
216 index_map_type;
217
218 public:
219 safe_iterator_property_map() { }
220
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())) { }
225 };
226
227 }
228
229 #include <boost/property_map/vector_property_map.hpp>
230
231 #endif /* BOOST_PROPERTY_MAP_PARALLEL_PROPERTY_MAPS_HPP */
232