/Src/Dependencies/Boost/boost/graph/parallel/basic_reduce.hpp

http://hadesmem.googlecode.com/ · C++ Header · 42 lines · 18 code · 10 blank · 14 comment · 0 complexity · f84e07437a7a2d6bff1771379a5d3368 MD5 · raw file

  1. // Copyright 2005 The Trustees of Indiana University.
  2. // Use, modification and distribution is subject to the Boost Software
  3. // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. // Authors: Douglas Gregor
  6. // Andrew Lumsdaine
  7. #ifndef BOOST_PARALLEL_BASIC_REDUCE_HPP
  8. #define BOOST_PARALLEL_BASIC_REDUCE_HPP
  9. #ifndef BOOST_GRAPH_USE_MPI
  10. #error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included"
  11. #endif
  12. namespace boost { namespace parallel {
  13. /** Reduction operation used to reconcile differences between local
  14. * and remote values for a particular key in a property map. The
  15. * type @c T is typically the @c value_type of the property
  16. * map. This basic reduction returns a default-constructed @c T as
  17. * the default value and always resolves to the remote value.
  18. */
  19. template<typename T>
  20. struct basic_reduce
  21. {
  22. BOOST_STATIC_CONSTANT(bool, non_default_resolver = false);
  23. /// Returns a default-constructed T object
  24. template<typename Key>
  25. T operator()(const Key&) const { return T(); }
  26. /// Returns the remote value
  27. template<typename Key>
  28. const T& operator()(const Key&, const T&, const T& remote) const
  29. { return remote; }
  30. };
  31. } } // end namespace boost::parallel
  32. #endif // BOOST_PARALLEL_BASIC_REDUCE_HPP