From 165c18a6fe12a0a93a6fd2ad547dbc287cd53c58 Mon Sep 17 00:00:00 2001 From: fredrikr79 Date: Mon, 22 Sep 2025 19:25:07 +0200 Subject: [PATCH] ex3: task 6 --- exercise3/wave_1d_parallel.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/exercise3/wave_1d_parallel.c b/exercise3/wave_1d_parallel.c index ef9847c..fc2ac7c 100644 --- a/exercise3/wave_1d_parallel.c +++ b/exercise3/wave_1d_parallel.c @@ -106,8 +106,12 @@ void time_step(void) { // Neumann (reflective) boundary condition. void boundary_condition(void) { // BEGIN: T6 - U(-1) = U(1); - U(N) = U(N - 2); + if (comm_rank == ROOT) { + U(-1) = U(1); + } + if (comm_rank == comm_size - 1) { + U(n) = U(n - 2); + } // END: T6 }