static void Main(string[] args) { // set nmath license key CenterSpace.NMath.Core.NMathConfiguration.LicenseKey = License.NMath_License_Key; Dictionary<string, object> inputs = new Dictionary<string, object>(); Inputs_to_Dictionary.Add_Input_Parameters_to_Dictionary(ref inputs, "Solver_Config.txt"); Inputs_to_Dictionary.Add_Input_Parameters_to_Dictionary(ref inputs, args[1]); int no_sims = 1; bool batch_run = false; if (inputs.ContainsKey("batch_run")) batch_run = (bool)inputs["batch_run"]; if (inputs.ContainsKey("no_sims")) no_sims = (int)(double)inputs["no_sims"]; // get the sim_id for the first run // this is set using the first console input argumen int first_sim; if (!int.TryParse(args[0], out first_sim)) throw new ArgumentException("Error - an integer simulation index must be specified in as the first input argument! If not running in batch mode, this should be 0"); if (!inputs.ContainsKey("dim")) throw new KeyNotFoundException("Error - you must define the dimensionality of the system you want to solve!"); int dim = (int)(double)inputs["dim"]; Calculate_1D_Band_Structure(inputs); for (int sim_id = first_sim; sim_id < first_sim + no_sims; sim_id++) { inputs["sim_id"] = sim_id; IExperiment exp; if (batch_run) Prepare_Batch_Inputs(inputs, sim_id); switch (dim) { case 1: exp = new OneD_ThomasFermiPoisson.Experiment(); break; case 2: exp = new TwoD_ThomasFermiPoisson.Experiment(); break; case 3: exp = new ThreeD_SchrodingerPoissonSolver.Experiment(); break; default: throw new ArgumentException("Error - Requested dimension for the system dim = " + dim.ToString() + " not supported!"); } exp.Initialise(inputs); exp.Run(); } }
static void Main(string[] args) { // set nmath license key CenterSpace.NMath.Core.NMathConfiguration.LicenseKey = License.NMath_License_Key; Dictionary <string, object> inputs = new Dictionary <string, object>(); Inputs_to_Dictionary.Add_Input_Parameters_to_Dictionary(ref inputs, "Solver_Config.txt"); Inputs_to_Dictionary.Add_Input_Parameters_to_Dictionary(ref inputs, args[1]); int no_sims = 1; bool batch_run = false; if (inputs.ContainsKey("batch_run")) { batch_run = (bool)inputs["batch_run"]; } if (inputs.ContainsKey("no_sims")) { no_sims = (int)(double)inputs["no_sims"]; } // get the sim_id for the first run // this is set using the first console input argumen int first_sim; if (!int.TryParse(args[0], out first_sim)) { throw new ArgumentException("Error - an integer simulation index must be specified in as the first input argument! If not running in batch mode, this should be 0"); } if (!inputs.ContainsKey("dim")) { throw new KeyNotFoundException("Error - you must define the dimensionality of the system you want to solve!"); } int dim = (int)(double)inputs["dim"]; Calculate_1D_Band_Structure(inputs); for (int sim_id = first_sim; sim_id < first_sim + no_sims; sim_id++) { inputs["sim_id"] = sim_id; IExperiment exp; if (batch_run) { Prepare_Batch_Inputs(inputs, sim_id); } switch (dim) { case 1: exp = new OneD_ThomasFermiPoisson.Experiment(); break; case 2: exp = new TwoD_ThomasFermiPoisson.Experiment(); break; case 3: exp = new ThreeD_SchrodingerPoissonSolver.Experiment(); break; default: throw new ArgumentException("Error - Requested dimension for the system dim = " + dim.ToString() + " not supported!"); } exp.Initialise(inputs); exp.Run(); } }
static void Main(string[] args) { // set nmath license key CenterSpace.NMath.Core.NMathConfiguration.LicenseKey = License.NMath_License_Key; Dictionary<string, object> inputs = new Dictionary<string, object>(); Inputs_to_Dictionary.Add_Input_Parameters_to_Dictionary(ref inputs, "Solver_Config.txt"); Inputs_to_Dictionary.Add_Input_Parameters_to_Dictionary(ref inputs, args[1]); int no_runs = 1; bool batch_run = false; if (inputs.ContainsKey("batch_run")) batch_run = (bool)inputs["batch_run"]; if (inputs.ContainsKey("no_runs")) no_runs = (int)(double)inputs["no_runs"]; int first_run = 0; if (args.Length != 0) first_run = int.Parse(args[0]); if (!inputs.ContainsKey("dim")) throw new KeyNotFoundException("Error - you must define the dimensionality of the system you want to solve!"); int dim = (int)(double)inputs["dim"]; Calculate_1D_Band_Structure(inputs); for (int batch_no = first_run; batch_no < first_run + no_runs; batch_no++) { inputs["batch_no"] = batch_no; IExperiment exp; if (batch_run) Prepare_Batch_Inputs(inputs, batch_no); switch (dim) { case 1: exp = new OneD_ThomasFermiPoisson.Experiment(); break; case 2: exp = new TwoD_ThomasFermiPoisson.Experiment(); break; case 3: exp = new ThreeD_SchrodingerPoissonSolver.Experiment(); break; default: throw new ArgumentException("Error - Requested dimension for the system dim = " + dim.ToString() + " not supported!"); } exp.Initialise(inputs); exp.Run(); } }