correct API leading to undesired int/double conversions, remove dead code

This commit is contained in:
Axel Kohlmeyer
2025-06-25 06:54:13 -04:00
parent af81f944d7
commit fdc3f50298
2 changed files with 5 additions and 10 deletions

View File

@ -203,25 +203,20 @@ double ComputePressureBocs::get_cg_p_corr(int N_basis, double *phi_coeff,
Find the relevant index position if using a spline basis set
------------------------------------------------------------------------- */
double ComputePressureBocs::find_index(double * grid, double value)
int ComputePressureBocs::find_index(double * grid, double value)
{
int i;
double spacing = fabs(grid[1]-grid[0]);
int gridsize = spline_length;
for (i = 0; i < (gridsize-1); ++i)
{
if (value >= grid[i] && value <= grid[i+1]) { return i; }
if (value >= grid[i] && value <= grid[i+1]) return i;
}
if (value >= grid[i] && value <= (grid[i] + spacing)) { return i; }
if (value >= grid[i] && value <= (grid[i] + spacing)) return i;
error->all(FLERR, Error::NOLASTLINE,
"find_index could not find value in grid for value: {}", value);
for (int i = 0; i < gridsize; ++i) {
fprintf(stderr, "grid %d: %f\n", i, grid[i]);
}
exit(1);
"find_index could not find index in grid for value: {}", value);
}
/* ----------------------------------------------------------------------

View File

@ -50,7 +50,7 @@ class ComputePressureBocs : public Compute {
void send_cg_info(int, int, double *, int, double);
void send_cg_info(int, double **, int);
double get_cg_p_corr(double **, int, double);
double find_index(double *, double);
int find_index(double *, double);
protected:
double boltz, nktv2p, inv_volume;