Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:37:15

0001 // Copyright (C) 2004-2006 The Trustees of Indiana University.
0002 
0003 // Use, modification and distribution is subject to the Boost Software
0004 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0005 // http://www.boost.org/LICENSE_1_0.txt)
0006 
0007 //  Authors: Douglas Gregor
0008 //           Andrew Lumsdaine
0009 
0010 //
0011 // Distributed graph concepts and helpers
0012 //
0013 
0014 #ifndef BOOST_GRAPH_DISTRIBUTED_CONCEPTS_HPP
0015 #define BOOST_GRAPH_DISTRIBUTED_CONCEPTS_HPP
0016 
0017 #ifndef BOOST_GRAPH_USE_MPI
0018 #error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included"
0019 #endif
0020 
0021 #include <boost/version.hpp>
0022 #include <boost/graph/graph_traits.hpp>
0023 #include <boost/graph/graph_concepts.hpp>
0024 #include <boost/concept/assert.hpp>
0025 
0026 #if BOOST_VERSION >= 103500
0027 #  include <boost/concept/detail/concept_def.hpp>
0028 #endif
0029 
0030 namespace boost { 
0031 
0032 #if BOOST_VERSION >= 103500
0033   namespace concepts {
0034 #endif
0035 
0036 #if BOOST_VERSION < 103500
0037 
0038 template <class G>
0039 struct DistributedVertexListGraphConcept
0040 {
0041   typedef typename graph_traits<G>::vertex_iterator vertex_iterator;
0042   typedef typename graph_traits<G>::vertices_size_type vertices_size_type;
0043   typedef typename graph_traits<G>::traversal_category
0044     traversal_category;
0045   void constraints() {
0046     BOOST_CONCEPT_ASSERT(( GraphConcept<G> ));
0047     BOOST_CONCEPT_ASSERT(( MultiPassInputIteratorConcept<vertex_iterator> ));
0048     BOOST_CONCEPT_ASSERT(( ConvertibleConcept<traversal_category,
0049       distributed_vertex_list_graph_tag> ));
0050 
0051 #ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK
0052     // dwa 2003/7/11 -- This clearly shouldn't be necessary, but if
0053     // you want to use vector_as_graph, it is!  I'm sure the graph
0054     // library leaves these out all over the place.  Probably a
0055     // redesign involving specializing a template with a static
0056     // member function is in order :(
0057     using boost::vertices;
0058 #endif      
0059     p = vertices(g);
0060     v = *p.first;
0061     const_constraints(g);
0062   }
0063   void const_constraints(const G& cg) {
0064 #ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK
0065     // dwa 2003/7/11 -- This clearly shouldn't be necessary, but if
0066     // you want to use vector_as_graph, it is!  I'm sure the graph
0067     // library leaves these out all over the place.  Probably a
0068     // redesign involving specializing a template with a static
0069     // member function is in order :(
0070     using boost::vertices;
0071 #endif 
0072     
0073     p = vertices(cg);
0074     v = *p.first;
0075     V = num_vertices(cg);
0076   }
0077   std::pair<vertex_iterator,vertex_iterator> p;
0078   typename graph_traits<G>::vertex_descriptor v;
0079   G g;
0080   vertices_size_type V;
0081 };
0082 
0083 template <class G>
0084 struct DistributedEdgeListGraphConcept
0085 {
0086   typedef typename graph_traits<G>::edge_descriptor edge_descriptor;
0087   typedef typename graph_traits<G>::edge_iterator edge_iterator;
0088   typedef typename graph_traits<G>::edges_size_type edges_size_type;
0089   typedef typename graph_traits<G>::traversal_category
0090     traversal_category;
0091   void constraints() {
0092     BOOST_CONCEPT_ASSERT(( GraphConcept<G> ));
0093     BOOST_CONCEPT_ASSERT(( MultiPassInputIteratorConcept<edge_iterator> ));
0094     BOOST_CONCEPT_ASSERT(( DefaultConstructibleConcept<edge_descriptor> ));
0095     BOOST_CONCEPT_ASSERT(( EqualityComparableConcept<edge_descriptor> ));
0096     BOOST_CONCEPT_ASSERT(( AssignableConcept<edge_descriptor> ));
0097     BOOST_CONCEPT_ASSERT(( ConvertibleConcept<traversal_category,
0098       distributed_edge_list_graph_tag> ));
0099 
0100     p = edges(g);
0101     e = *p.first;
0102     u = source(e, g);
0103     v = target(e, g);
0104     const_constraints(g);
0105   }
0106   void const_constraints(const G& cg) {
0107     p = edges(cg);
0108     E = num_edges(cg);
0109     e = *p.first;
0110     u = source(e, cg);
0111     v = target(e, cg);
0112   }
0113   std::pair<edge_iterator,edge_iterator> p;
0114   typename graph_traits<G>::vertex_descriptor u, v;
0115   typename graph_traits<G>::edge_descriptor e;
0116   edges_size_type E;
0117   G g;
0118 };
0119 #else
0120   BOOST_concept(DistributedVertexListGraph,(G))
0121     : Graph<G>
0122   {
0123     typedef typename graph_traits<G>::vertex_iterator vertex_iterator;
0124     typedef typename graph_traits<G>::vertices_size_type vertices_size_type;
0125     typedef typename graph_traits<G>::traversal_category
0126       traversal_category;
0127     ~DistributedVertexListGraph() {
0128       BOOST_CONCEPT_ASSERT((MultiPassInputIterator<vertex_iterator>));
0129       BOOST_CONCEPT_ASSERT((Convertible<traversal_category,
0130         distributed_vertex_list_graph_tag>));
0131 
0132 #ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK
0133       // dwa 2003/7/11 -- This clearly shouldn't be necessary, but if
0134       // you want to use vector_as_graph, it is!  I'm sure the graph
0135       // library leaves these out all over the place.  Probably a
0136       // redesign involving specializing a template with a static
0137       // member function is in order :(
0138       using boost::vertices;
0139 #endif      
0140       p = vertices(g);
0141       v = *p.first;
0142       const_constraints(g);
0143     }
0144     void const_constraints(const G& cg) {
0145 #ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK
0146       // dwa 2003/7/11 -- This clearly shouldn't be necessary, but if
0147       // you want to use vector_as_graph, it is!  I'm sure the graph
0148       // library leaves these out all over the place.  Probably a
0149       // redesign involving specializing a template with a static
0150       // member function is in order :(
0151       using boost::vertices;
0152 #endif 
0153       
0154       p = vertices(cg);
0155       v = *p.first;
0156       V = num_vertices(cg);
0157     }
0158     std::pair<vertex_iterator,vertex_iterator> p;
0159     typename graph_traits<G>::vertex_descriptor v;
0160     G g;
0161     vertices_size_type V;
0162   };
0163 
0164   BOOST_concept(DistributedEdgeListGraph,(G))
0165     : Graph<G>
0166   {
0167     typedef typename graph_traits<G>::edge_descriptor edge_descriptor;
0168     typedef typename graph_traits<G>::edge_iterator edge_iterator;
0169     typedef typename graph_traits<G>::edges_size_type edges_size_type;
0170     typedef typename graph_traits<G>::traversal_category
0171       traversal_category;
0172     ~DistributedEdgeListGraph() {
0173       BOOST_CONCEPT_ASSERT((MultiPassInputIterator<edge_iterator>));
0174       BOOST_CONCEPT_ASSERT((DefaultConstructible<edge_descriptor>));
0175       BOOST_CONCEPT_ASSERT((EqualityComparable<edge_descriptor>));
0176       BOOST_CONCEPT_ASSERT((Assignable<edge_descriptor>));
0177       BOOST_CONCEPT_ASSERT((Convertible<traversal_category,
0178         distributed_edge_list_graph_tag>));
0179 
0180       p = edges(g);
0181       e = *p.first;
0182       u = source(e, g);
0183       v = target(e, g);
0184       const_constraints(g);
0185     }
0186     void const_constraints(const G& cg) {
0187       p = edges(cg);
0188       E = num_edges(cg);
0189       e = *p.first;
0190       u = source(e, cg);
0191       v = target(e, cg);
0192     }
0193     std::pair<edge_iterator,edge_iterator> p;
0194     typename graph_traits<G>::vertex_descriptor u, v;
0195     typename graph_traits<G>::edge_descriptor e;
0196     edges_size_type E;
0197     G g;
0198   };
0199 #endif
0200 
0201 #if BOOST_VERSION >= 103500
0202   } // end namespace concepts
0203 
0204   using concepts::DistributedVertexListGraphConcept;
0205   using concepts::DistributedEdgeListGraphConcept;
0206 #endif
0207 } // end namespace boost
0208 
0209 #if BOOST_VERSION >= 103500
0210 #  include <boost/concept/detail/concept_undef.hpp>
0211 #endif
0212 
0213 #endif // BOOST_GRAPH_DISTRIBUTED_CONCEPTS_HPP