]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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_check.hpp> | |
24 | #include <boost/concept_archetype.hpp> | |
25 | #include <boost/mpl/assert.hpp> | |
26 | #include <boost/mpl/or.hpp> | |
27 | #include <boost/mpl/and.hpp> | |
28 | #include <boost/mpl/has_xxx.hpp> | |
29 | #include <boost/type_traits/is_same.hpp> | |
30 | #include <boost/property_map/property_map.hpp> | |
31 | ||
32 | #include <boost/property_map/parallel/distributed_property_map.hpp> | |
33 | #include <boost/property_map/parallel/local_property_map.hpp> | |
34 | ||
35 | namespace boost { | |
36 | /** Distributed iterator property map. | |
37 | * | |
38 | * This specialization of @ref iterator_property_map builds a | |
39 | * distributed iterator property map given the local index maps | |
40 | * generated by distributed graph types that automatically have index | |
41 | * properties. | |
42 | * | |
43 | * This specialization is useful when creating external distributed | |
44 | * property maps via the same syntax used to create external | |
45 | * sequential property maps. | |
46 | */ | |
47 | template<typename RandomAccessIterator, typename ProcessGroup, | |
48 | typename GlobalMap, typename StorageMap, | |
49 | typename ValueType, typename Reference> | |
50 | class iterator_property_map | |
51 | <RandomAccessIterator, | |
52 | local_property_map<ProcessGroup, GlobalMap, StorageMap>, | |
53 | ValueType, Reference> | |
54 | : public parallel::distributed_property_map | |
55 | <ProcessGroup, | |
56 | GlobalMap, | |
57 | iterator_property_map<RandomAccessIterator, StorageMap, | |
58 | ValueType, Reference> > | |
59 | { | |
60 | typedef iterator_property_map<RandomAccessIterator, StorageMap, | |
61 | ValueType, Reference> local_iterator_map; | |
62 | ||
63 | typedef parallel::distributed_property_map<ProcessGroup, GlobalMap, | |
64 | local_iterator_map> inherited; | |
65 | ||
66 | typedef local_property_map<ProcessGroup, GlobalMap, StorageMap> | |
67 | index_map_type; | |
68 | typedef iterator_property_map self_type; | |
69 | ||
70 | public: | |
71 | iterator_property_map() { } | |
72 | ||
73 | iterator_property_map(RandomAccessIterator cc, const index_map_type& id) | |
74 | : inherited(id.process_group(), id.global(), | |
75 | local_iterator_map(cc, id.base())) { } | |
76 | }; | |
77 | ||
78 | /** Distributed iterator property map. | |
79 | * | |
80 | * This specialization of @ref iterator_property_map builds a | |
81 | * distributed iterator property map given a distributed index | |
82 | * map. Only the local portion of the distributed index property map | |
83 | * is utilized. | |
84 | * | |
85 | * This specialization is useful when creating external distributed | |
86 | * property maps via the same syntax used to create external | |
87 | * sequential property maps. | |
88 | */ | |
89 | template<typename RandomAccessIterator, typename ProcessGroup, | |
90 | typename GlobalMap, typename StorageMap, | |
91 | typename ValueType, typename Reference> | |
92 | class iterator_property_map< | |
93 | RandomAccessIterator, | |
94 | parallel::distributed_property_map<ProcessGroup,GlobalMap,StorageMap>, | |
95 | ValueType, Reference | |
96 | > | |
97 | : public parallel::distributed_property_map | |
98 | <ProcessGroup, | |
99 | GlobalMap, | |
100 | iterator_property_map<RandomAccessIterator, StorageMap, | |
101 | ValueType, Reference> > | |
102 | { | |
103 | typedef iterator_property_map<RandomAccessIterator, StorageMap, | |
104 | ValueType, Reference> local_iterator_map; | |
105 | ||
106 | typedef parallel::distributed_property_map<ProcessGroup, GlobalMap, | |
107 | local_iterator_map> inherited; | |
108 | ||
109 | typedef parallel::distributed_property_map<ProcessGroup, GlobalMap, | |
110 | StorageMap> | |
111 | index_map_type; | |
112 | ||
113 | public: | |
114 | iterator_property_map() { } | |
115 | ||
116 | iterator_property_map(RandomAccessIterator cc, const index_map_type& id) | |
117 | : inherited(id.process_group(), id.global(), | |
118 | local_iterator_map(cc, id.base())) { } | |
119 | }; | |
120 | ||
121 | namespace parallel { | |
122 | // Generate an iterator property map with a specific kind of ghost | |
123 | // cells | |
124 | template<typename RandomAccessIterator, typename ProcessGroup, | |
125 | typename GlobalMap, typename StorageMap> | |
126 | distributed_property_map<ProcessGroup, | |
127 | GlobalMap, | |
128 | iterator_property_map<RandomAccessIterator, | |
129 | StorageMap> > | |
130 | make_iterator_property_map(RandomAccessIterator cc, | |
131 | local_property_map<ProcessGroup, GlobalMap, | |
132 | StorageMap> index_map) | |
133 | { | |
134 | typedef distributed_property_map< | |
135 | ProcessGroup, GlobalMap, | |
136 | iterator_property_map<RandomAccessIterator, StorageMap> > | |
137 | result_type; | |
138 | return result_type(index_map.process_group(), index_map.global(), | |
139 | make_iterator_property_map(cc, index_map.base())); | |
140 | } | |
141 | ||
142 | } // end namespace parallel | |
143 | ||
144 | /** Distributed safe iterator property map. | |
145 | * | |
146 | * This specialization of @ref safe_iterator_property_map builds a | |
147 | * distributed iterator property map given the local index maps | |
148 | * generated by distributed graph types that automatically have index | |
149 | * properties. | |
150 | * | |
151 | * This specialization is useful when creating external distributed | |
152 | * property maps via the same syntax used to create external | |
153 | * sequential property maps. | |
154 | */ | |
155 | template<typename RandomAccessIterator, typename ProcessGroup, | |
156 | typename GlobalMap, typename StorageMap, typename ValueType, | |
157 | typename Reference> | |
158 | class safe_iterator_property_map | |
159 | <RandomAccessIterator, | |
160 | local_property_map<ProcessGroup, GlobalMap, StorageMap>, | |
161 | ValueType, Reference> | |
162 | : public parallel::distributed_property_map | |
163 | <ProcessGroup, | |
164 | GlobalMap, | |
165 | safe_iterator_property_map<RandomAccessIterator, StorageMap, | |
166 | ValueType, Reference> > | |
167 | { | |
168 | typedef safe_iterator_property_map<RandomAccessIterator, StorageMap, | |
169 | ValueType, Reference> local_iterator_map; | |
170 | ||
171 | typedef parallel::distributed_property_map<ProcessGroup, GlobalMap, | |
172 | local_iterator_map> inherited; | |
173 | ||
174 | typedef local_property_map<ProcessGroup, GlobalMap, StorageMap> index_map_type; | |
175 | ||
176 | public: | |
177 | safe_iterator_property_map() { } | |
178 | ||
179 | safe_iterator_property_map(RandomAccessIterator cc, std::size_t n, | |
180 | const index_map_type& id) | |
181 | : inherited(id.process_group(), id.global(), | |
182 | local_iterator_map(cc, n, id.base())) { } | |
183 | }; | |
184 | ||
185 | /** Distributed safe iterator property map. | |
186 | * | |
187 | * This specialization of @ref safe_iterator_property_map builds a | |
188 | * distributed iterator property map given a distributed index | |
189 | * map. Only the local portion of the distributed index property map | |
190 | * is utilized. | |
191 | * | |
192 | * This specialization is useful when creating external distributed | |
193 | * property maps via the same syntax used to create external | |
194 | * sequential property maps. | |
195 | */ | |
196 | template<typename RandomAccessIterator, typename ProcessGroup, | |
197 | typename GlobalMap, typename StorageMap, | |
198 | typename ValueType, typename Reference> | |
199 | class safe_iterator_property_map< | |
200 | RandomAccessIterator, | |
201 | parallel::distributed_property_map<ProcessGroup,GlobalMap,StorageMap>, | |
202 | ValueType, Reference> | |
203 | : public parallel::distributed_property_map | |
204 | <ProcessGroup, | |
205 | GlobalMap, | |
206 | safe_iterator_property_map<RandomAccessIterator, StorageMap, | |
207 | ValueType, Reference> > | |
208 | { | |
209 | typedef safe_iterator_property_map<RandomAccessIterator, StorageMap, | |
210 | ValueType, Reference> local_iterator_map; | |
211 | ||
212 | typedef parallel::distributed_property_map<ProcessGroup, GlobalMap, | |
213 | local_iterator_map> inherited; | |
214 | ||
215 | typedef parallel::distributed_property_map<ProcessGroup, GlobalMap, | |
216 | StorageMap> | |
217 | index_map_type; | |
218 | ||
219 | public: | |
220 | safe_iterator_property_map() { } | |
221 | ||
222 | safe_iterator_property_map(RandomAccessIterator cc, std::size_t n, | |
223 | const index_map_type& id) | |
224 | : inherited(id.process_group(), id.global(), | |
225 | local_iterator_map(cc, n, id.base())) { } | |
226 | }; | |
227 | ||
228 | } | |
229 | ||
230 | #include <boost/property_map/vector_property_map.hpp> | |
231 | ||
232 | #endif /* BOOST_PROPERTY_MAP_PARALLEL_PROPERTY_MAPS_HPP */ | |
233 |