diff options
author | Anton Khirnov <anton@khirnov.net> | 2019-05-05 15:45:10 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2019-05-06 18:23:59 +0200 |
commit | 1145d43ffef5568e04fb79a4f73ecd69f2f09ce2 (patch) | |
tree | c4c32f122e55497848b2d6fe0adc013fb1fc88af /ell_grid_solve.h | |
parent | e91409830cbb4c06c4035d7084aa20b0d4d259bc (diff) |
egs: allow the same context to be used for both relaxation and exact solves
Diffstat (limited to 'ell_grid_solve.h')
-rw-r--r-- | ell_grid_solve.h | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/ell_grid_solve.h b/ell_grid_solve.h index 6e59bf0..601eac9 100644 --- a/ell_grid_solve.h +++ b/ell_grid_solve.h @@ -53,14 +53,14 @@ enum EGSType { * solver_data is EGSRelaxContext * mg2di_egs_solve() does a single relaxation step */ - EGS_SOLVER_RELAXATION, + EGS_SOLVE_RELAXATION, /** * Solve the equation exactly by contructing a linear system and solving it with LAPACK. * * solver_data is EGSExactContext * mg2di_egs_solve() solves the discretized system exactly (up to roundoff error) */ - EGS_SOLVER_EXACT, + EGS_SOLVE_EXACT, }; typedef struct EGSInternal EGSInternal; @@ -97,15 +97,10 @@ typedef struct EGSExactContext { } EGSExactContext; typedef struct EGSContext { - enum EGSType solver_type; + EGSRelaxContext *relax; + EGSExactContext *exact; /** - * Solver type-specific data. - * - * Should be cast into the struct specified in documentation for this type. - */ - void *solver_data; - /** * Solver private data, not to be accessed in any way by the caller. */ EGSInternal *priv; @@ -210,7 +205,7 @@ typedef struct EGSContext { * * @return The solver context on success, NULL on failure. */ -EGSContext *mg2di_egs_alloc(enum EGSType solver_type, size_t domain_size[2]); +EGSContext *mg2di_egs_alloc(size_t domain_size[2]); /** * Initialize the solver for use, after all the required fields are filled by * the caller. @@ -233,6 +228,6 @@ void mg2di_egs_free(EGSContext **ctx); * * @return 0 on success, a negative error code on failure. */ -int mg2di_egs_solve(EGSContext *ctx, int export_res); +int mg2di_egs_solve(EGSContext *ctx, enum EGSType solve_type, int export_res); #endif /* MG2D_ELL_GRID_SOLVE_H */ |