1 // Copyright (C) Vladimir Prus 2003. 2 // Distributed under the Boost Software License, Version 1.0. (See 3 // accompanying file LICENSE_1_0.txt or copy at 4 // http://www.boost.org/LICENSE_1_0.txt) 5 // 6 // See http://www.boost.org/libs/graph/vector_property_map.html for 7 // documentation. 8 // 9 10 #ifndef BOOST_PROPERTY_MAP_PARALLEL_VECTOR_PROPERTY_MAP_HPP_VP_2003_03_04 11 #define BOOST_PROPERTY_MAP_PARALLEL_VECTOR_PROPERTY_MAP_HPP_VP_2003_03_04 12 13 #include <boost/property_map/property_map.hpp> 14 #include <boost/shared_ptr.hpp> 15 #include <vector> 16 #include <boost/property_map/parallel/distributed_property_map.hpp> 17 #include <boost/property_map/parallel/local_property_map.hpp> 18 19 namespace boost { 20 21 /** Distributed vector property map. 22 * 23 * This specialization of @ref vector_property_map builds a 24 * distributed vector property map given the local index maps 25 * generated by distributed graph types that automatically have index 26 * properties. 27 * 28 * This specialization is useful when creating external distributed 29 * property maps via the same syntax used to create external 30 * sequential property maps. 31 */ 32 template<typename T, typename ProcessGroup, typename GlobalMap, 33 typename StorageMap> 34 class vector_property_map<T, 35 local_property_map<ProcessGroup, GlobalMap, 36 StorageMap> > 37 : public parallel::distributed_property_map< 38 ProcessGroup, GlobalMap, vector_property_map<T, StorageMap> > 39 { 40 typedef vector_property_map<T, StorageMap> local_iterator_map; 41 42 typedef parallel::distributed_property_map<ProcessGroup, GlobalMap, 43 local_iterator_map> inherited; 44 45 typedef local_property_map<ProcessGroup, GlobalMap, StorageMap> index_map_type; 46 47 public: vector_property_map(const index_map_type & index=index_map_type ())48 vector_property_map(const index_map_type& index = index_map_type()) 49 : inherited(index.process_group(), index.global(), 50 local_iterator_map(index.base())) { } 51 vector_property_map(unsigned inital_size,const index_map_type & index=index_map_type ())52 vector_property_map(unsigned inital_size, 53 const index_map_type& index = index_map_type()) 54 : inherited(index.process_group(), index.global(), 55 local_iterator_map(inital_size, index.base())) { } 56 }; 57 58 /** Distributed vector property map. 59 * 60 * This specialization of @ref vector_property_map builds a 61 * distributed vector property map given the local index maps 62 * generated by distributed graph types that automatically have index 63 * properties. 64 * 65 * This specialization is useful when creating external distributed 66 * property maps via the same syntax used to create external 67 * sequential property maps. 68 */ 69 template<typename T, typename ProcessGroup, typename GlobalMap, 70 typename StorageMap> 71 class vector_property_map< 72 T, 73 parallel::distributed_property_map< 74 ProcessGroup, 75 GlobalMap, 76 StorageMap 77 > 78 > 79 : public parallel::distributed_property_map< 80 ProcessGroup, GlobalMap, vector_property_map<T, StorageMap> > 81 { 82 typedef vector_property_map<T, StorageMap> local_iterator_map; 83 84 typedef parallel::distributed_property_map<ProcessGroup, GlobalMap, 85 local_iterator_map> inherited; 86 87 typedef parallel::distributed_property_map<ProcessGroup, GlobalMap, 88 StorageMap> 89 index_map_type; 90 91 public: vector_property_map(const index_map_type & index=index_map_type ())92 vector_property_map(const index_map_type& index = index_map_type()) 93 : inherited(index.process_group(), index.global(), 94 local_iterator_map(index.base())) { } 95 vector_property_map(unsigned inital_size,const index_map_type & index=index_map_type ())96 vector_property_map(unsigned inital_size, 97 const index_map_type& index = index_map_type()) 98 : inherited(index.process_group(), index.global(), 99 local_iterator_map(inital_size, index.base())) { } 100 }; 101 102 } 103 104 #endif // BOOST_PROPERTY_MAP_PARALLEL_VECTOR_PROPERTY_MAP_HPP_VP_2003_03_04 105