aboutsummaryrefslogtreecommitdiff
path: root/ell_grid_solve.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2019-02-08 08:48:28 +0100
committerAnton Khirnov <anton@khirnov.net>2019-02-08 08:49:44 +0100
commitf1d308e6c7a394256d8ede2979c80d57e3868efa (patch)
tree27560a6c431ddc3c03e81ddc1cac92d3b4e18846 /ell_grid_solve.c
parent1e3d13b0f885479fca1e02bf4fdbdba219dc0578 (diff)
Rename fixdiff boundary condition to reflect.
This is what it actually does, we do not support setting arbitrary derivative values. API bump.
Diffstat (limited to 'ell_grid_solve.c')
-rw-r--r--ell_grid_solve.c22
1 files changed, 8 insertions, 14 deletions
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]--;
}
}