From 4cfef3f94f5327282b584e70d138f87ef30e647c Mon Sep 17 00:00:00 2001 From: Kevin Stratford Date: Mon, 24 Jul 2023 20:18:53 +0100 Subject: [PATCH 1/3] Bug fix: add missing petsc stub --- CHANGES.md | 4 ++++ src/psi_petsc.c | 12 ++++++++++++ version.h | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index c4db7f54..81a490a5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,10 @@ ### Changes +version 0.20.1 +- Issue 271: missing stub prevents compilation at some compiler optimisation + levels. + version 0.20.0 - IMPORTANT: The input file can no longer be specified as a command diff --git a/src/psi_petsc.c b/src/psi_petsc.c index 885950b8..bc2c4dcf 100644 --- a/src/psi_petsc.c +++ b/src/psi_petsc.c @@ -172,6 +172,18 @@ int psi_solver_petsc_solve(psi_solver_petsc_t * solver, int ntimestep) { return -1; } +/***************************************************************************** + * + * psi_solver_petsc_var_epsilon_solve + * + *****************************************************************************/ + +int psi_solver_petsc_var_epsilon_solve(psi_solver_petsc_t * solver, int nt) { + + /* No implementation */ + return -1; +} + #else #include "petscdmda.h" diff --git a/version.h b/version.h index a78d17de..7ea8e669 100644 --- a/version.h +++ b/version.h @@ -14,6 +14,6 @@ #define LUDWIG_MAJOR_VERSION 0 #define LUDWIG_MINOR_VERSION 20 -#define LUDWIG_PATCH_VERSION 0 +#define LUDWIG_PATCH_VERSION 1 #endif From f129629278f55205f15f69c41b2a279eb08ccaf3 Mon Sep 17 00:00:00 2001 From: Kevin Stratford Date: Mon, 24 Jul 2023 20:42:38 +0100 Subject: [PATCH 2/3] Add var epsilon stub test --- tests/unit/test_psi_solver_petsc.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/unit/test_psi_solver_petsc.c b/tests/unit/test_psi_solver_petsc.c index 6d87e320..59b0548e 100644 --- a/tests/unit/test_psi_solver_petsc.c +++ b/tests/unit/test_psi_solver_petsc.c @@ -20,6 +20,7 @@ #include "psi_petsc.h" int test_psi_solver_petsc_create(pe_t * pe); +int test_psi_solver_petsc_var_epsilon_create(pe_t * pe); /***************************************************************************** * @@ -34,6 +35,7 @@ int test_psi_solver_petsc_suite(void) { pe_create(MPI_COMM_WORLD, PE_QUIET, &pe); test_psi_solver_petsc_create(pe); + test_psi_solver_petsc_var_epsilon_create(pe); pe_info(pe, "%-9s %s\n", "PASS", __FILE__); pe_free(pe); @@ -65,3 +67,29 @@ int test_psi_solver_petsc_create(pe_t * pe) { return 0; } + +/***************************************************************************** + * + * test_psi_solver_petsc_var_epsilon_create + * + *****************************************************************************/ + +int test_psi_solver_petsc_var_epsilon_create(pe_t * pe) { + + int ifail = 0; + int isInitialised = 0; + + PetscInitialised(&isInitialised); + + if (isInitialised == 0) { + psi_t * psi = NULL; + var_epsilon_t user = {0}; + psi_solver_petsc_t * petsc = NULL; + + ifail = psi_solver_petsc_var_epsilon_create(psi, user, &petsc); + assert(ifail != 0); + if (ifail != 0) ifail = 0; + } + + return 0; +} From 84e300bc807a697d0ee2ad49ace0e15a6d2d5332 Mon Sep 17 00:00:00 2001 From: Kevin Stratford Date: Mon, 24 Jul 2023 20:58:46 +0100 Subject: [PATCH 3/3] Add solve stub tests --- tests/unit/test_psi_solver_petsc.c | 54 ++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/tests/unit/test_psi_solver_petsc.c b/tests/unit/test_psi_solver_petsc.c index 59b0548e..19e392a1 100644 --- a/tests/unit/test_psi_solver_petsc.c +++ b/tests/unit/test_psi_solver_petsc.c @@ -20,7 +20,9 @@ #include "psi_petsc.h" int test_psi_solver_petsc_create(pe_t * pe); +int test_psi_solver_petsc_solve(pe_t * pe); int test_psi_solver_petsc_var_epsilon_create(pe_t * pe); +int test_psi_solver_petsc_var_epsilon_solve(pe_t * pe); /***************************************************************************** * @@ -35,7 +37,9 @@ int test_psi_solver_petsc_suite(void) { pe_create(MPI_COMM_WORLD, PE_QUIET, &pe); test_psi_solver_petsc_create(pe); + test_psi_solver_petsc_solve(pe); test_psi_solver_petsc_var_epsilon_create(pe); + test_psi_solver_petsc_var_epsilon_solve(pe); pe_info(pe, "%-9s %s\n", "PASS", __FILE__); pe_free(pe); @@ -68,6 +72,31 @@ int test_psi_solver_petsc_create(pe_t * pe) { return 0; } +/***************************************************************************** + * + * test_psi_solver_petsc_solve + * + *****************************************************************************/ + +int test_psi_solver_petsc_solve(pe_t * pe) { + + int ifail = 0; + int isInitialised = 0; + + PetscInitialised(&isInitialised); + + if (isInitialised == 0) { + psi_solver_petsc_t * petsc = NULL; + int nt = 0; + + ifail = psi_solver_petsc_solve(petsc, nt); + assert(ifail != 0); + if (ifail != 0) ifail = 0; + } + + return 0; +} + /***************************************************************************** * * test_psi_solver_petsc_var_epsilon_create @@ -93,3 +122,28 @@ int test_psi_solver_petsc_var_epsilon_create(pe_t * pe) { return 0; } + +/***************************************************************************** + * + * test_psi_solver_petsc_var_epsilon_solve + * + *****************************************************************************/ + +int test_psi_solver_petsc_var_epsilon_solve(pe_t * pe) { + + int ifail = 0; + int isInitialised = 0; + + PetscInitialised(&isInitialised); + + if (isInitialised == 0) { + psi_solver_petsc_t * petsc = NULL; + int nt = 0; + + ifail = psi_solver_petsc_var_epsilon_solve(petsc, nt); + assert(ifail != 0); + if (ifail != 0) ifail = 0; + } + + return 0; +}