public IActionResult FormJacobiMethod(JacobiMethod jacobiMethod) { if (jacobiMethod.VectorB != null && jacobiMethod.MatrixA != null && jacobiMethod.VectorX != null) { JacobiMethodCPlusPlus jacobiMethodCPP = new JacobiMethodCPlusPlus(); if (jacobiMethodCPP.method(jacobiMethod.MatrixA, jacobiMethod.VectorB, jacobiMethod.VectorX, jacobiMethod.Eps)) { _jacobiMethodCPP.Result = jacobiMethodCPP.getVectorX(); } } return(View(_jacobiMethodCPP)); }
public async Task <IActionResult> FileJacobiDownload(JacobiMethod jacobiMethod, IFormFileCollection inputFiles) { uint id = _options.FileId; lock (_options) _options.FileId++; List <string> markers = new List <string> { "A", "b", "x" }; int i = 0; string fileResult = _hostingEnvironment.WebRootPath + "\\output_files\\"; string files = Path.Combine(_hostingEnvironment.WebRootPath, "input_files"); foreach (var file in inputFiles) { if (file != null) { string filePath = Path.Combine(files, id.ToString() + markers[i] + ".txt"); await using FileStream stream = System.IO.File.Create(filePath); await file.CopyToAsync(stream); stream.Close(); } i++; } try { JacobiMethodCPlusPlus jacobiMethodCPlusPlus = new JacobiMethodCPlusPlus(); if (jacobiMethodCPlusPlus.method(id, jacobiMethod.Eps)) { fileResult += id.ToString() + ".txt"; } else { fileResult += "empty.txt"; } } catch (Exception) { } Stream newStream = new FileStream(fileResult, FileMode.Open); return(File(newStream, "text/plain")); }
public IActionResult FormJacobiMethod(JacobiMethod jacobiMethod) { if (jacobiMethod.VectorB != null && jacobiMethod.MatrixA != null && jacobiMethod.VectorX != null) { try { JacobiMethodCPlusPlus jacobiMethodCPP = new JacobiMethodCPlusPlus(); if (jacobiMethodCPP.method(jacobiMethod.MatrixA, jacobiMethod.VectorB, jacobiMethod.VectorX, jacobiMethod.Eps)) { _jacobiMethodCPP.Result = jacobiMethodCPP.getVectorX(); } else { _jacobiMethodCPP.Result = "It is not strictly diagonally dominant system of linear equations."; } } catch (Exception) { } } return(View(_jacobiMethodCPP)); }