本文整理汇总了C++中graph_access::UNSAFE_metis_style_vwgt_array方法的典型用法代码示例。如果您正苦于以下问题:C++ graph_access::UNSAFE_metis_style_vwgt_array方法的具体用法?C++ graph_access::UNSAFE_metis_style_vwgt_array怎么用?C++ graph_access::UNSAFE_metis_style_vwgt_array使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类graph_access
的用法示例。
在下文中一共展示了graph_access::UNSAFE_metis_style_vwgt_array方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: broadcast_graph
void graph_communication::broadcast_graph( graph_access & G, unsigned root) {
int rank = MPI::COMM_WORLD.Get_rank();
//first B-Cast number of nodes and number of edges
unsigned number_of_nodes = 0;
unsigned number_of_edges = 0;
std::vector< int > buffer(2,0);
if(rank == (int)root) {
buffer[0] = G.number_of_nodes();
buffer[1] = G.number_of_edges();
}
MPI::COMM_WORLD.Bcast(&buffer[0], 2, MPI_INT, root);
number_of_nodes = buffer[0];
number_of_edges = buffer[1];
int* xadj;
int* adjncy;
int* vwgt;
int* adjwgt;
if( rank == (int)root) {
xadj = G.UNSAFE_metis_style_xadj_array();
adjncy = G.UNSAFE_metis_style_adjncy_array();
vwgt = G.UNSAFE_metis_style_vwgt_array();
adjwgt = G.UNSAFE_metis_style_adjwgt_array();
} else {
xadj = new int[number_of_nodes+1];
adjncy = new int[number_of_edges];
vwgt = new int[number_of_nodes];
adjwgt = new int[number_of_edges];
}
MPI::COMM_WORLD.Bcast(xadj, number_of_nodes+1, MPI_INT, root);
MPI::COMM_WORLD.Bcast(adjncy, number_of_edges , MPI_INT, root);
MPI::COMM_WORLD.Bcast(vwgt, number_of_nodes , MPI_INT, root);
MPI::COMM_WORLD.Bcast(adjwgt, number_of_edges , MPI_INT, root);
G.build_from_metis_weighted( number_of_nodes, xadj, adjncy, vwgt, adjwgt);
delete[] xadj;
delete[] adjncy;
delete[] vwgt;
delete[] adjwgt;
}