diff options
author | Anton Khirnov <anton@khirnov.net> | 2016-08-28 10:07:20 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2016-08-28 10:22:49 +0200 |
commit | 63b25eca76d8481a0fdad339464d1eb617826583 (patch) | |
tree | cb2e4e7d94aa38cfe096c118938f5b92cf462a5c /init.c | |
parent | 95867280ab72ce6ade22f2cf7fcbc5b47b6cc95d (diff) |
qfunc: disentangle the API from the global solver API
Diffstat (limited to 'init.c')
-rw-r--r-- | init.c | 24 |
1 files changed, 8 insertions, 16 deletions
@@ -23,27 +23,17 @@ #include "brill_data.h" #include "internal.h" +#include "qfunc.h" static int brill_init_check_options(BDContext *bd) { BDPriv *s = bd->priv; + int ret; - switch (bd->q_func_type) { - case BD_Q_FUNC_GUNDLACH: - s->q_func = &bdi_q_func_gundlach; - break; - case BD_Q_FUNC_EPPLEY: - if (bd->eppley_n < 4) { - bdi_log(bd, 0, "Invalid n: %d < 4\n", bd->eppley_n); - return -EINVAL; - } - - s->q_func = &bdi_q_func_eppley; - break; - default: - bdi_log(bd, 0, "Unknown q function type: %d\n", bd->q_func_type); - return -EINVAL; - } + ret = bdi_qfunc_init(bd, &s->qfunc, bd->q_func_type, + bd->amplitude, bd->eppley_n); + if (!s->qfunc) + return ret; s->basis[0] = &bdi_sb_even_basis; s->basis[1] = &bdi_sb_even_basis; @@ -118,6 +108,8 @@ void bd_context_free(BDContext **pbd) s = bd->priv; + bdi_qfunc_free(&s->qfunc); + free(s->coeffs); free(bd->priv); |