From fd9d827c826f988035be60468e0cec225b106300 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 15 Jun 2019 16:52:07 +0200 Subject: egs: skip boundary corners for inter-component boundaries --- ell_grid_solve.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ell_grid_solve.c b/ell_grid_solve.c index 57f6340..721dc11 100644 --- a/ell_grid_solve.c +++ b/ell_grid_solve.c @@ -296,6 +296,9 @@ static void boundaries_apply(EGSContext *ctx, NDArray *a_dst, int init) MG2DBoundary *bnd_y = ctx->boundaries[loc_y]; const int dir_y = mg2d_bnd_out_dir(loc_y); + if (!priv->dg->components[priv->local_component].bnd_is_outer[loc_y]) + continue; + for (int pos_x = 0; pos_x < 2; pos_x++) { enum MG2DBoundaryLoc loc_x = mg2d_bnd_id(0, pos_x); MG2DBoundary *bnd_x = ctx->boundaries[loc_x]; @@ -306,6 +309,9 @@ static void boundaries_apply(EGSContext *ctx, NDArray *a_dst, int init) + mg2d_bnd_is_upper(loc_y) * ((ctx->domain_size[1] - 1) * a_dst->stride[0]) + mg2d_bnd_is_upper(loc_x) * (ctx->domain_size[0] - 1); + if (!priv->dg->components[priv->local_component].bnd_is_outer[loc_x]) + continue; + if (bnd_y->type == MG2D_BC_TYPE_REFLECT) fact_y *= -1; else if (bnd_x->type == MG2D_BC_TYPE_REFLECT) @@ -313,6 +319,10 @@ static void boundaries_apply(EGSContext *ctx, NDArray *a_dst, int init) else continue; + dst = a_dst->data + + mg2d_bnd_is_upper(loc_y) * ((ctx->domain_size[1] - 1) * a_dst->stride[0]) + + mg2d_bnd_is_upper(loc_x) * (ctx->domain_size[0] - 1); + for (int j = 1; j <= FD_STENCIL_MAX; j++) for (int i = 1; i <= FD_STENCIL_MAX; i++) { const ptrdiff_t idx_dst = dir_y * j * strides[1] + dir_x * i; -- cgit v1.2.3