summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2018-08-07 16:19:58 +0200
committerAnton Khirnov <anton@khirnov.net>2018-08-07 16:19:58 +0200
commitd7fed70887996c69a77b91d368f4f68565d36bae (patch)
tree02724cd40cd0d4796dc05b3df06a0312ff89e054
parenta024abad458af1ba6eb9135ca982d3fe762ea855 (diff)
mg2d: actually initialize u to zero as documented
-rw-r--r--mg2d.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/mg2d.c b/mg2d.c
index 73157f5..7dacece 100644
--- a/mg2d.c
+++ b/mg2d.c
@@ -450,6 +450,9 @@ MG2DContext *mg2d_solver_alloc(size_t domain_size)
ctx->u = priv->root->solver->u;
ctx->u_stride = priv->root->solver->u_stride;
+ /* initialize the initial guess to zero */
+ memset(ctx->u, 0, sizeof(*ctx->u) * ctx->u_stride * ctx->domain_size);
+
ctx->rhs = priv->root->solver->rhs;
ctx->rhs_stride = priv->root->solver->rhs_stride;