//============================ // CONSTRUCTOR //============================ public Simulation(AxiCodend Codend, int[] catches, double towing_speed, ICodendSaver result_saver) { this.Codend = Codend; this.catches = catches; this.towing_speed = towing_speed; this.ResultSaver = result_saver; SolverSettings = new SolverSettings(); // go with default settingst precalcX = new double[Codend.dof]; previousX = new double[Codend.dof]; }
static void Run(InputArguments args) { var cfg = ParseYaml <JobConfig>(args.jobFile); var codendMaterial = cfg.material; var solverSettings = cfg.solver; var codendGeometry = cfg.geometry; AxiCodend codend = new AxiCodend(); if (codendMaterial.MeshOrientation == MeshOrientation.T0) { codend = new AxiModelT0(codendGeometry, codendMaterial); // initialize T0 model } else if (codendMaterial.MeshOrientation == MeshOrientation.T90) { codend = new AxiModelT90(codendGeometry, codendMaterial); } else { throw new ArgumentException( "Incorrect mesh orientation. Value should be 0 or 90."); } var output = cfg.output; ICodendSaver resultSaver; if (output.Format == OutputFormats.json) { resultSaver = new JSONResultSaver(output.GetPath()); } else if (output.Format == OutputFormats.txt) { resultSaver = new CSVResultSaver(output.GetPath()); } else { throw new ArgumentException( "Incorrect file format. Value should \"json\" or \"txt\"."); } var TowingSimulation = new Simulation( codend, cfg.catches, cfg.towing_speed, resultSaver) { SolverSettings = solverSettings, }; TowingSimulation.Simulate(); }