private static void test09() //****************************************************************************80 // // Purpose: // // TEST09 tests TRIANGULATION_ORDER3_ADJ_SET // // Licensing: // // This code is distributed under the GNU LGPL license. // // Modified: // // 04 January 2007 // // Author: // // John Burkardt // { int hole_num = 0; int node_num = 0; int triangle_num = 0; Console.WriteLine(""); Console.WriteLine("TEST09"); Console.WriteLine(" TRIANGULATION_ORDER3_ADJ_SET sets the (lower)"); Console.WriteLine(" adjacencies defined by a triangulation."); Order3_Example.triangulation_order3_example2_size(ref node_num, ref triangle_num, ref hole_num); double[] node_xy = new double[2 * node_num]; int[] triangle_node = new int[3 * triangle_num]; int[] triangle_neighbor = new int[3 * triangle_num]; Order3_Example.triangulation_order3_example2(node_num, triangle_num, ref node_xy, ref triangle_node, ref triangle_neighbor); typeMethods.i4mat_transpose_print(3, triangle_num, triangle_node, " TRIANGLE_NODE"); int[] adj_row = new int[node_num + 1]; int adj_num = Adjacency.triangulation_order3_adj_count(node_num, triangle_num, triangle_node, triangle_neighbor, adj_row); int[] adj = Adjacency.triangulation_order3_adj_set(node_num, triangle_num, triangle_node, triangle_neighbor, adj_num, adj_row); AdjacencyMatrix.adj_print(node_num, adj_num, adj_row, adj, " ADJ array:"); int bandwidth = AdjacencyMatrix.adj_bandwidth(node_num, adj_num, adj_row, adj); Console.WriteLine(""); Console.WriteLine(" ADJ bandwidth = " + bandwidth + ""); }
private static void test03() //****************************************************************************80 // // Purpose: // // TEST03 tests GENRCM // // Licensing: // // This code is distributed under the GNU LGPL license. // // Modified: // // 06 January 2007 // // Author: // // John Burkardt // { int hole_num = 0; int node_num = 0; int test; int triangle_num = 0; Console.WriteLine(""); Console.WriteLine("TEST03"); Console.WriteLine(" GENRCM generates the Reverse Cuthill McKee ordering."); Console.WriteLine(""); Console.WriteLine(" Do the test twice. On the second test, randomly"); Console.WriteLine(" permute the initial nodes."); Order3_Example.triangulation_order3_example2_size(ref node_num, ref triangle_num, ref hole_num); for (test = 1; test <= 2; test++) { double[] node_xy = new double[2 * node_num]; int[] triangle_node = new int[3 * triangle_num]; int[] triangle_neighbor = new int[3 * triangle_num]; Order3_Example.triangulation_order3_example2(node_num, triangle_num, ref node_xy, ref triangle_node, ref triangle_neighbor); int[] perm; switch (test) { // // Randomly permute the nodes. // case 2: { int seed = 123456789; perm = typeMethods.perm_uniform(node_num, 0, ref seed); typeMethods.i4vec_print(node_num, perm, " The random permutation:"); int i; for (i = 0; i < 3; i++) { int j; for (j = 0; j < triangle_num; j++) { int node = triangle_node[i + j * 3]; triangle_node[i + j * 3] = perm[node - 1]; } } break; } } typeMethods.i4mat_transpose_print(3, triangle_num, triangle_node, " TRIANGLE_NODE:"); int[] adj_row = new int[node_num + 1]; int adj_num = Adjacency.triangulation_order3_adj_count(node_num, triangle_num, triangle_node, triangle_neighbor, adj_row); int[] adj = Adjacency.triangulation_order3_adj_set(node_num, triangle_num, triangle_node, triangle_neighbor, adj_num, adj_row); AdjacencyMatrix.adj_print(node_num, adj_num, adj_row, adj, " ADJ array:"); int bandwidth = AdjacencyMatrix.adj_bandwidth(node_num, adj_num, adj_row, adj); Console.WriteLine(""); Console.WriteLine(" ADJ bandwidth = " + bandwidth + ""); perm = new int[node_num]; perm = Burkardt.Graph.GenRCM.genrcm(node_num, adj_num, adj_row, adj); typeMethods.i4vec_print(node_num, perm, " The RCM permutation:"); int[] perm_inv = new int[node_num]; typeMethods.perm_inverse3(node_num, perm, ref perm_inv); bandwidth = AdjacencyMatrix.adj_perm_bandwidth(node_num, adj_num, adj_row, adj, perm, perm_inv); Console.WriteLine(""); Console.WriteLine(" Permuted ADJ bandwidth = " + bandwidth + ""); } }