PeriDEM 0.2.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
anonymous_namespace{testMeshPartitioningLib.cpp} Namespace Reference

Functions

void partGraphRecursiveTestSimple ()
 
void partGraphKwayTestSimple ()
 

Function Documentation

◆ partGraphKwayTestSimple()

void anonymous_namespace{testMeshPartitioningLib.cpp}::partGraphKwayTestSimple ( )

Definition at line 78 of file testMeshPartitioningLib.cpp.

78 {
79
80 // The number of vertices.
81 idx_t nvtxs = 6;
82
83 // Number of balancing constraints, which must be at least 1.
84 idx_t ncon = 1;
85
86 // Pointers to initial entries in adjacency array.
87 idx_t xadj[7] = {0, 2, 5, 7, 9, 12, 14};
88
89 // Adjacent vertices in consecutive index order.
90 int nedges = 7;
91 idx_t adjncy[14] = {1, 3, 0, 4, 2, 1, 5, 0, 4, 3, 1, 5, 4, 2};
92
93 // The number of parts requested for the partition.
94 idx_t nParts = 3;
95
96 // On return, the edge cut volume of the partitioning solution.
97 idx_t objval;
98
99 // On return, the partition vector for the graph.
100 idx_t part[6];
101
102 printf("\n");
103 printf("partGraphKwayTest:\n");
104 printf(" METIS_PartGraphKway partitions a graph into K parts\n");
105 printf(" using multilevel K-way partition.\n");
106
107 int ret = METIS_PartGraphKway(&nvtxs, &ncon, xadj, adjncy, NULL, NULL,
108 NULL, &nParts, NULL, NULL, NULL, &objval, part);
109
110 printf("\n");
111 printf(" Return code = %d\n", ret);
112 printf(" Edge cuts for partition = %d\n", (int) objval);
113
114 printf("\n");
115 printf(" Partition vector:\n");
116 printf("\n");
117 printf(" Node Part\n");
118 printf("\n");
119 for (unsigned part_i = 0; part_i < nvtxs; part_i++) {
120 printf(" %d %d\n", part_i, (int) part[part_i]);
121 }
122
123 }

Referenced by test::testGraphPartitioningSimple().

Here is the caller graph for this function:

◆ partGraphRecursiveTestSimple()

void anonymous_namespace{testMeshPartitioningLib.cpp}::partGraphRecursiveTestSimple ( )

Definition at line 31 of file testMeshPartitioningLib.cpp.

31 {
32 // The number of vertices.
33 idx_t nvtxs = 6;
34
35 // Number of balancing constraints, which must be at least 1.
36 idx_t ncon = 1;
37
38 // Pointers to initial entries in adjacency array. size of array is nvtxs + 1
39 idx_t xadj[7] = {0, 2, 5, 7, 9, 12, 14};
40
41 // Adjacent vertices in consecutive index order.
42 int nedges = 7;
43 idx_t adjncy[14] = {1, 3, 0, 4, 2, 1, 5, 0, 4, 3, 1, 5, 4, 2};
44
45 // The number of parts requested for the partition.
46 idx_t nParts = 3;
47
48 // On return, the edge cut volume of the partitioning solution.
49 idx_t objval;
50
51 // On return, the partition vector for the graph.
52 idx_t part[6];
53
54 printf("\n");
55 printf("partGraphRecursiveTest:\n");
56 printf(" METIS_PartGraphRecursive partitions a graph into K parts\n");
57 printf(" using multilevel recursive bisection.\n");
58
59 int ret = METIS_PartGraphRecursive(&nvtxs, &ncon, xadj, adjncy, NULL, NULL,
60 NULL, &nParts, NULL, NULL, NULL, &objval, part);
61
62 printf("\n");
63 printf(" Return code = %d\n", ret);
64 printf(" Edge cuts for partition = %d\n", (int) objval);
65
66 printf("\n");
67 printf(" Partition vector:\n");
68 printf("\n");
69 printf(" Node Part\n");
70 printf("\n");
71 for (unsigned part_i = 0; part_i < nvtxs; part_i++) {
72 printf(" %d %d\n", part_i, (int) part[part_i]);
73 }
74
75 }

Referenced by test::testGraphPartitioningSimple().

Here is the caller graph for this function: