From 46202ca52e56e5855b2079b66d1a864f0e9214aa Mon Sep 17 00:00:00 2001 From: Saveliy Date: Sun, 26 May 2024 20:06:34 +0300 Subject: [PATCH] update solution --- .../headers/Dirichlet_Problem.hpp | 46 ++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/Poisson_Equation/headers/Dirichlet_Problem.hpp b/Poisson_Equation/headers/Dirichlet_Problem.hpp index ef8be4b..289c6fe 100644 --- a/Poisson_Equation/headers/Dirichlet_Problem.hpp +++ b/Poisson_Equation/headers/Dirichlet_Problem.hpp @@ -508,8 +508,52 @@ std::vector> const DirichletProblemSolver::so } std::cout << "General error: " << approximation_error << std::endl; + std::vector> res(n + 1, std::vector(m + 1, 0)); + + for (size_t j = m / 2; j <= m; ++j) + { + res[0][j] = mu1(start_y + static_cast(j) * k); + } + for (size_t j = 0; j <= m / 2; ++j) + { + res[n / 2][j] = mu2(start_y + static_cast(j) * k); + } + for (size_t j = 0; j <= m; ++j) + { + res[n][j] = mu3(start_y + static_cast(j) * k); + } + + for (size_t i = n / 2 + 1; i < n; ++i) + { + res[i][0] = mu4(start_x + static_cast(i) * h); + } + for (size_t i = 1; i < n / 2; ++i) + { + res[i][m / 2] = mu5(start_x + static_cast(i) * h); + } + for (size_t i = 1; i < n; ++i) + { + res[i][m] = mu6(start_x + static_cast(i) * h); + } + + size_t index = 0; + for (size_t j = 1; j <= m / 2; ++j) + { + for (size_t i = n / 2 + 1; i < n; ++i) + { + res[i][j] = solution[index++]; + } + } + for (size_t j = m / 2 + 1; j < m; ++j) + { + for (size_t i = 1; i < n; ++i) + { + res[i][j] = solution[index++]; + } + } + // Placeholder - return std::vector>(); + return res; }