18 #if !defined(PASTIX_ORDERING_SCOTCH)
19 #error "This file should be compiled inly if SCOTCH is enabled and found"
89 SCOTCH_Graph comp_sgraph;
91 pastix_graph_t comp_graph;
100 for (i=0; i<comp_id; i++) {
101 fnode += comp_sze[i];
103 lnode = fnode + comp_sze[comp_id];
104 assert( comp_sze[comp_id] != 0 );
105 assert( lnode <= n );
107 comp_n = lnode - fnode;
111 memcpy( &comp_graph, graph,
sizeof(pastix_graph_t) );
117 sortptr[0] = comp_vtx;
119 sortptr[2] = peritab;
121 qsort3IntAsc( sortptr, n );
130 memset( &comp_graph, 0,
sizeof(pastix_graph_t) );
134 assert( comp_graph.n == comp_n );
137 if ( ! SCOTCH_graphInit( &comp_sgraph ) ) {
138 SCOTCH_graphBuild( &comp_sgraph,
145 comp_graph.colptr[ comp_n ] - comp_graph.colptr[ 0 ],
150 fprintf(stderr,
"Failed to build graph\n");
154 if ( SCOTCH_graphCheck( &comp_sgraph ) ) {
155 pastix_print_error(
"error in graph graphCheck()...\n" );
160 if ( SCOTCH_stratInit( &sstrat ) != 0 ) {
161 pastix_print_error(
"Failed to initialize partitioning strategy\n" );
168 SCOTCH_graphPart( &comp_sgraph, nbpart,
171 SCOTCH_graphExit( &comp_sgraph );
172 SCOTCH_stratExit( &sstrat );
179 for(i=0; i<nbpart; i++) {
180 comp_sze[ *comp_nbr + i ] = 0;
183 for(i=0; i<comp_n; i++) {
184 vtx = comp_vtx + fnode + i;
185 assert( *vtx == comp_id );
186 newid = *comp_nbr + parttab[i];
190 comp_sze[comp_id] = 0;
BEGIN_C_DECLS typedef int pastix_int_t
@ PASTIX_ERR_BADPARAMETER
void graphExit(pastix_graph_t *graph)
Free the content of the graph structure.
int graphIsolateRange(const pastix_graph_t *graphIn, const pastix_order_t *order, pastix_graph_t *graphOut, pastix_int_t fnode, pastix_int_t lnode, pastix_int_t distance)
Isolate the subgraph associated to a range of unknowns in the permuted graph.
int graphComputeKway(const pastix_graph_t *graph, pastix_order_t *order, pastix_int_t *peritab, pastix_int_t *comp_nbr, pastix_int_t *comp_sze, pastix_int_t *comp_vtx, pastix_int_t comp_id, pastix_int_t nbpart)
Compute the K-way partition of a given set of unknowns.