Ejemplo n.º 1
0
    private static void test12()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    TEST12 tests TRIANGULATION_ORDER6_ADJ_SET
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    05 January 2007
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        int hole_num     = 0;
        int node_num     = 0;
        int triangle_num = 0;

        Console.WriteLine("");
        Console.WriteLine("TEST12");
        Console.WriteLine("  TRIANGULATION_ORDER6_ADJ_SET sets the (lower)");
        Console.WriteLine("  adjacencies defined by a triangulation.");

        Order6_Example.triangulation_order6_example2_size(ref node_num, ref triangle_num, ref hole_num);

        double[] node_xy           = new double[2 * node_num];
        int[]    triangle_node     = new int[6 * triangle_num];
        int[]    triangle_neighbor = new int[3 * triangle_num];

        Order6_Example.triangulation_order6_example2(node_num, triangle_num, ref node_xy,
                                                     ref triangle_node, ref triangle_neighbor);

        typeMethods.i4mat_transpose_print(6, triangle_num, triangle_node,
                                          "  TRIANGLE_NODE");

        int[] adj_row = new int[node_num + 1];

        int adj_num = Adjacency.triangulation_order6_adj_count(node_num, triangle_num, triangle_node,
                                                               ref triangle_neighbor, ref adj_row);

        int[] adj = new int [adj_num];

        adj = Adjacency.triangulation_order6_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 + "");
    }
Ejemplo n.º 2
0
    private static void test11()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    TEST11 tests TRIANGULATION_ORDER6_ADJ_COUNT
    //
    //  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("TEST11");
        Console.WriteLine("  TRIANGULATION_ORDER6_ADJ_COUNT counts the (lower)");
        Console.WriteLine("  adjacencies defined by a triangulation.");

        Order6_Example.triangulation_order6_example2_size(ref node_num, ref triangle_num, ref hole_num);

        double[] node_xy           = new double[2 * node_num];
        int[]    triangle_node     = new int[6 * triangle_num];
        int[]    triangle_neighbor = new int[3 * triangle_num];

        Order6_Example.triangulation_order6_example2(node_num, triangle_num, ref node_xy,
                                                     ref triangle_node, ref triangle_neighbor);

        int[] adj_row = new int[node_num + 1];

        Adjacency.triangulation_order6_adj_count(node_num, triangle_num,
                                                 triangle_node, ref triangle_neighbor, ref adj_row);

        typeMethods.i4vec_print(node_num + 1, adj_row, "  ADJ_ROW");
    }
Ejemplo n.º 3
0
    private static void test04()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    TEST04 tests GENRCM
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    06 January 2007
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        int       hole_num = 0;
        int       i;
        int       node_num       = 0;
        int       triangle_num   = 0;
        const int triangle_order = 6;

        Console.WriteLine("");
        Console.WriteLine("TEST04");
        Console.WriteLine("  GENRCM generates the Reverse Cuthill McKee ordering.");

        Order6_Example.triangulation_order6_example2_size(ref node_num, ref triangle_num, ref hole_num);

        double[] node_xy           = new double[2 * node_num];
        int[]    triangle_node     = new int[triangle_order * triangle_num];
        int[]    triangle_neighbor = new int[3 * triangle_num];

        Order6_Example.triangulation_order6_example2(node_num, triangle_num, ref node_xy,
                                                     ref triangle_node, ref triangle_neighbor);
        //
        //  Randomly permute the nodes.
        //
        int seed = 123456789;

        int[] perm = typeMethods.perm_uniform(node_num, 0, ref seed);

        typeMethods.i4vec_print(node_num, perm, "  The random permutation:");

        for (i = 0; i < triangle_order; i++)
        {
            int j;
            for (j = 0; j < triangle_num; j++)
            {
                int node = triangle_node[i + j * triangle_order];
                triangle_node[i + j * triangle_order] = perm[node - 1];
            }
        }

        typeMethods.i4mat_transpose_print(triangle_order, triangle_num, triangle_node,
                                          "  Permuted TRIANGLE_NODE");

        int[] adj_row = new int[node_num + 1];

        int adj_num = Adjacency.triangulation_order6_adj_count(node_num, triangle_num,
                                                               triangle_node, ref triangle_neighbor, ref adj_row);

        int[] adj = Adjacency.triangulation_order6_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 + "");
    }