Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:50:16

0001 //  (C) Copyright Jeremy Siek 1999-2001.
0002 //  Copyright (C) 2006 Trustees of Indiana University
0003 //  Authors: Douglas Gregor and Jeremy Siek
0004 
0005 // Distributed under the Boost Software License, Version 1.0. (See
0006 // accompanying file LICENSE_1_0.txt or copy at
0007 // http://www.boost.org/LICENSE_1_0.txt)
0008 
0009 //  See http://www.boost.org/libs/property_map for documentation.
0010 
0011 #ifndef BOOST_PROPERTY_MAP_PARALLEL_PROPERTY_MAPS_HPP
0012 #define BOOST_PROPERTY_MAP_PARALLEL_PROPERTY_MAPS_HPP
0013 
0014 // Parallel property maps moved over from <boost/property_map/property_map.hpp>
0015 // as part of refactoring out all parallel code from sequential property map
0016 // library.
0017 
0018 #include <boost/assert.hpp>
0019 #include <boost/config.hpp>
0020 #include <boost/static_assert.hpp>
0021 #include <cstddef>
0022 #include <boost/concept_archetype.hpp>
0023 #include <boost/mpl/assert.hpp>
0024 #include <boost/mpl/or.hpp>
0025 #include <boost/mpl/and.hpp>
0026 #include <boost/mpl/has_xxx.hpp>
0027 #include <boost/type_traits/is_same.hpp>
0028 #include <boost/property_map/property_map.hpp>
0029 
0030 #include <boost/property_map/parallel/distributed_property_map.hpp>
0031 #include <boost/property_map/parallel/local_property_map.hpp>
0032 
0033 namespace boost {
0034 /** Distributed iterator property map.
0035  *
0036  * This specialization of @ref iterator_property_map builds a
0037  * distributed iterator property map given the local index maps
0038  * generated by distributed graph types that automatically have index
0039  * properties. 
0040  *
0041  * This specialization is useful when creating external distributed
0042  * property maps via the same syntax used to create external
0043  * sequential property maps.
0044  */
0045 template<typename RandomAccessIterator, typename ProcessGroup,
0046          typename GlobalMap, typename StorageMap, 
0047          typename ValueType, typename Reference>
0048 class iterator_property_map
0049         <RandomAccessIterator, 
0050          local_property_map<ProcessGroup, GlobalMap, StorageMap>,
0051          ValueType, Reference>
0052   : public parallel::distributed_property_map
0053              <ProcessGroup, 
0054               GlobalMap, 
0055               iterator_property_map<RandomAccessIterator, StorageMap,
0056                                     ValueType, Reference> >
0057 {
0058   typedef iterator_property_map<RandomAccessIterator, StorageMap, 
0059                                 ValueType, Reference> local_iterator_map;
0060 
0061   typedef parallel::distributed_property_map<ProcessGroup, GlobalMap,
0062                                              local_iterator_map> inherited;
0063 
0064   typedef local_property_map<ProcessGroup, GlobalMap, StorageMap>
0065     index_map_type;
0066   typedef iterator_property_map self_type;
0067 
0068 public:
0069   iterator_property_map() { }
0070 
0071   iterator_property_map(RandomAccessIterator cc, const index_map_type& id)
0072     : inherited(id.process_group(), id.global(), 
0073                 local_iterator_map(cc, id.base())) { }
0074 };
0075 
0076 /** Distributed iterator property map.
0077  *
0078  * This specialization of @ref iterator_property_map builds a
0079  * distributed iterator property map given a distributed index
0080  * map. Only the local portion of the distributed index property map
0081  * is utilized.
0082  *
0083  * This specialization is useful when creating external distributed
0084  * property maps via the same syntax used to create external
0085  * sequential property maps.
0086  */
0087 template<typename RandomAccessIterator, typename ProcessGroup,
0088          typename GlobalMap, typename StorageMap, 
0089          typename ValueType, typename Reference>
0090 class iterator_property_map<
0091         RandomAccessIterator, 
0092         parallel::distributed_property_map<ProcessGroup,GlobalMap,StorageMap>,
0093         ValueType, Reference
0094       >
0095   : public parallel::distributed_property_map
0096              <ProcessGroup, 
0097               GlobalMap,
0098               iterator_property_map<RandomAccessIterator, StorageMap,
0099                                     ValueType, Reference> >
0100 {
0101   typedef iterator_property_map<RandomAccessIterator, StorageMap,
0102                                 ValueType, Reference> local_iterator_map;
0103 
0104   typedef parallel::distributed_property_map<ProcessGroup, GlobalMap,
0105                                              local_iterator_map> inherited;
0106 
0107   typedef parallel::distributed_property_map<ProcessGroup, GlobalMap, 
0108                                              StorageMap>
0109     index_map_type;
0110 
0111 public:
0112   iterator_property_map() { }
0113 
0114   iterator_property_map(RandomAccessIterator cc, const index_map_type& id)
0115     : inherited(id.process_group(), id.global(),
0116                 local_iterator_map(cc, id.base())) { }
0117 };
0118 
0119 namespace parallel {
0120 // Generate an iterator property map with a specific kind of ghost
0121 // cells
0122 template<typename RandomAccessIterator, typename ProcessGroup,
0123          typename GlobalMap, typename StorageMap>
0124 distributed_property_map<ProcessGroup, 
0125                          GlobalMap,
0126                          iterator_property_map<RandomAccessIterator, 
0127                                                StorageMap> >
0128 make_iterator_property_map(RandomAccessIterator cc,
0129                            local_property_map<ProcessGroup, GlobalMap, 
0130                                               StorageMap> index_map)
0131 {
0132   typedef distributed_property_map<
0133             ProcessGroup, GlobalMap,
0134             iterator_property_map<RandomAccessIterator, StorageMap> >
0135     result_type;
0136   return result_type(index_map.process_group(), index_map.global(),
0137                      make_iterator_property_map(cc, index_map.base()));
0138 }
0139 
0140 } // end namespace parallel
0141 
0142 /** Distributed safe iterator property map.
0143  *
0144  * This specialization of @ref safe_iterator_property_map builds a
0145  * distributed iterator property map given the local index maps
0146  * generated by distributed graph types that automatically have index
0147  * properties. 
0148  *
0149  * This specialization is useful when creating external distributed
0150  * property maps via the same syntax used to create external
0151  * sequential property maps.
0152  */
0153 template<typename RandomAccessIterator, typename ProcessGroup,
0154          typename GlobalMap, typename StorageMap, typename ValueType,
0155          typename Reference>
0156 class safe_iterator_property_map
0157         <RandomAccessIterator, 
0158          local_property_map<ProcessGroup, GlobalMap, StorageMap>,
0159          ValueType, Reference>
0160   : public parallel::distributed_property_map
0161              <ProcessGroup, 
0162               GlobalMap,
0163               safe_iterator_property_map<RandomAccessIterator, StorageMap,
0164                                          ValueType, Reference> >
0165 {
0166   typedef safe_iterator_property_map<RandomAccessIterator, StorageMap, 
0167                                      ValueType, Reference> local_iterator_map;
0168 
0169   typedef parallel::distributed_property_map<ProcessGroup, GlobalMap,
0170                                              local_iterator_map> inherited;
0171 
0172   typedef local_property_map<ProcessGroup, GlobalMap, StorageMap> index_map_type;
0173 
0174 public:
0175   safe_iterator_property_map() { }
0176 
0177   safe_iterator_property_map(RandomAccessIterator cc, std::size_t n, 
0178                              const index_map_type& id)
0179     : inherited(id.process_group(), id.global(),
0180                 local_iterator_map(cc, n, id.base())) { }
0181 };
0182 
0183 /** Distributed safe iterator property map.
0184  *
0185  * This specialization of @ref safe_iterator_property_map builds a
0186  * distributed iterator property map given a distributed index
0187  * map. Only the local portion of the distributed index property map
0188  * is utilized.
0189  *
0190  * This specialization is useful when creating external distributed
0191  * property maps via the same syntax used to create external
0192  * sequential property maps.
0193  */
0194 template<typename RandomAccessIterator, typename ProcessGroup,
0195          typename GlobalMap, typename StorageMap, 
0196          typename ValueType, typename Reference>
0197 class safe_iterator_property_map<
0198         RandomAccessIterator, 
0199         parallel::distributed_property_map<ProcessGroup,GlobalMap,StorageMap>,
0200         ValueType, Reference>
0201   : public parallel::distributed_property_map
0202              <ProcessGroup, 
0203               GlobalMap,
0204               safe_iterator_property_map<RandomAccessIterator, StorageMap,
0205                                          ValueType, Reference> >
0206 {
0207   typedef safe_iterator_property_map<RandomAccessIterator, StorageMap,
0208                                      ValueType, Reference> local_iterator_map;
0209 
0210   typedef parallel::distributed_property_map<ProcessGroup, GlobalMap,
0211                                              local_iterator_map> inherited;
0212 
0213   typedef parallel::distributed_property_map<ProcessGroup, GlobalMap, 
0214                                              StorageMap>
0215     index_map_type;
0216 
0217 public:
0218   safe_iterator_property_map() { }
0219 
0220   safe_iterator_property_map(RandomAccessIterator cc, std::size_t n, 
0221                              const index_map_type& id)
0222     : inherited(id.process_group(), id.global(), 
0223                 local_iterator_map(cc, n, id.base())) { }
0224 };
0225 
0226 }
0227 
0228 #include <boost/property_map/vector_property_map.hpp>
0229 #include <boost/property_map/parallel/vector_property_map.hpp>
0230 
0231 #endif /* BOOST_PROPERTY_MAP_PARALLEL_PROPERTY_MAPS_HPP */