From 54dceefe1c0eb6ab7f84ebeeed4badab5b9265db Mon Sep 17 00:00:00 2001 From: Peter Erwin Date: Thu, 25 Jul 2024 12:17:01 +0200 Subject: [PATCH] Tweak to FlatBar::GetValue (func_flatbar) to avoid possible uninitialized variable --- function_objects/func_flatbar.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/function_objects/func_flatbar.cpp b/function_objects/func_flatbar.cpp index 29eb603..1166cb4 100644 --- a/function_objects/func_flatbar.cpp +++ b/function_objects/func_flatbar.cpp @@ -201,13 +201,22 @@ double FlatBar::GetValue( double x, double y ) } totalIntensity = theSum / (nSubsamples*nSubsamples); } +// else { +// double deltaPA = fabs(atan(yp/xp)); +// if (deltaPA > deltaPA_max_rad) +// //totalIntensity = I_0 * exp(-r/h1); +// h2_current = h1; +// else { +// std::tie(r_b_current, h2_current) = GetAdjustedRbh2(xp, yp, r, r_circ); +// } +// totalIntensity = CalculateIntensity(r, h2_current, r_b_current); +// } else { + std::tie(r_b_current, h2_current) = GetAdjustedRbh2(xp, yp, r, r_circ); double deltaPA = fabs(atan(yp/xp)); - if (deltaPA > deltaPA_max_rad) + if (deltaPA > deltaPA_max_rad) { //totalIntensity = I_0 * exp(-r/h1); h2_current = h1; - else { - std::tie(r_b_current, h2_current) = GetAdjustedRbh2(xp, yp, r, r_circ); } totalIntensity = CalculateIntensity(r, h2_current, r_b_current); }