vector_property_map.hpp 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. #ifndef BOOST_PROPERTY_MAP_PARALLEL_VECTOR_PROPERTY_MAP_HPP_VP_2003_03_04
  10. #define BOOST_PROPERTY_MAP_PARALLEL_VECTOR_PROPERTY_MAP_HPP_VP_2003_03_04
  11. #include <boost/property_map/property_map.hpp>
  12. #include <boost/shared_ptr.hpp>
  13. #include <vector>
  14. #include <boost/property_map/parallel/distributed_property_map.hpp>
  15. #include <boost/property_map/parallel/local_property_map.hpp>
  16. namespace boost {
  17. /** Distributed vector property map.
  18. *
  19. * This specialization of @ref vector_property_map builds a
  20. * distributed vector property map given the local index maps
  21. * generated by distributed graph types that automatically have index
  22. * properties.
  23. *
  24. * This specialization is useful when creating external distributed
  25. * property maps via the same syntax used to create external
  26. * sequential property maps.
  27. */
  28. template<typename T, typename ProcessGroup, typename GlobalMap,
  29. typename StorageMap>
  30. class vector_property_map<T,
  31. local_property_map<ProcessGroup, GlobalMap,
  32. StorageMap> >
  33. : public parallel::distributed_property_map<
  34. ProcessGroup, GlobalMap, vector_property_map<T, StorageMap> >
  35. {
  36. typedef vector_property_map<T, StorageMap> local_iterator_map;
  37. typedef parallel::distributed_property_map<ProcessGroup, GlobalMap,
  38. local_iterator_map> inherited;
  39. typedef local_property_map<ProcessGroup, GlobalMap, StorageMap> index_map_type;
  40. public:
  41. vector_property_map(const index_map_type& index = index_map_type())
  42. : inherited(index.process_group(), index.global(),
  43. local_iterator_map(index.base())) { }
  44. vector_property_map(unsigned inital_size,
  45. const index_map_type& index = index_map_type())
  46. : inherited(index.process_group(), index.global(),
  47. local_iterator_map(inital_size, index.base())) { }
  48. };
  49. /** Distributed vector property map.
  50. *
  51. * This specialization of @ref vector_property_map builds a
  52. * distributed vector property map given the local index maps
  53. * generated by distributed graph types that automatically have index
  54. * properties.
  55. *
  56. * This specialization is useful when creating external distributed
  57. * property maps via the same syntax used to create external
  58. * sequential property maps.
  59. */
  60. template<typename T, typename ProcessGroup, typename GlobalMap,
  61. typename StorageMap>
  62. class vector_property_map<
  63. T,
  64. parallel::distributed_property_map<
  65. ProcessGroup,
  66. GlobalMap,
  67. StorageMap
  68. >
  69. >
  70. : public parallel::distributed_property_map<
  71. ProcessGroup, GlobalMap, vector_property_map<T, StorageMap> >
  72. {
  73. typedef vector_property_map<T, StorageMap> local_iterator_map;
  74. typedef parallel::distributed_property_map<ProcessGroup, GlobalMap,
  75. local_iterator_map> inherited;
  76. typedef parallel::distributed_property_map<ProcessGroup, GlobalMap,
  77. StorageMap>
  78. index_map_type;
  79. public:
  80. vector_property_map(const index_map_type& index = index_map_type())
  81. : inherited(index.process_group(), index.global(),
  82. local_iterator_map(index.base())) { }
  83. vector_property_map(unsigned inital_size,
  84. const index_map_type& index = index_map_type())
  85. : inherited(index.process_group(), index.global(),
  86. local_iterator_map(inital_size, index.base())) { }
  87. };
  88. }
  89. #endif // BOOST_PROPERTY_MAP_PARALLEL_VECTOR_PROPERTY_MAP_HPP_VP_2003_03_04