Example #1
0
        public int PostBidder(BidderDto bidder)
        {
            try
            {
                Diffusion diffusion = new Diffusion();

                var offer     = _context.Offer.Include("diffusOffer").Where(o => o.id == bidder.offer.id).FirstOrDefault();
                var oldBidder = _context.Bidder.Where(b => b.email == bidder.email).FirstOrDefault();

                if (oldBidder != null)
                {
                    offer.diffusOffer.Add(new Diffusion(bidder.offer, oldBidder));
                }
                else
                {
                    Bidder newBidder = new Bidder(bidder.firstName, bidder.lastName, bidder.email, bidder.tel, bidder.fax, bidder.domaine, bidder.typeEnterprise, bidder.address);

                    offer.diffusOffer.Add(new Diffusion(bidder.offer, newBidder));
                }

                _context.SaveChanges();

                var bid = _context.Diffusion.Where(d => d.offerId == bidder.offer.id).FirstOrDefault().bidder;

                return(bid.Id);
            } catch (Exception e)
            {
                Debug.WriteLine(e.Message + e.StackTrace);
                throw;
            }
        }
Example #2
0
 public playlistPlay_button(mediaControl medContr, Diffusion dif)
 {
     if (medContr.listUri.Count != 0) // ?? la logique
     {
         dif.Show();
         dif.Focus();
         medContr.playlistPlay();
     }
     else //  Sinon afficher une erreur via la popup
     {
         Popup popup = new Popup();
         popup.textBox.Text = "Playlist non configurée.";
         popup.ShowDialog();
     }
 }
Example #3
0
 public play_button(Diffusion diff, UserControl usrContr, mediaControl medContr)
 {
     if (medContr.q.IsLoaded == true) // A corriger ( ne se relance pas )
     {
         if (medContr.u != null)
         {
             medContr.setURL(medContr.u); // ?
         }
         else
         {
             Popup popup = new Popup(); // Afficher la popup avec le texte en fonction de la condition
             popup.ShowDialog();
         }
     }
     else
     {
         diff = new Diffusion(usrContr);
         usrContr.medContr = diff.medContr; // Diffusion du média element
     }
 }
Example #4
0
    /// <summary>
    /// This procedure contains the user code. Input parameters are provided as regular arguments,
    /// Output parameters as ref arguments. You don't have to assign output parameters,
    /// they will have a default value.
    /// </summary>
    private void RunScript(Point3d P0, int n, double evap, bool wrap, bool reset, bool go, bool MT, ref object P, ref object cPind, ref object nIndexes, ref object S)
    {
        // reset/initialize

        if (reset || diff == null || diff.ptsArray.Length != n * n)
        {
            diff             = new Diffusion(n, n, wrap);
            ptsList          = new Point3dList(diff.ptsArray); // create a Point3dList for faster closest point calculation
            cP               = ptsList.ClosestIndex(P0);       // find index of closest point to attractor
            diff.stigVal[cP] = 1;
            c = 0;                                             // reset counter
        }

        if (go)
        {
            diff.evap = evap;
            cP        = ptsList.ClosestIndex(P0); // find index of closest point to attractor

            if (MT)
            {
                diff.UpdateMT();
            }
            else
            {
                diff.Update();
            }
            diff.stigVal[cP] = 1;
            c++;
            Component.ExpireSolution(true);
        }

        P     = diff.ptsArray.Select(x => new GH_Point(x));
        S     = diff.stigVal.Select(x => new GH_Number(x));
        cPind = cP;
        // nIndexes = diff.GetNeighIndexes();
    }
Example #5
0
    private static void bnt_contour()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    BNT_CONTOUR displays contour plots of a 2D stochastic diffusivity function.
    //
    //  Discussion:
    //
    //    The diffusivity function is compute by DIFFUSIVITY_2D_BNT.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    07 August 2013
    //
    //  Author:
    //
    //    John Burkardt
    //
    //  Reference:
    //
    //    Ivo Babuska, Fabio Nobile, Raul Tempone,
    //    A stochastic collocation method for elliptic partial differential equations
    //    with random input data,
    //    SIAM Journal on Numerical Analysis,
    //    Volume 45, Number 3, 2007, pages 1005-1034.
    //
    {
        const string  command_filename = "bnt_commands.txt";
        List <string> command_unit     = new();
        const string  data_filename    = "bnt_data.txt";
        List <string> data_unit        = new();
        int           j;
        const int     m  = 4;
        const int     nx = 41;
        const int     ny = 31;

        Console.WriteLine("");
        Console.WriteLine("BNT_CONTOUR");
        Console.WriteLine("  Display contour or surface plots of the stochastic");
        Console.WriteLine("  diffusivity function defined by DIFFUSIVITY_2D_BNT.");
        Console.WriteLine("");
        Console.WriteLine("  The first plot uses uniform random values for OMEGA.");
        Console.WriteLine("  The second uses Gaussian (normal) random values.");
        //
        //  Set the spatial grid.
        //
        double[] xvec = typeMethods.r8vec_linspace_new(nx, -1.5, 0.0);
        double[] yvec = typeMethods.r8vec_linspace_new(ny, -0.4, 0.8);

        double[] xmat = new double[nx * ny];
        double[] ymat = new double[nx * ny];
        typeMethods.r8vec_mesh_2d(nx, ny, xvec, yvec, ref xmat, ref ymat);
        //
        //  Sample OMEGA.
        //
        int seed = 123456789;

        double[] omega = UniformRNG.r8vec_uniform_01_new(m, ref seed);
        //
        //  Compute the diffusivity field.
        //
        const double dc0 = 10.0;
        const int    n   = nx * ny;

        double[] dc = Diffusion.diffusivity_2d_bnt(dc0, omega, n, xmat, ymat);

        for (j = 0; j < ny; j++)
        {
            int i;
            for (i = 0; i < nx; i++)
            {
                data_unit.Add("  " + xmat[i + j * nx].ToString(CultureInfo.InvariantCulture).PadLeft(14)
                              + "  " + ymat[i + j * nx].ToString(CultureInfo.InvariantCulture).PadLeft(14)
                              + "  " + dc[i + j * nx].ToString(CultureInfo.InvariantCulture).PadLeft(14) + "");
            }

            data_unit.Add("");
        }

        File.WriteAllLines(data_filename, data_unit);

        Console.WriteLine("");
        Console.WriteLine("  Created graphics data file '" + data_filename + "'.");

        command_unit.Add("# " + command_filename + "");
        command_unit.Add("#");
        command_unit.Add("# Usage:");
        command_unit.Add("#  gnuplot < " + command_filename + "");
        command_unit.Add("#");
        command_unit.Add("set term png");
        command_unit.Add("set output 'bnt_contour.png'");
        command_unit.Add("set xlabel '<---X--->'");
        command_unit.Add("set ylabel '<---Y--->'");
        command_unit.Add("set zlabel '<---DC(X,Y)--->'");
        command_unit.Add("set title 'BNT Stochastic diffusivity function'");
        command_unit.Add("set contour");
        command_unit.Add("set timestamp");
        command_unit.Add("set cntrparam levels 10");
        command_unit.Add("#set view map");
        command_unit.Add("set view 75, 75");
        command_unit.Add("unset key");
        command_unit.Add("splot '" + data_filename + "'");

        File.WriteAllLines(command_filename, command_unit);

        Console.WriteLine("  Created graphics command file '" + command_filename + "'");
    }
Example #6
0
    private static void xk_contour()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    XK_CONTOUR displays contour plots of a 1D stochastic diffusivity function.
    //
    //  Discussion:
    //
    //    The diffusivity function is compute by DIFFUSIVITY_1D_XK.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    07 August 2013
    //
    //  Author:
    //
    //    John Burkardt
    //
    //  Reference:
    //
    //    Dongbin Xiu, George Karniadakis,
    //    Modeling uncertainty in steady state diffusion problems via
    //    generalized polynomial chaos,
    //    Computer Methods in Applied Mechanics and Engineering,
    //    Volume 191, 2002, pages 4927-4948.
    //
    {
        const string  command_filename = "xk_commands.txt";
        List <string> command_unit     = new();
        const string  data_filename    = "xk_data.txt";
        List <string> data_unit        = new();
        int           j;

        typeMethods.r8vecNormalData data = new();

        Console.WriteLine("");
        Console.WriteLine("XK_CONTOUR");
        Console.WriteLine("  Plot the stochastic diffusivity function");
        Console.WriteLine("  defined by DIFFUSIVITY_1D_XK.");
        //
        //  Set up the spatial grid.
        //
        const int    n     = 51;
        const double x_min = -1.0;
        const double x_max = +1.0;

        double[] x = typeMethods.r8vec_linspace_new(n, x_min, x_max);
        //
        //  Sample the OMEGA values.
        //
        const int m    = 5;
        int       seed = 123456789;

        double[] omega = typeMethods.r8vec_normal_01_new(m, ref data, ref seed);
        //
        //  Compute the diffusivity field.
        //
        const double dc0 = 10.0;

        double[] dc = Diffusion.diffusivity_1d_xk(dc0, m, omega, n, x);

        for (j = 0; j < n; j++)
        {
            data_unit.Add("  " + x[j].ToString(CultureInfo.InvariantCulture).PadLeft(14)
                          + "  " + dc[j].ToString(CultureInfo.InvariantCulture).PadLeft(14) + "");
        }

        File.WriteAllLines(data_filename, data_unit);

        Console.WriteLine("");
        Console.WriteLine("  Created graphics data file '" + data_filename + "'");
        //
        //  Create the command file.
        //
        double dc_max = typeMethods.r8vec_max(n, dc);

        command_unit.Add("# " + command_filename + "");
        command_unit.Add("#");
        command_unit.Add("# Usage:");
        command_unit.Add("#  gnuplot < " + command_filename + "");
        command_unit.Add("#");
        command_unit.Add("set term png");
        command_unit.Add("set output 'xk_contour.png'");
        command_unit.Add("set xlabel '<---X--->'");
        command_unit.Add("set ylabel '<---DC(X)--->'");
        command_unit.Add("set yrange [0.0:" + dc_max + "]");
        command_unit.Add("set title 'XK Stochastic diffusivity function'");
        command_unit.Add("set grid");
        command_unit.Add("set style data lines");
        command_unit.Add("plot '" + data_filename + "' using 1:2 lw 3 linecolor rgb 'red'");

        File.WriteAllLines(command_filename, command_unit);

        Console.WriteLine("  Created graphics command file '" + command_filename + "'");
    }
Example #7
0
    private static void ntw_contour()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    NTW_CONTOUR displays a contour plot of a 2D stochastic diffusivity function.
    //
    //  Discussion:
    //
    //    The diffusivity function is compute by DIFFUSIVITY_2D_NTW.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    07 August 2013
    //
    //  Author:
    //
    //    John Burkardt
    //
    //  Reference:
    //
    //    Fabio Nobile, Raul Tempone, Clayton Webster,
    //    A Sparse Grid Stochastic Collocation Method for Partial Differential
    //    Equations with Random Input Data,
    //    SIAM Journal on Numerical Analysis,
    //    Volume 46, Number 5, 2008, pages 2309-2345.
    //
    {
        const string  command_filename = "ntw_commands.txt";
        List <string> command_unit     = new();
        const string  data_filename    = "ntw_data.txt";
        List <string> data_unit        = new();
        int           i;
        int           j;
        const int     m  = 21;
        const int     nx = 101;
        const int     ny = 101;

        Console.WriteLine("");
        Console.WriteLine("NTW_CONTOUR");
        Console.WriteLine("  Display contour or surface plots of the stochastic");
        Console.WriteLine("  diffusivity function defined by DIFFUSIVITY_2D_NTW.");
        //
        //  Set the spatial grid.
        //
        const double d = 1.0;

        double[] xvec = typeMethods.r8vec_linspace_new(nx, 0.0, d);
        double[] yvec = typeMethods.r8vec_linspace_new(ny, 0.0, d);

        double[] xmat = new double[nx * ny];
        double[] ymat = new double[nx * ny];
        typeMethods.r8vec_mesh_2d(nx, ny, xvec, yvec, ref xmat, ref ymat);
        //
        //  Sample OMEGA.
        //  We rescale to  [-sqrt(3),sqrt(3)].
        //
        int seed = 123456789;

        double[] omega = UniformRNG.r8vec_uniform_01_new(m, ref seed);
        for (i = 0; i < m; i++)
        {
            omega[i] = (1.0 - omega[i]) * -Math.Sqrt(3.0)
                       + omega[i] * Math.Sqrt(3.0);
        }

        //
        //  Evaluate the diffusivity field.
        //
        const double cl  = 0.1;
        const double dc0 = 0.5;

        double[] dc = Diffusion.diffusivity_2d_ntw(cl, dc0, m, omega, nx * ny, xmat, ymat);

        for (j = 0; j < ny; j++)
        {
            for (i = 0; i < nx; i++)
            {
                data_unit.Add("  " + xmat[i + j * nx].ToString(CultureInfo.InvariantCulture).PadLeft(14)
                              + "  " + ymat[i + j * nx].ToString(CultureInfo.InvariantCulture).PadLeft(14)
                              + "  " + dc[i + j * nx].ToString(CultureInfo.InvariantCulture).PadLeft(14) + "");
            }

            data_unit.Add("");
        }

        File.WriteAllLines(data_filename, data_unit);

        Console.WriteLine("");
        Console.WriteLine("  Created graphics data file '" + data_filename + "'");

        command_unit.Add("# " + command_filename + "");
        command_unit.Add("#");
        command_unit.Add("# Usage:");
        command_unit.Add("#  gnuplot < " + command_filename + "");
        command_unit.Add("#");
        command_unit.Add("set term png");
        command_unit.Add("set output 'ntw_contour.png'");
        command_unit.Add("set xlabel '<---X--->'");
        command_unit.Add("set ylabel '<---Y--->'");
        command_unit.Add("set zlabel '<---DC(X,Y)--->'");
        command_unit.Add("set title 'NTW Stochastic diffusivity function'");
        command_unit.Add("set contour");
        command_unit.Add("set timestamp");
        command_unit.Add("set cntrparam levels 15");
        command_unit.Add("#set view map");
        command_unit.Add("set view 65, 65");
        command_unit.Add("set key");
        command_unit.Add("splot '" + data_filename + "'");

        File.WriteAllLines(command_filename, command_unit);

        Console.WriteLine("  Created graphics command file '" + command_filename + "'.");
    }
Example #8
0
    private static void elman_contour()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    ELMAN_CONTOUR displays a contour plot of a 2D stochastic diffusivity function.
    //
    //  Discussion:
    //
    //    The diffusivity function is compute by DIFFUSIVITY_2D_ELMAN.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    07 August 2013
    //
    //  Author:
    //
    //    John Burkardt
    //
    //  Reference:
    //
    //    Howard Elman, Darran Furnaval,
    //    Solving the stochastic steady-state diffusion problem using multigrid,
    //    IMA Journal on Numerical Analysis,
    //    Volume 27, Number 4, 2007, pages 675-688.
    //
    {
        const string  command_filename = "elman_commands.txt";
        List <string> command_unit     = new();
        const string  data_filename    = "elman_data.txt";
        List <string> data_unit        = new();
        int           j;
        const int     m_1d = 5;
        const int     nx   = 51;
        const int     ny   = 51;

        typeMethods.r8vecNormalData data = new();

        Console.WriteLine("");
        Console.WriteLine("ELMAN_CONTOUR");
        Console.WriteLine("  Display contour or surface plots of the stochastic");
        Console.WriteLine("  diffusivity function defined by DIFFUSIVITY_2D_ELMAN.");
        //
        //  Set the spatial grid.
        //
        const double a = 1.0;

        double[] xvec = typeMethods.r8vec_linspace_new(nx, -a, a);
        double[] yvec = typeMethods.r8vec_linspace_new(ny, -a, a);

        double[] xmat = new double[nx * ny];
        double[] ymat = new double[nx * ny];
        typeMethods.r8vec_mesh_2d(nx, ny, xvec, yvec, ref xmat, ref ymat);
        //
        //  Sample OMEGA.
        //
        int seed = 123456789;

        double[] omega = typeMethods.r8vec_normal_01_new(m_1d * m_1d, ref data, ref seed);
        //
        //  Compute the diffusivity field.
        //
        const double cl  = 0.1;
        const double dc0 = 10.0;

        double[] dc = Diffusion.diffusivity_2d_elman(a, cl, dc0, m_1d, omega, nx, nx, xmat, ymat);

        for (j = 0; j < ny; j++)
        {
            int i;
            for (i = 0; i < nx; i++)
            {
                data_unit.Add("  " + xmat[i + j * nx].ToString(CultureInfo.InvariantCulture).PadLeft(14)
                              + "  " + ymat[i + j * nx].ToString(CultureInfo.InvariantCulture).PadLeft(14)
                              + "  " + dc[i + j * nx].ToString(CultureInfo.InvariantCulture).PadLeft(14) + "");
            }

            data_unit.Add("");
        }

        File.WriteAllLines(data_filename, data_unit);

        Console.WriteLine("");
        Console.WriteLine("  Created graphics data file '" + data_filename + "'");

        command_unit.Add("# " + command_filename + "");
        command_unit.Add("#");
        command_unit.Add("# Usage:");
        command_unit.Add("#  gnuplot < " + command_filename + "");
        command_unit.Add("#");
        command_unit.Add("set term png");
        command_unit.Add("set output 'elman_contour.png'");
        command_unit.Add("set xlabel '<---X--->'");
        command_unit.Add("set ylabel '<---Y--->'");
        command_unit.Add("set zlabel '<---DC(X,Y)--->'");
        command_unit.Add("set title 'Elman Stochastic diffusivity function'");
        command_unit.Add("set contour");
        command_unit.Add("set timestamp");
        command_unit.Add("set cntrparam levels 10");
        command_unit.Add("#set view map");
        command_unit.Add("set view 75, 75");
        command_unit.Add("unset key");
        command_unit.Add("splot '" + data_filename + "'");

        File.WriteAllLines(command_filename, command_unit);

        Console.WriteLine("  Created graphics command file '" + command_filename + "'");
    }
Example #9
0
		public void setNeighbouhrs(Diffusion up, Diffusion down, Diffusion left, Diffusion right) {
			_up = up;
			_down = down;
			_left = left;
			_right = right;
		}
 public OtherShareUtilsIOS(Diffusion diffusion)
 {
     m_Diffusion = diffusion;
 }
Example #11
0
    private static void test01()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    TEST01 plots a sample solution of a 2D stochastic diffusivity equation.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    04 September 2013
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        const string  command_filename = "solution_commands.txt";
        List <string> command_unit     = new();
        const string  data_filename    = "solution_data.txt";
        List <string> data_unit        = new();
        int           i;
        int           j;

        typeMethods.r8vecNormalData data = new();

        Console.WriteLine("");
        Console.WriteLine("TEST01:");
        Console.WriteLine("  Consider the steady heat equation in the unit square,");
        Console.WriteLine("  with 0 Dirichlet boundary conditions, ");
        Console.WriteLine("  and a heat source term F that is a Gaussian centered at (0.60,0.80).");
        Console.WriteLine("");
        Console.WriteLine("  Model the diffusivity coefficient as spatially varying,");
        Console.WriteLine("  with a stochastic dependence on parameters OMEGA(1:4),");
        Console.WriteLine("  as described in Babuska, Nobile, Tempone (BNT).");
        Console.WriteLine("");
        Console.WriteLine("  Compute and display the solution U for a given choice");
        Console.WriteLine("  of the parameters OMEGA.");
        //
        //  Create the X and Y coordinate vectors.
        //
        const int    nx   = 21;
        const double xmin = 0.0;
        const double xmax = 1.0;

        double[] xvec = typeMethods.r8vec_linspace_new(nx, xmin, xmax);

        const int    ny   = 21;
        const double ymin = 0.0;
        const double ymax = 1.0;

        double[] yvec = typeMethods.r8vec_linspace_new(ny, ymin, ymax);
        //
        //  Create the X and Y coordinate matrices.
        //
        double[] xmat = new double[nx * ny];
        double[] ymat = new double[nx * ny];
        typeMethods.r8vec_mesh_2d(nx, ny, xvec, yvec, ref xmat, ref ymat);
        //
        //  Sample OMEGA:
        //
        int seed = 123456789;

        double[] omega = typeMethods.r8vec_normal_01_new(4, ref data, ref seed);
        for (i = 0; i < 4; i++)
        {
            omega[i] = 2.0 * omega[i];
        }

        typeMethods.r8vec_print(4, omega, "  Sampled OMEGA values:");
        //
        //  Solve the finite difference approximation to the steady 2D heat equation
        //  for this set of OMEGA values.
        //
        double[] umat = Diffusion.stochastic_heat2d(omega, nx, ny, xvec, yvec, test01_f);

        for (j = 0; j < ny; j++)
        {
            for (i = 0; i < nx; i++)
            {
                data_unit.Add("  " + xmat[i + j * nx]
                              + "  " + ymat[i + j * nx]
                              + "  " + umat[i + j * nx] + "");
            }

            data_unit.Add("");
        }

        File.WriteAllLines(data_filename, data_unit);
        Console.WriteLine("");
        Console.WriteLine("  Created graphics data file '" + data_filename + "'");

        command_unit.Add("# " + command_filename + "");
        command_unit.Add("#");
        command_unit.Add("# Usage:");
        command_unit.Add("#  gnuplot < " + command_filename + "");
        command_unit.Add("#");
        command_unit.Add("set term png");
        command_unit.Add("set output 'solution.png'");
        command_unit.Add("set xlabel '<---X--->'");
        command_unit.Add("set ylabel '<---Y--->'");
        command_unit.Add("set zlabel '<---U(X,Y)--->'");
        command_unit.Add("set title 'Sample Solution'");
        command_unit.Add("set contour");
        command_unit.Add("set timestamp");
        command_unit.Add("set cntrparam levels 10");
        command_unit.Add("set view 75, 75");
        command_unit.Add("unset key");
        command_unit.Add("splot '" + data_filename + "'");

        File.WriteAllLines(command_filename, command_unit);

        Console.WriteLine("  Created graphics command file '" + command_filename + "'");
        //
        //  Report the average value of U.
        //
        double u_mean = typeMethods.r8mat_mean(nx, ny, umat);

        Console.WriteLine("");
        Console.WriteLine("  Mean value of U is " + u_mean + "");
    }
Example #12
0
    private static void test02()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    TEST02 looks at mean temperature as a function of OMEGA(1) and OMEGA(2).
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    04 September 2013
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        const string  command_filename = "umean_commands.txt";
        List <string> command_unit     = new();
        const string  data_filename    = "umean_data.txt";
        List <string> data_unit        = new();
        int           i;
        int           j;

        double[] omega = new double[4];

        Console.WriteLine("");
        Console.WriteLine("TEST02:");
        Console.WriteLine("  Fix OMEGA(3) = 4, OMEGA(4) = 0, and");
        Console.WriteLine("  examine dependence of average temperature on OMEGA(1) and OMEGA(2)");
        Console.WriteLine("  over the range [-10,+10].");
        //
        //  Create the X and Y coordinate vectors.
        //
        const int    nx   = 21;
        const double xmin = 0.0;
        const double xmax = 1.0;

        double[] xvec = typeMethods.r8vec_linspace_new(nx, xmin, xmax);

        const int    ny   = 21;
        const double ymin = 0.0;
        const double ymax = 1.0;

        double[] yvec = typeMethods.r8vec_linspace_new(ny, ymin, ymax);
        //
        //  Create the X and Y coordinate matrices.
        //
        double[] xmat = new double[nx * ny];
        double[] ymat = new double[nx * ny];
        typeMethods.r8vec_mesh_2d(nx, ny, xvec, yvec, ref xmat, ref ymat);
        //
        //  Create OMEGA1 and OMEGA2 vectors.
        //
        const int    omega1_num = 21;
        const double omega1_min = -10.0;
        const double omega1_max = +10.0;

        double[] omega1_vec = typeMethods.r8vec_linspace_new(omega1_num, omega1_min, omega1_max);

        const int    omega2_num = 21;
        const double omega2_min = -10.0;
        const double omega2_max = +10.0;

        double[] omega2_vec = typeMethods.r8vec_linspace_new(omega2_num, omega2_min, omega2_max);
        //
        //  Create the OMEGA1 and OMEGA2 coordinate matrices.
        //
        double[] omega1_mat = new double[omega1_num * omega2_num];
        double[] omega2_mat = new double[omega1_num * omega2_num];
        typeMethods.r8vec_mesh_2d(omega1_num, omega2_num, omega1_vec, omega2_vec, ref omega1_mat, ref omega2_mat);
        //
        //  Set OMEGA(3) and OMEGA(4).
        //
        omega[2] = 4.0;
        omega[3] = 0.0;

        Console.WriteLine("");
        Console.WriteLine("  Omega(3) fixed at " + omega[2] + "");
        Console.WriteLine("  Omega(4) fixed at " + omega[3] + "");
        //
        //  Solve the finite difference approximation to the steady 2D heat equation,
        //  and save the mean value of the solution, which is a slightly biased
        //  estimate of the heat integral over the unit square.
        //
        double[] u_mean_mat = new double[omega1_num * omega2_num];

        for (j = 0; j < omega2_num; j++)
        {
            omega[1] = omega2_vec[j];
            for (i = 0; i < omega1_num; i++)
            {
                omega[0] = omega1_vec[i];
                double[] umat = Diffusion.stochastic_heat2d(omega, nx, ny, xvec, yvec, test01_f);
                u_mean_mat[i + j * omega1_num] = typeMethods.r8mat_mean(nx, ny, umat);
            }
        }

        for (j = 0; j < ny; j++)
        {
            for (i = 0; i < nx; i++)
            {
                data_unit.Add("  " + omega1_mat[i + j * omega1_num]
                              + "  " + omega2_mat[i + j * omega1_num]
                              + "  " + u_mean_mat[i + j * omega1_num] + "");
            }

            data_unit.Add("");
        }

        File.WriteAllLines(data_filename, data_unit);
        Console.WriteLine("");
        Console.WriteLine("  Created graphics data file '" + data_filename + "'");

        command_unit.Add("# " + command_filename + "");
        command_unit.Add("#");
        command_unit.Add("# Usage:");
        command_unit.Add("#  gnuplot < " + command_filename + "");
        command_unit.Add("#");
        command_unit.Add("set term png");
        command_unit.Add("set output 'umean.png'");
        command_unit.Add("set xlabel '<---OMEGA1--->'");
        command_unit.Add("set ylabel '<---OMEGA2--->'");
        command_unit.Add("set zlabel '<---U_MEAN(OMEGA1,OMEGA2)--->'");
        command_unit.Add("set title 'Solution Mean as Function of Omega1, Omega2'");
        command_unit.Add("set contour");
        command_unit.Add("set timestamp");
        command_unit.Add("set cntrparam levels 10");
        command_unit.Add("set view 75, 75");
        command_unit.Add("unset key");
        command_unit.Add("splot '" + data_filename + "'");

        File.WriteAllLines(command_filename, command_unit);

        Console.WriteLine("  Created graphics command file '" + command_filename + "'");
        //
        //  Print the maximum value of the mean.
        //
        double u_mean_max = typeMethods.r8mat_max(omega1_num, omega2_num, u_mean_mat);

        Console.WriteLine("");
        Console.WriteLine("  U_Mean_Max = " + u_mean_max + "");
    }