From ec98a31009481c648114750571e1d4d8f2e08362 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?FEL=C5=A0=C3=96CI=20Marek?= <marek.felsoci@inria.fr> Date: Sun, 5 Nov 2023 19:16:06 +0100 Subject: [PATCH] Simplify HMAT interface --- include/util.h | 1 - src/help.c | 10 +--------- src/hmat.c | 2 +- src/main.c | 11 ----------- src/util.c | 30 +++--------------------------- 5 files changed, 5 insertions(+), 49 deletions(-) diff --git a/include/util.h b/include/util.h index 8b4742b..c558f55 100644 --- a/include/util.h +++ b/include/util.h @@ -53,7 +53,6 @@ struct mpf_hmat_create_compression_args_t { const void * output; }; int hmat_get_sync_exec(void) ; -void mpf_hmat_compression(struct mpf_hmat_create_compression_args_t *); #if !(defined (_WIN32)) /* It's a UNIX system, I know this ! */ /* Try to detect a debugger. This relies on the fact that GDB and IDB diff --git a/src/help.c b/src/help.c index 3f54764..7da458c 100644 --- a/src/help.c +++ b/src/help.c @@ -7,15 +7,7 @@ int printHelp() { printf("\ntest_FEMBEM usage:\n-----------------\n\n" " -nbpts: Number of unknowns of the global linear system. Default: 16000 (can be in floating point notation, like 1.2e4).\n" - " -nbrhs: Number of right-hand sides of the global linear system. Default: 1.\n" - "\n" - " BEM tests use a surfacic cylinder with an optionnal cylinder detail, defined with:\n" - " -radius: Radius of the cylinder. Default is 2.\n" - " -height: Height of the cylinder. Default is 4.\n" - "\n" - " Options for HMAT tests\n" - " --hmat-eps-assemb: Compression epsilon. Default: 1e-4.\n" - " --hmat-eps-recompr: Recompression epsilon. Default: 1e-4.\n" + " -epsilon: Compression epsilon. Default: 1e-3.\n" "\n" " -h/--help: Display this help\n\n"); diff --git a/src/hmat.c b/src/hmat.c index fc63912..05016cd 100644 --- a/src/hmat.c +++ b/src/hmat.c @@ -272,7 +272,7 @@ HMAT_desc_t *HMAT_generate_matrix( hmat_interface_t *hi ) { struct mpf_hmat_create_compression_args_t compression_ctx; compression_ctx.method = mpf_hmat_settings.compressionMethod; compression_ctx.threshold = mpf_hmat_settings.acaEpsilon; - mpf_hmat_compression(&compression_ctx); + compression_ctx.output = hmat_create_compression_aca_plus(compression_ctx.threshold); hmat_assemble_context_t ctx; hmat_assemble_context_init(&ctx); diff --git a/src/main.c b/src/main.c index 836b3fd..452ce14 100644 --- a/src/main.c +++ b/src/main.c @@ -24,12 +24,6 @@ int main(int argc, char **argv) { int ierr ; double step, max_error = DBL_MAX; - MpfArgGetDouble(&argc, argv, 1, "--max-error", &max_error); - if (MpfArgHasName(&argc, argv, 1, "-h") || MpfArgHasName(&argc, argv, 1, "--help") ) { - ierr=printHelp() ; - return ierr; - } - /* ------------------------------------------------------------------------- */ /* ---------------------- INITIATION DE MPF (PARALLELE) -------------------*/ /* ------------------------------------------------------------------------- */ @@ -50,11 +44,6 @@ int main(int argc, char **argv) { ierr=initCylinder(&argc, &argv) ; CHKERRQ(ierr) ; - - if (MpfArgGetInt(&argc, argv, 1, "-nbrhs", &nbRHS)) { - printf("Reading nbRHS = %d\n", nbRHS) ; - } - /* Wavelength */ ierr = getMeshStep(&step) ; lambda = 10.*step ; diff --git a/src/util.c b/src/util.c index ce1dec4..12d5248 100644 --- a/src/util.c +++ b/src/util.c @@ -471,28 +471,6 @@ static void update_progress(hmat_progress_t * ctx) { Mpf_progressBar(ctx->current, ctx->max); } /* ================================================================================== */ -void mpf_hmat_compression(struct mpf_hmat_create_compression_args_t *args) { - // Compression algorithm - switch (args->method) { - case hmat_compress_svd: - args->output = hmat_create_compression_svd(args->threshold); - break; - case hmat_compress_aca_full: - args->output = hmat_create_compression_aca_full(args->threshold); - break; - case hmat_compress_aca_partial: - args->output = hmat_create_compression_aca_partial(args->threshold); - break; - case hmat_compress_aca_plus: - args->output = hmat_create_compression_aca_plus(args->threshold); - break; - case hmat_compress_aca_random: - args->output = hmat_create_compression_aca_random(args->threshold); - break; - default: SETWARN(1, "unknown compression method"); - } -} -/* ================================================================================== */ int SCAB_Init(int* argc, char*** argv) { int ierr; @@ -513,11 +491,9 @@ int SCAB_Init(int* argc, char*** argv) { hmat_get_build_date(&d, &t); printf("*** Built on %s at %s\n***\n", d, t); - if (MpfArgGetDouble( argc, *argv, 1, "--hmat-eps-assemb" , &mpf_hmat_settings.acaEpsilon )) { - printf("[HMat] Compression epsilon: %e\n", mpf_hmat_settings.acaEpsilon ); - } - if (MpfArgGetDouble( argc, *argv, 1, "--hmat-eps-recompr" , &mpf_hmat_settings.epsilon )) { - printf("[HMat] Recompression epsilon: %e\n", mpf_hmat_settings.epsilon ); + if (MpfArgGetDouble( argc, *argv, 1, "-epsilon" , &mpf_hmat_settings.epsilon )) { + mpf_hmat_settings.acaEpsilon = mpf_hmat_settings.epsilon; + printf("[HMat] Compression/Recompression epsilon: %e\n", mpf_hmat_settings.epsilon ); } mpf_hmat_settings.progress.update = update_progress; -- GitLab