public FMRFM(Dipole cantileverDipole) { this.dipole = cantileverDipole; }
private void StartSim(string idir) { chart1.Series[0].ChartType = SeriesChartType.Line; System.Diagnostics.Stopwatch stw = new System.Diagnostics.Stopwatch(); stw.Start(); string mom_str = tb_DipMom.Text; string pos_str = tb_DipPos.Text; string[] mom = mom_str.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); string[] pos = pos_str.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); Vector M = new Vector(mom[0], mom[1], mom[2]); Vector P = new Vector(pos[0], pos[1], pos[2]); Dipole dip1 = new Dipole(P, M); double interfaceX = Convert.ToDouble(tb_IP.Text) * 1e-6; double MS1 = Convert.ToInt32(tb_Ms.Text) / (4 * Math.PI) * 1.0e3; double MS2 = Convert.ToInt32(tb_Ms2.Text) / (4 * Math.PI) * 1.0e3; List <int> PltChoice = new List <int>() { 0, 1 }; if (cb_Fz.Checked == false) { if (cb_Fx.Checked) { PltChoice[1] = 2; } else if (cb_Fy.Checked) { PltChoice[1] = 3; } else if (cb_Mz.Checked) { PltChoice[0] = 1; PltChoice[1] = 1; } else if (cb_Mx.Checked) { PltChoice[0] = 1; PltChoice[1] = 2; } else if (cb_My.Checked) { PltChoice[0] = 1; PltChoice[1] = 3; } } if (Simulation_Method == "8Avg_FieldScan") { AverageMagnetizations(idir, 8); pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; chart1.Series[0].ChartType = SeriesChartType.Line; currImgNum = 524; string loc = idir; chart1.Series[0].ChartType = SeriesChartType.Line; //FMRFM fmr = new FMRFM(dip1, new ovf2(loc + @"\1-m0.ovf"), 135282); FMRFM fmr = new FMRFM(dip1); SimController sim = new SimController(loc, fmr); //sim = new SimController(loc, fmr); sim.DoSweep(ops.newF, PltChoice, (vb1) => { if (vb1.x > interfaceX) { return(MS2); } else { return(MS1); } }, tb_section.Text); sim.PlotSweep(chart1, 0, "f2-2"); sim.SaveSweep(loc + "\\fieldSweep.txt"); ActiveSim = sim; mt = sim.table; return; } else if (Simulation_Method == "FFT") { pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; chart1.Series[0].ChartType = SeriesChartType.Line; currImgNum = 524; string loc = tb_Sweeps.Text; chart1.Series[0].ChartType = SeriesChartType.Line; FMRFM fmr = new FMRFM(dip1); SimController sim = new SimController(loc, fmr); sim = new SimController(loc, fmr); sim.DoSweep(ops.noRefF, PltChoice, (vb1) => { if (vb1.x > interfaceX) { return(MS2); } else { return(MS1); } }, tb_section.Text); sim.PlotSweep(chart1, 0, "f2-2"); sim.SaveSweep(loc + "\\fieldSweep.txt"); ActiveSim = sim; mt = sim.table; ChartArea CA = chart1.ChartAreas[0]; VA = new VerticalLineAnnotation(); VA.AxisX = CA.AxisX; VA.AllowMoving = true; VA.IsInfinitive = true; VA.ClipToChartArea = CA.Name; VA.Name = "myLine"; VA.LineColor = Color.Red; VA.LineWidth = 2; // use your numbers! chart1.Annotations.Add(VA); return; } }
public FMRFM(Dipole cantileverDipole, ovf2 m0, double MaterialMs) { this.dipole = cantileverDipole; this.m0 = m0; this.MaterialMs = MaterialMs; }