Ejemplo n.º 1
0
 public GrowSurface(int L, int H, Deposition method, SubstrateType subType)
 {
     this.L       = L;
     this.H       = H;
     this.method  = method;
     this.subType = subType;
     Initialze();
 }
        void Reset()
        {
            int L, h;

            try
            {
                L = int.Parse(textBox_L.Text); //pictureBox1.Width / sizeRect;
                h = int.Parse(textBox_H.Text); //pictureBox1.Height / sizeRect;
            }
            catch (FormatException e) { MessageBox.Show(e.ToString()); return; }

            if (L < 20)
            {
                sizeRect = 20;
            }
            else if (L < 60)
            {
                sizeRect = 10;
            }
            //else if (L < 100) sizeRect = 4;
            //else if (L <= 200) sizeRect = 2;
            else
            {
                sizeRect = 1;
            }

            Deposition method = Deposition.EdenModel;

            if (radioButtonEden.Checked)
            {
                method = Deposition.EdenModel;
            }
            else if (radioButtonRandom.Checked)
            {
                method = Deposition.Random;
            }
            else if (radioButtonBallistic.Checked)
            {
                method = Deposition.Ballistic;
            }
            else if (radioButtonDLA.Checked)
            {
                method = Deposition.DLA;
            }
            else if (radioButtonRSOS.Checked)
            {
                method = Deposition.RSOS;
            }
            else if (radioButtonRDSR.Checked)
            {
                method = Deposition.RDSR;
            }
            else if (radioButtonWolfV.Checked)
            {
                method = Deposition.WV;
            }
            else if (radioButtonDST.Checked)
            {
                method = Deposition.DST;
            }

            labelMethod.Text = method.ToString();

            pictureBox1.Size       = new Size(L * sizeRect, h * sizeRect);
            groupBoxStructure.Left = pictureBox1.Right + 10;
            groupBoxMethod.Left    = groupBoxStructure.Left;
            pictureBox_W_t.Left    = groupBoxMethod.Right + 10;
            pictureBoxHave.Left    = pictureBox_W_t.Left;

            SubstrateType sunType = checkBoxWedged.Checked ?
                                    SubstrateType.Wegded : SubstrateType.Flat;


            surface    = new GrowSurface(L, h * 100, method, sunType);
            ptOccuiped = new Point[L];
            for (int n = 0; n < L; n++)
            {
                ptOccuiped[n].X = n;
            }

            bitMapSurface = new Bitmap(pictureBox1.Width, pictureBox1.Height);
            DrawBitMap();

            rectPlotCurve   = new Rectangle(50, 30, pictureBox_W_t.Width - 60, pictureBox_W_t.Height - 40);
            plotCurveW_t    = new Plot(rectPlotCurve);
            plotCurvehAve_t = new Plot(rectPlotCurve);
            TakeWidthSurafce();


            //if (sW_SurfaceWidth != null)
            //    sW_SurfaceWidth.Close();
            //string pathOut = CreateDirectory() + "\\" + method + " L=" + L + " H=" + h + ".txt";
            //pathOut = PathOut(pathOut);
            //sW_SurfaceWidth = new StreamWriter(pathOut);

            label_Step.Text = "num particles = " + surface.nAddedParticles;

            GC.Collect();
        }