aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2019-06-15 16:52:07 +0200
committerAnton Khirnov <anton@khirnov.net>2019-06-18 12:01:22 +0200
commitfd9d827c826f988035be60468e0cec225b106300 (patch)
tree3d4d7c82ba1e1a387cff4ac1b95181d3a50d677b
parent3d02e1b61d6aa3e2c4c9be4e0f55dd7d2046dabb (diff)
egs: skip boundary corners for inter-component boundaries
-rw-r--r--ell_grid_solve.c10
1 files changed, 10 insertions, 0 deletions
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;