Example #1
0
        private void runToolStripMenuItem_Click(object sender, EventArgs e)
        {
            fractalToolStripMenuItem.Enabled      = false;
            modeToolStripMenuItem.Enabled         = false;
            viewToolStripMenuItem.Enabled         = false;
            benchmarkingToolStripMenuItem.Enabled = false;
            reportToolStripMenuItem.Enabled       = false;

            Size[] sizes = new Size[] {
                new Size(320, 240),
                new Size(640, 480),
                new Size(800, 600),
                new Size(1024, 768)
            };

            ConcurrencyMode[] modes = new ConcurrencyMode[] {
                ConcurrencyMode.SequentialCPU,
                ConcurrencyMode.ParallelCPU,
                ConcurrencyMode.GPU
            };

            FractalGenerator[] generators = new FractalGenerator[] {
                new Julia(),
                new Mandelbrot()
            };

            this.metrics.Clear();

            foreach (Size size in sizes)
            {
                this.SetResolution(size.Width, size.Height);

                foreach (ConcurrencyMode mode in modes)
                {
                    this.SetConcurrencyMode(mode);

                    foreach (FractalGenerator generator in generators)
                    {
                        this.SetCurrentGenerator(generator);
                        this.Draw();
                    }
                }
            }

            fractalToolStripMenuItem.Enabled      = true;
            modeToolStripMenuItem.Enabled         = true;
            viewToolStripMenuItem.Enabled         = true;
            benchmarkingToolStripMenuItem.Enabled = true;
            reportToolStripMenuItem.Enabled       = true;

            GenerationMetricChartForm chartForm = new GenerationMetricChartForm();

            chartForm.LoadMetrics(this.metrics);

            chartForm.ShowDialog(this);
        }
Example #2
0
        /// <summary>
        /// Sets the current fractal generator.
        /// </summary>
        /// <param name="generator">The generator.</param>
        private void SetCurrentGenerator(FractalGenerator generator)
        {
            this.currentGenerator = generator;

            if (this.currentGenerator == this.mandelbrot)
            {
                this.mandelbrotToolStripMenuItem.Checked = true;
                this.juliaToolStripMenuItem.Checked      = false;
            }

            else
            {
                this.mandelbrotToolStripMenuItem.Checked = false;
                this.juliaToolStripMenuItem.Checked      = true;
            }
        }