예제 #1
0
    private static void test02()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    TEST02 tests product Gauss-Legendre rules for the Legendre 3D integral.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    16 August 2014
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        double[] a = new double[3];
        double[] b = new double[3];

        a[0] = -1.0;
        a[1] = -1.0;
        a[2] = -1.0;
        b[0] = +1.0;
        b[1] = +1.0;
        b[2] = +1.0;

        Console.WriteLine("");
        Console.WriteLine("TEST02");
        Console.WriteLine("  Product Gauss-Legendre rules for the 3D Legendre integral.");
        Console.WriteLine("  Density function rho(x) = 1.");
        Console.WriteLine("  Region: -1 <= x <= +1.");
        Console.WriteLine("          -1 <= y <= +1.");
        Console.WriteLine("          -1 <= z <= +1.");
        Console.WriteLine("  Exactness: 3 = 2 * min ( 2, 3, 4 ) - 1");
        Console.WriteLine("  Order: N = 2 * 3 * 4");

        const int nx = 2;
        const int ny = 3;
        const int nz = 4;
        int       n  = nx * ny * nz;

        double[] x = new double[n];
        double[] y = new double[n];
        double[] z = new double[n];
        double[] w = new double[n];

        legendre_3d_set(a, b, nx, ny, nz, ref x, ref y, ref z, ref w);

        const int p_max = 4;

        Exactness.legendre_3d_exactness(a, b, n, x, y, z, w, p_max);
    }
예제 #2
0
    private static void test01()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    TEST01 tests product Gauss-Legendre rules for the Legendre 3D integral.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    16 August 2014
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        double[] a = new double[3];
        double[] b = new double[3];
        int      l;

        a[0] = -1.0;
        a[1] = -1.0;
        a[2] = -1.0;
        b[0] = +1.0;
        b[1] = +1.0;
        b[2] = +1.0;

        Console.WriteLine("");
        Console.WriteLine("TEST01");
        Console.WriteLine("  Product Gauss-Legendre rules for the 3D Legendre integral.");
        Console.WriteLine("  Density function rho(x) = 1.");
        Console.WriteLine("  Region: -1 <= x <= +1.");
        Console.WriteLine("          -1 <= y <= +1.");
        Console.WriteLine("          -1 <= z <= +1.");
        Console.WriteLine("  Level: L");
        Console.WriteLine("  Exactness: 2*L+1");
        Console.WriteLine("  Order: N = (L+1)*(L+1)*(L+1)");

        for (l = 0; l <= 5; l++)
        {
            int nx = l + 1;
            int ny = l + 1;
            int nz = l + 1;
            int n  = nx * ny * nz;
            int t  = 2 * l + 1;

            double[] x = new double[n];
            double[] y = new double[n];
            double[] z = new double[n];
            double[] w = new double[n];

            legendre_3d_set(a, b, nx, ny, nz, ref x, ref y, ref z, ref w);

            int p_max = t + 1;
            Exactness.legendre_3d_exactness(a, b, n, x, y, z, w, p_max);
        }
    }