public FMRFMFieldSweep(FMRFM fmrfm, string baseDir, string searchPattern) { H = new List <double>(); Fz = new List <double>(); this.fmrfm = fmrfm; this.baseDir = new System.IO.DirectoryInfo(baseDir); this.files = new List <System.IO.FileInfo>(); this.files.AddRange(this.baseDir.GetFiles(searchPattern)); }
public SimController(string dir, FMRFM fmrfm) { this.dir = (dir.Last() == '\\' ? dir : dir + "\\"); this.table = new MuMaxTable(this.dir + "table.txt"); this.fmrfm = fmrfm; for (int i = 0; i < table.data[table.keys[0]].Count; i++) { double h = table.data["Hext (T)"][i]; int fileN = Convert.ToInt16(table.data["fileN ()"][i]); Console.WriteLine("{0}, {1}", h, fileN); } }
//public FMRFMFieldSweepAdv(FMRFM fmrfm, string baseDir, bool ogEven) //{ //} public FMRFMFieldSweep(FMRFM fmrfm, string baseDir) { H = new List <double>(); Fz = new List <double>(); this.fmrfm = fmrfm; this.baseDir = new System.IO.DirectoryInfo(baseDir); this.files = new List <System.IO.FileInfo>(); this.files.AddRange(this.baseDir.GetFiles("m*.ovf")); int count = this.files.Count; this.files.Clear(); string dir = baseDir + "\\m"; for (int i = 1; i < count; i++) { this.files.Add(new System.IO.FileInfo(fname(6, dir, i))); } //this.files.Sort(); }
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; } }