From 1145d43ffef5568e04fb79a4f73ecd69f2f09ce2 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 5 May 2019 15:45:10 +0200 Subject: egs: allow the same context to be used for both relaxation and exact solves --- ell_grid_solve.h | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'ell_grid_solve.h') 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,14 +97,9 @@ 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. */ @@ -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 */ -- cgit v1.2.3