Exemplo n.º 1
0
        public FastBitmapAccess(Bitmap b, Parameters p)
        {
            this.b = b;

            // Set up states
            su = new State(p);
            sv = new State(p);
        }
Exemplo n.º 2
0
 // Initialise parameters
 public void Initialise(Parameters p)
 {
     i = j = k = 0;
     this.p = p;
     Ru = p.Ru;
     Rv = p.Rv;
     normu = 1.0 / ((2 * Ru + 1) * (2 * Ru + 1));
     normv = 1.0 / ((2 * Rv + 1) * (2 * Rv + 1));
 }
Exemplo n.º 3
0
        public frmParameterBox()
        {
            InitializeComponent();

            btSave.Enabled = false; // The button is buggy

            bs = new BindingSource();
            bsnav = new BindingNavigator();
            r = new Random((int)DateTime.Now.Ticks);
            pdata = new Parameters(); // The chosen parameter set sent to main program
        }
Exemplo n.º 4
0
        public State(Parameters p)
        {
            t = 0.0;
            N = p.N;

            // Four arrays are need to describe the state u
            // using the moving average method
            u = new double[p.N, p.N];
            utemp = new double[p.N, p.N];
            hsum = new double[p.N, p.N];
            vsum = new double[p.N, p.N];
        }
Exemplo n.º 5
0
        // Initialise the states with user-defined initial u0,v0
        public void Initialise(State s, Parameters p, int a)
        {
            // a = 0 refers to species u
            // a = 1 refers to species v
            if (a == 0)
                for (int i = 0; i < p.N; i++)
                    for (int j = 0; j < p.N; j++)
                        s.U[i, j] = p.U0;

            else if (a == 1)
                for (int i = 0; i < p.N; i++)
                    for (int j = 0; j < p.N; j++)
                        s.U[i, j] = p.V0;
        }
Exemplo n.º 6
0
        // Adds new parameter p to list settings and updates the settings.csv file
        public void Save(List<Parameters> settings, string path, Parameters p)
        {
            TextWriter tw = File.CreateText(path+"\\settings.csv");

            settings.Add(p);

            // Save settings to settings.csv
            for (int j = 0; j < settings.Count(); j++)
            {
                //Save parameters
                tw.Write("{0},", settings[j].Psetname);
                tw.Write("{0},", settings[j].Ru);
                tw.Write("{0},", settings[j].Rv);
                tw.Write("{0},", settings[j].A);
                tw.Write("{0},", settings[j].B);
                tw.Write("{0},", settings[j].U0);
                tw.Write("{0},", settings[j].V0);
                tw.Write("{0},", settings[j].Step);
                tw.Write("{0},", settings[j].N);
                tw.WriteLine("{0}", settings[j].Maxtime);
            }

            tw.Close();
        }
Exemplo n.º 7
0
        private int rv; // Neighbourhood of state v

        #endregion Fields

        #region Constructors

        public Rules()
        {
            rand = new Random((int)DateTime.Now.Ticks);
            p = new Parameters();
        }
Exemplo n.º 8
0
 private void btOk_Click(object sender, EventArgs e)
 {
     pdata = (Parameters)bs.Current;
     this.DialogResult = DialogResult.OK;
     this.Close();
 }
Exemplo n.º 9
0
        // This just groups the different initialisations
        private void Initialisations()
        {
            // Variable initialisations
            t = 0.0;
            i = j = 0;
            bitmapsize = pictBoxu.Size.Width; // Bitmap size equals the size of the picturebox
            jump = 1.0;
            str = str2 = null;

            // For testing purposes
            lbtestu.Text = null;
            lbtestv.Text = null;

            // Initialise objects
            p = new Parameters();
            bs = new BindingSource();
            rules = new Rules();
            average = new double[2];
            sfd = new SaveFileDialog();
            pathpset = new string[2];

            // Create a subfolder within working directory called Images
            // Set this to be the initial directory
            pathpics = string.Format("{0}", path) + "\\Images\\";
            Directory.CreateDirectory(pathpics);
            sfd.InitialDirectory = pathpics;

            // Initialize the timer
            time = new Timer();
            time.Interval = 100;
            time.Tick += frm_Tick;

            // *** Initialisations ***
            diffu = p.Ru * (p.Ru + 1) * p.Step;
            diffu /= 6;
            diffv = p.Rv * (p.Rv + 1) * p.Step;
            diffv /= 6;
            tbDiffu.Text = Convert.ToString(diffu);
            tbDiffv.Text = Convert.ToString(diffv);

            rbFast.Checked = true;
            tbTime.Text = "0.00";
            tbTime.Enabled = false;
            tbJump.Text = Convert.ToString(jump);
            btJump.Enabled = true;
            tbDiffu.Enabled = false;
            tbDiffv.Enabled = false;
            btStop.Enabled = false;
            progbar.Visible = false;
            lbSave2.Visible = false;
            tbSave.Text = "1.0";
            cbSave.Checked = true;
        }