Skip to content

Commit

Permalink
Merge pull request #272 from ludwig-cf/patch-0.20.1
Browse files Browse the repository at this point in the history
Bug fix: add missing petsc stub
  • Loading branch information
kevinstratford authored Jul 25, 2023
2 parents 8e5c967 + 84e300b commit c21dba0
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 12 additions & 0 deletions src/psi_petsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
82 changes: 82 additions & 0 deletions tests/unit/test_psi_solver_petsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +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);

/*****************************************************************************
*
Expand All @@ -34,6 +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);
Expand Down Expand Up @@ -65,3 +71,79 @@ 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
*
*****************************************************************************/

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;
}

/*****************************************************************************
*
* 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;
}
2 changes: 1 addition & 1 deletion version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit c21dba0

Please sign in to comment.