From f1d308e6c7a394256d8ede2979c80d57e3868efa Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 8 Feb 2019 08:48:28 +0100 Subject: Rename fixdiff boundary condition to reflect. This is what it actually does, we do not support setting arbitrary derivative values. API bump. --- ell_grid_solve.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'ell_grid_solve.c') diff --git a/ell_grid_solve.c b/ell_grid_solve.c index 0cefdfd..f992186 100644 --- a/ell_grid_solve.c +++ b/ell_grid_solve.c @@ -128,7 +128,7 @@ static void boundaries_apply_fixval(double *dst, const ptrdiff_t dst_stride[2], } } -static void boundaries_apply_fixdiff(double *dst, const ptrdiff_t dst_stride[2], +static void boundaries_apply_reflect(double *dst, const ptrdiff_t dst_stride[2], const double *src, ptrdiff_t src_stride, size_t boundary_size) { @@ -162,8 +162,8 @@ static void boundaries_apply(EGSContext *ctx) boundaries_apply_fixval(dst, dst_strides, ctx->boundaries[i]->val, ctx->boundaries[i]->val_stride, size_boundary); break; - case MG2D_BC_TYPE_FIXDIFF: - boundaries_apply_fixdiff(dst, dst_strides, ctx->boundaries[i]->val, + case MG2D_BC_TYPE_REFLECT: + boundaries_apply_reflect(dst, dst_strides, ctx->boundaries[i]->val, ctx->boundaries[i]->val_stride, size_boundary); break; } @@ -185,9 +185,9 @@ static void boundaries_apply(EGSContext *ctx) + mg2d_bnd_is_upper(loc_y) * ((ctx->domain_size[1] - 1) * priv->stride) + mg2d_bnd_is_upper(loc_x) * (ctx->domain_size[0] - 1); - if (bnd_y->type == MG2D_BC_TYPE_FIXDIFF) + if (bnd_y->type == MG2D_BC_TYPE_REFLECT) fact_y *= -1; - else if (bnd_x->type == MG2D_BC_TYPE_FIXDIFF) + else if (bnd_x->type == MG2D_BC_TYPE_REFLECT) fact_x *= -1; else continue; @@ -380,7 +380,7 @@ static int solve_exact(EGSContext *ctx) if (!bnd_fixval) { /* apply the boundary conditions to eliminate the ghostpoint values */ - // fixdiff + // reflect for (int bnd_loc = 0; bnd_loc < ARRAY_ELEMS(ctx->boundaries); bnd_loc++) { MG2DBoundary *bnd = ctx->boundaries[bnd_loc]; @@ -393,7 +393,7 @@ static int solve_exact(EGSContext *ctx) double *dst = mat_row + mg2d_bnd_is_upper(bnd_loc) * ((bnd_len[1] - 1) * bnd_stride[1]); - if (!is_bnd[bnd_loc] || bnd->type != MG2D_BC_TYPE_FIXDIFF) + if (!is_bnd[bnd_loc] || bnd->type != MG2D_BC_TYPE_REFLECT) continue; for (ptrdiff_t bnd_layer = 1; bnd_layer <= ctx->fd_stencil; bnd_layer++) @@ -545,13 +545,7 @@ int mg2di_egs_init(EGSContext *ctx) for (int i = 0; i < ARRAY_ELEMS(ctx->boundaries); i++) { MG2DBoundary *bnd = ctx->boundaries[i]; const int ci = mg2d_bnd_coord_idx(i); - if (bnd->type == MG2D_BC_TYPE_FIXDIFF) { - for (int k = 0; k < ctx->domain_size[!ci]; k++) - if (bnd->val[k] != 0.0) { - mg2di_log(&ctx->logger, 0, "Only zero boundary derivative supported\n"); - return -ENOSYS; - } - } else if (bnd->type == MG2D_BC_TYPE_FIXVAL) { + if (bnd->type == MG2D_BC_TYPE_FIXVAL) { priv->residual_calc_size[ci]--; } } -- cgit v1.2.3