star-line

Structure for accelerating line importance sampling
git clone git://git.meso-star.fr/star-line.git
Log | Files | Refs | README | LICENSE

commit a2918ffb1d32032dd3f70777ae9637d0460f913b
parent 7de1389b55eab73ff961f4c021aef3de35c1b5af
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Tue, 31 May 2022 16:54:32 +0200

Fix assertions

Diffstat:
Msrc/sln_polyline.c | 2+-
Msrc/sln_tree.c | 6+++---
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/sln_polyline.c b/src/sln_polyline.c @@ -126,7 +126,7 @@ check_polyline_vertices size_t i; ASSERT(vertices); FOR_EACH(i, vertices_range[0]+1, vertices_range[1]+1) { - CHK(vertices[i].wavenumber > vertices[i-1].wavenumber); + CHK(vertices[i].wavenumber >= vertices[i-1].wavenumber); } #endif } diff --git a/src/sln_tree.c b/src/sln_tree.c @@ -368,13 +368,13 @@ sln_mesh_eval(const struct sln_mesh* mesh, const double wavenumber) if(nu <= mesh->vertices[0].wavenumber) return mesh->vertices[0].ka; if(nu >= mesh->vertices[n-1].wavenumber) return mesh->vertices[n-1].ka; - /* Dichotomic search of the mesh vertex whose wavenumber is greater than the - * submitted wavenumber 'nu' */ + /* Dichotomic search of the mesh vertex whose wavenumber is greater than or + * equal to the submitted wavenumber 'nu' */ vtx1 = search_lower_bound(&nu, mesh->vertices, n, sizeof(*vtx1), cmp_nu_vtx); vtx0 = vtx1 - 1; ASSERT(vtx1); /* A vertex is necessary found ...*/ ASSERT(vtx1 > mesh->vertices); /* ... and it cannot be the first one */ - ASSERT(vtx0->wavenumber <= nu && nu < vtx1->wavenumber); + ASSERT(vtx0->wavenumber < nu && nu <= vtx1->wavenumber); /* Compute the linear interpolation parameter */ u = (nu - vtx0->wavenumber) / (vtx1->wavenumber - vtx0->wavenumber);