commit a0c67190c1973f88f9a55cbe304963c2e8153e9b
parent 4fd6838ffd6074a4ac86493bf492747fe0c1751e
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Fri, 13 Feb 2026 12:26:27 +0100
Remove obsolete code when lines were truncated
This code, based on old assumptions, could now produce errors.
Diffstat:
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/src/sln_line.c b/src/sln_line.c
@@ -284,7 +284,6 @@ snap_mesh_to_upper_bound
{
double* ha = NULL;
size_t ivertex, nvertices;
- size_t ivertex_1st;
ASSERT(wavenumbers && values);
ASSERT(darray_double_size_get(wavenumbers) == darray_double_size_get(values));
(void)wavenumbers;
@@ -292,25 +291,18 @@ snap_mesh_to_upper_bound
ha = darray_double_data_get(values);
nvertices = darray_double_size_get(wavenumbers);
- /* Search for the first (non clipped) vertex */
- FOR_EACH(ivertex_1st, 0, nvertices) {
- if(ha[ivertex_1st] > 0) break;
- }
- ASSERT(ivertex_1st < nvertices);
-
/* Ensure that the stored vertex value is an exclusive upper bound of the
* original value. We do this by storing a value in single precision that is
* strictly greater than its encoding in double precision */
- if(ha[ivertex_1st] != (float)ha[ivertex_1st]) {
- ha[ivertex_1st] = nextafterf((float)ha[ivertex_1st], FLT_MAX);
+ if(ha[0] != (float)ha[0]) {
+ ha[0] = nextafterf((float)ha[0], FLT_MAX);
}
/* We have meshed the upper half of the line which is a strictly decreasing
* function. To ensure that the mesh is an upper limit of this function,
* simply align the value of each vertex with the value of the preceding
* vertex */
- FOR_EACH_REVERSE(ivertex, nvertices-1, ivertex_1st) {
- if(ha[ivertex] < 0) continue; /* The vertex is clipped */
+ FOR_EACH_REVERSE(ivertex, nvertices-1, 0) {
ha[ivertex] = ha[ivertex-1];
}
}