commit 1800a57ce8b0790158753f68e2a8cc55eba0ca29
parent 8dc7029926793ebfd5dc522012159f9b7e96f0b5
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Mon, 16 Oct 2023 16:39:47 +0200
Fix of a bug when calculating the octree definition
We calculate the definition of the majoring field of radiative
coefficients by first ensuring that the voxels are cubic. Then we round
the calculated definition along each axis to the nearest power of two.
For systems where the dimension along one axis is very large in relation
to at least one other axis, we obtain pre-fitting definitions of less
than 1 which, when rounded to the nearest power of 2, become 1. However,
the round_pow2 function we used didn't handle values less than 1
properly and returned 0 instead. This commit corrects this bug..
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/rnatm_octree.c b/src/rnatm_octree.c
@@ -280,7 +280,7 @@ static FINLINE unsigned
round_pow2(const unsigned val)
{
const unsigned next_pow2 = (unsigned)round_up_pow2(val);
- if(next_pow2 - val <= next_pow2/4) {
+ if(val == 0 || next_pow2 - val <= next_pow2/4) {
return next_pow2;
} else {
return next_pow2/2;