private static void test01(int degree_max) //****************************************************************************80 // // Purpose: // // TEST01 tests WEDGE_INTEGRAL. // // Licensing: // // This code is distributed under the GNU LGPL license. // // Modified: // // 20 August 2014 // // Author: // // John Burkardt // // Parameters: // // Input, int DEGREE_MAX, the maximum total degree of the // monomials to check. // { int alpha; int[] expon = new int[3]; Console.WriteLine(""); Console.WriteLine("TEST01"); Console.WriteLine(" For the unit wedge,"); Console.WriteLine(" WEDGE_INTEGRAL returns the exact value of the"); Console.WriteLine(" integral of X^ALPHA Y^BETA Z^GAMMA"); Console.WriteLine(""); Console.WriteLine(" Volume = " + QuadratureRule.wedge_volume() + ""); Console.WriteLine(""); Console.WriteLine(" ALPHA BETA GAMMA INTEGRAL"); Console.WriteLine(""); for (alpha = 0; alpha <= degree_max; alpha++) { expon[0] = alpha; int beta; for (beta = 0; beta <= degree_max - alpha; beta++) { expon[1] = beta; int gamma; for (gamma = 0; gamma <= degree_max - alpha - beta; gamma++) { expon[2] = gamma; double value = QuadratureRule.wedge_integral(expon); Console.WriteLine(expon[0].ToString(CultureInfo.InvariantCulture).PadLeft(8) + " " + expon[1].ToString(CultureInfo.InvariantCulture).PadLeft(8) + " " + expon[2].ToString(CultureInfo.InvariantCulture).PadLeft(8) + " " + value.ToString(CultureInfo.InvariantCulture).PadLeft(14) + ""); } } } }
private static void test02(int degree_max) //****************************************************************************80 // // Purpose: // // TEST02 tests the rules for the unit wedge. // // Licensing: // // This code is distributed under the GNU LGPL license. // // Modified: // // 20 August 2014 // // Author: // // John Burkardt // // Parameters: // // Input, int DEGREE_MAX, the maximum total degree of the // monomials to check. // { const int dim_num = 3; int[] expon = new int[3]; int h = 0; int[] line_order_array = { 1, 2, 2, 3, 2, 3, 4 } ; int t = 0; const int test_num = 7; int[] triangle_order_array = { 1, 3, -3, 6, -6, 7, 12 } ; Console.WriteLine(""); Console.WriteLine("TEST02"); Console.WriteLine(" For the unit wedge,"); Console.WriteLine(" we approximate monomial integrals with WEDG_UNIT_RULE."); bool more = false; SubCompData data = new(); for (;;) { SubComp.subcomp_next(ref data, degree_max, dim_num, ref expon, ref more, ref h, ref t); if (expon[2] % 2 == 1) { if (!more) { break; } continue; } Console.WriteLine(""); Console.WriteLine(" Monomial exponents: " + expon[0].ToString(CultureInfo.InvariantCulture).PadLeft(2) + " " + expon[1].ToString(CultureInfo.InvariantCulture).PadLeft(2) + " " + expon[2].ToString(CultureInfo.InvariantCulture).PadLeft(2) + ""); Console.WriteLine(""); int test; double quad; for (test = 0; test < test_num; test++) { int line_order = line_order_array[test]; int triangle_order = triangle_order_array[test]; int order = line_order * Math.Abs(triangle_order); double[] w = new double[order]; double[] xyz = new double[dim_num * order]; QuadratureRule.wedge_rule(line_order, triangle_order, ref w, ref xyz); double[] v = Monomial.monomial_value(dim_num, order, expon, xyz); quad = QuadratureRule.wedge_volume() * typeMethods.r8vec_dot_product(order, w, v); Console.WriteLine(triangle_order.ToString(CultureInfo.InvariantCulture).PadLeft(6) + " " + line_order.ToString(CultureInfo.InvariantCulture).PadLeft(6) + " " + quad.ToString(CultureInfo.InvariantCulture).PadLeft(14) + ""); } Console.WriteLine(""); quad = QuadratureRule.wedge_integral(expon); Console.WriteLine(" Exact " + quad.ToString(CultureInfo.InvariantCulture).PadLeft(14) + ""); if (!more) { break; } } }