33 #ifndef UG_GRAPH_INTERFACE_PARALLEL_MATRIX_H
34 #define UG_GRAPH_INTERFACE_PARALLEL_MATRIX_H
37 #include <boost/iterator/filter_iterator.hpp>
49 int owner()
const{
return first; }
50 int local()
const{
return second; }
78 :
public std::iterator<std::input_iterator_tag, vertex_descriptor,
79 ptrdiff_t, vertex_descriptor, vertex_descriptor> {
113 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
114 return v.
owner() == rank;
124 :
public std::iterator<std::input_iterator_tag, vertex_descriptor, ptrdiff_t, vertex_descriptor, vertex_descriptor> {
126 typedef typename boost::graph_traits<T>::adjacency_iterator
base;
151 int o = (*_owners)[i];
152 int l = (*_ghosts)[i];
165 std::input_iterator_tag,
240 return _matrix->num_connections(v);
292 return _matrix->begin_row(row);
365 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
382 for(
auto k = idx_master.
begin(); k!=idx_master.
end(); ++k){
384 std::vector<int> mmap(I.
size());
385 int dest = idx_master.
proc_id(k);
386 auto b = mmap.begin();
392 pc.
send_data(mmap.data(), mmap.size()*
sizeof(
int), dest, 17);
396 for(
auto k = idx_slave.
begin(); k!=idx_slave.
end(); ++k){
398 int srank = idx_slave.
proc_id(k);
400 std::vector<int> mmap(I.
size());
401 pc.
receive_data(mmap.data(), mmap.size()*
sizeof(
int), srank, 17);
408 assert(
_owners[i.elem] == rank);
You may add elements to this interface and iterate over them.
Definition: pcl_communication_structs.h:207
size_t size() const
returns the number of elements that are stored in the interface.
Definition: pcl_communication_structs.h:306
Definition: pcl_process_communicator.h:70
void receive_data(void *pBuffOut, int bufferSize, int srcProc, int tag) const
receives data from srcPrc with the specified tag.
Definition: pcl_process_communicator.cpp:511
void send_data(void *pBuffer, int bufferSize, int destProc, int tag) const
sends data with the given tag to the specified process.
Definition: pcl_process_communicator.cpp:471
iterator end(size_t level=0)
returns the iterator to the last interface of the layout.
Definition: pcl_communication_structs.h:492
iterator begin(size_t level=0)
returns the iterator to the first interface of the layout.
Definition: pcl_communication_structs.h:486
int proc_id(iterator iter) const
returns the target process of the interface given in iterator
Definition: pcl_communication_structs.h:509
Interface & interface(iterator iter)
returns the interface to the given iterator.
Definition: pcl_communication_structs.h:505
Definition: parallel_matrix.h:124
adjacency_iterator & operator++(int)
Definition: parallel_matrix.h:141
adjacency_iterator(base b, owners const *o, ghosts const *g)
Definition: parallel_matrix.h:131
bool operator==(adjacency_iterator const &o) const
Definition: parallel_matrix.h:135
base _base
Definition: parallel_matrix.h:156
owners const * _owners
Definition: parallel_matrix.h:157
ghosts const * _ghosts
Definition: parallel_matrix.h:158
adjacency_iterator()
Definition: parallel_matrix.h:128
vertex_descriptor operator*() const
Definition: parallel_matrix.h:149
adjacency_iterator & operator++()
Definition: parallel_matrix.h:145
bool operator!=(adjacency_iterator const &p) const
Definition: parallel_matrix.h:138
boost::graph_traits< T >::adjacency_iterator base
Definition: parallel_matrix.h:126
Definition: parallel_matrix.h:193
vertex_descriptor target() const
Definition: parallel_matrix.h:202
vertex_descriptor _s
Definition: parallel_matrix.h:207
edge(vertex_descriptor s, vertex_descriptor t)
Definition: parallel_matrix.h:195
vertex_descriptor _t
Definition: parallel_matrix.h:208
vertex_descriptor source() const
Definition: parallel_matrix.h:199
Definition: parallel_matrix.h:168
ghosts const * _ghosts
Definition: parallel_matrix.h:190
bool operator==(out_edge_iterator const &p) const
Definition: parallel_matrix.h:176
out_edge_iterator(base_edge_iterator b, owners const *o, ghosts const *g, T const *m)
Definition: parallel_matrix.h:173
T const * _matrix
Definition: parallel_matrix.h:191
base_edge_iterator _base
Definition: parallel_matrix.h:188
owners const * _owners
Definition: parallel_matrix.h:189
out_edge_iterator()
Definition: parallel_matrix.h:170
bool operator!=(out_edge_iterator const &p) const
Definition: parallel_matrix.h:179
out_edge_iterator & operator++()
Definition: parallel_matrix.h:182
edge operator*() const
Definition: parallel_matrix.h:345
Definition: parallel_matrix.h:79
bool operator==(vertex_iterator_ const &o) const
Definition: parallel_matrix.h:84
vertex_iterator_ & operator++(int)
Definition: parallel_matrix.h:90
bool operator!=(vertex_iterator_ const &p) const
Definition: parallel_matrix.h:87
vertex_iterator_ & operator++()
Definition: parallel_matrix.h:94
vertex_iterator_(base_vertex_iterator b, owners const *o)
Definition: parallel_matrix.h:82
ghosts const * _ghosts
Definition: parallel_matrix.h:106
vertex_iterator_()
Definition: parallel_matrix.h:81
owners const * _owners
Definition: parallel_matrix.h:105
vertex_descriptor operator*() const
Definition: parallel_matrix.h:98
base_vertex_iterator _base
Definition: parallel_matrix.h:104
Definition: parallel_matrix.h:68
std::vector< int > ghosts
Definition: parallel_matrix.h:74
adjacency_iterator begin_adjacent_vertices(int row) const
Definition: parallel_matrix.h:264
BGLParallelMatrix & operator=(BGLParallelMatrix const &o)
Definition: parallel_matrix.h:223
boost::graph_traits< T >::vertex_iterator base_vertex_iterator
Definition: parallel_matrix.h:75
int in_degree(int v) const
Definition: parallel_matrix.h:250
out_edge_iterator begin_out_edges(int row) const
Definition: parallel_matrix.h:274
const_row_iterator begin_col(int col) const
Definition: parallel_matrix.h:320
vertex_iterator end_vertices() const
Definition: parallel_matrix.h:313
int num_rows() const
Definition: parallel_matrix.h:232
ghosts _ghosts
Definition: parallel_matrix.h:339
adjacency_iterator end_adjacent_vertices(int row) const
Definition: parallel_matrix.h:269
std::vector< int > owners
Definition: parallel_matrix.h:73
boost::graph_traits< T >::out_edge_iterator base_edge_iterator
Definition: parallel_matrix.h:76
boost::filter_iterator< filter_local, vertex_iterator_ > vertex_iterator
Definition: parallel_matrix.h:122
T::const_row_iterator const_row_iterator
Definition: parallel_matrix.h:71
vertex_iterator begin_vertices() const
Definition: parallel_matrix.h:304
int num_cols() const
Definition: parallel_matrix.h:235
T _matrix_transpose
Definition: parallel_matrix.h:341
out_edge_iterator end_out_edges(int row) const
Definition: parallel_matrix.h:279
int num_connections(int v) const
Definition: parallel_matrix.h:238
int degree(int v) const
Definition: parallel_matrix.h:260
T const * _matrix
Definition: parallel_matrix.h:337
void refresh()
Definition: parallel_matrix.h:359
int out_degree(int v) const
Definition: parallel_matrix.h:246
detail::bglp_vertex_descriptor vertex_descriptor
Definition: parallel_matrix.h:70
BGLParallelMatrix(T const *m=nullptr)
Definition: parallel_matrix.h:213
owners _owners
Definition: parallel_matrix.h:338
const_row_iterator end_col(int col) const
Definition: parallel_matrix.h:327
Definition: parallel_matrix.h:43
bglp_vertex_descriptor(int a, int b)
Definition: parallel_matrix.h:46
int local() const
Definition: parallel_matrix.h:50
int owner() const
Definition: parallel_matrix.h:49
bglp_vertex_descriptor()
Definition: parallel_matrix.h:45
#define untested()
Definition: lua_table_handle.cpp:15
std::pair< typename graph_traits< T >::adjacency_iterator, typename graph_traits< T >::adjacency_iterator > adjacent_vertices(size_t v, ug::BidirectionalMatrix< T > const &M)
Definition: bidirectional_boost.h:108
std::pair< SM_out_edge_iterator< typename T::value_type >, SM_out_edge_iterator< typename T::value_type > > out_edges(size_t v, ug::BidirectionalMatrix< T > const &g)
Definition: bidirectional_boost.h:136
int out_degree(int v, ug::BidirectionalMatrix< T > const &M)
Definition: bidirectional_boost.h:76
std::pair< counting_iterator< size_t >, counting_iterator< size_t > > vertices(ug::BidirectionalMatrix< T > const &M)
Definition: bidirectional_boost.h:60
size_t target(SM_edge< typename T::value_type > const &e, ug::BidirectionalMatrix< T > const &m)
Definition: bidirectional_boost.h:100
size_t source(SM_edge< typename T::value_type > const &e, ug::BidirectionalMatrix< T > const &)
Definition: bidirectional_boost.h:94
Definition: smart_pointer.h:814
int local(bglp_vertex_descriptor p)
Definition: parallel_matrix.h:57
int owner(bglp_vertex_descriptor p)
Definition: parallel_matrix.h:53
const_row_iterator end_row(size_t row) const
const_row_iterator begin_row(size_t row) const
Definition: parallel_matrix.h:109
bool operator()(vertex_descriptor v) const
Definition: parallel_matrix.h:110
#define incomplete()
Definition: trace.h:10