private void analyseBtn_Click(object sender, EventArgs e) { try { // collect data int n = int.Parse(edtDivisionCounter.Text); SelectDataFromTable(4, n, out double[] Ue); SelectDataFromTable(6, n, out double[] DFE); var AC = new AnalysingCoefficient(Ue, DFE); double m = AC.FirstMethod(n, double.Parse(edtHighestTemp.Text), double.Parse(edtPowerTemp.Text), double.Parse(edtRadius.Text), int.Parse(indexUpDown.Value.ToString())); mScheme.Text = m.ToString(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Exception", MessageBoxButtons.OK, MessageBoxIcon.Stop); } }
private void collectAnalysBtn_Click(object sender, EventArgs e) { try { // initialize int __NZ = int.Parse(edtDivisionCounter.Text); double T0 = double.Parse(edtHighestTemp.Text); double M = double.Parse(edtPowerTemp.Text); double Radius = double.Parse(edtRadius.Text); //var ex = new ExactTest(__NZ, T0, M, Radius); var ex = new ExactSolution(__NZ, T0, M, Radius); //int MaxIndex = ex.NFreq - 1; // HERE!!! int MaxIndex = int.Parse(indexUpDown.Value.ToString()); double[] Freq = new double[MaxIndex + 1]; double[] MS = new double[MaxIndex + 1]; double[] Tau = new double[MaxIndex + 1]; // main stuff: collecting mScheme # found exception: 31-33 for (int index = 0; index <= MaxIndex; index++) { ex.Solve(index); var AC = new AnalysingCoefficient(ex.U, ex.DivF); double value = AC.FirstMethod(__NZ, T0, M, Radius, index); Freq[index] = ex.Freq; Tau[index] = ex.Tau; MS[index] = value; AC = null; } ex = null; // save m (analys) and tau to file using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"..//..//MT-reports//MT.txt")) { for (int j = 0; j <= MaxIndex; j++) { file.Write("{0}\t{1}\t{2}\n", Freq[j], MS[j], Tau[j]); } } // Graph // 1. Correct interface for (int i = 0; i < GraphCount; i++) { selector.SetItemChecked(i, false); GraphList[i] = false; chart.Series[i].Enabled = GraphList[i]; } selector.SetItemChecked(5, true); GraphList[5] = true; // 2. Clear old chart foreach (var s in chart.Series) { s.Points.Clear(); } // 3. Draw result Draw(5, Freq, MS); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Exception", MessageBoxButtons.OK, MessageBoxIcon.Stop); } }