Server IP : 104.21.38.3 / Your IP : 104.23.175.206 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/server/mysql/src/boost/boost_1_59_0/boost/graph/distributed/ |
Upload File : |
// Copyright Daniel Wallin 2007. Use, modification and distribution is // subject to the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_SHUFFLED_DISTRIBUTION_070923_HPP #define BOOST_SHUFFLED_DISTRIBUTION_070923_HPP #ifndef BOOST_GRAPH_USE_MPI #error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" #endif # include <boost/assert.hpp> # include <boost/iterator/counting_iterator.hpp> # include <vector> namespace boost { namespace graph { namespace distributed { template <class BaseDistribution> struct shuffled_distribution : BaseDistribution { typedef std::size_t size_type; template <class ProcessGroup> shuffled_distribution(ProcessGroup const& pg, BaseDistribution const& base) : BaseDistribution(base) , n(num_processes(pg)) , mapping_(make_counting_iterator(size_type(0)), make_counting_iterator(n)) , reverse_mapping(mapping_) {} std::vector<size_type> const& mapping() const { return mapping_; } template <class InputIterator> void assign_mapping(InputIterator first, InputIterator last) { mapping_.assign(first, last); BOOST_ASSERT(mapping_.size() == n); reverse_mapping.resize(mapping_.size()); for (std::vector<size_t>::iterator i(mapping_.begin()); i != mapping_.end(); ++i) { reverse_mapping[*i] = i - mapping_.begin(); } } BaseDistribution& base() { return *this; } BaseDistribution const& base() const { return *this; } template <class ProcessID> size_type block_size(ProcessID id, size_type n) const { return base().block_size(reverse_mapping[id], n); } template <class T> size_type operator()(T const& value) const { return mapping_[base()(value)]; } template <class ProcessID> size_type start(ProcessID id) const { return base().start(reverse_mapping[id]); } size_type local(size_type i) const { return base().local(i); } size_type global(size_type i) const { return base().global(i); } template <class ProcessID> size_type global(ProcessID id, size_type n) const { return base().global(reverse_mapping[id], n); } template <class Archive> void serialize(Archive& ar, unsigned long /*version*/) { ar & serialization::make_nvp("base", base()); } void clear() { base().clear(); } private: size_type n; std::vector<size_type> mapping_; std::vector<size_type> reverse_mapping; }; }}} // namespace boost::graph::distributed #endif // BOOST_SHUFFLED_DISTRIBUTION_070923_HPP