From 83f28c387e0b96aa14a29a8274406e139658dd16 Mon Sep 17 00:00:00 2001 From: StephenCzarnecki Date: Sat, 11 Jan 2025 13:15:10 -0500 Subject: [PATCH] #28 more logging changes --- src/create_wce_objects.cpp | 52 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/src/create_wce_objects.cpp b/src/create_wce_objects.cpp index f355ccc6..15e0d984 100644 --- a/src/create_wce_objects.cpp +++ b/src/create_wce_objects.cpp @@ -106,28 +106,51 @@ namespace wincalc double product_data_min_wavelength, FenestrationCommon::CSeries const & source_spectrum) { + logMsg( + "begin get_minimum_wavelength for method " + method.name + + " with product_data_min_wavelength = " + std::to_string(product_data_min_wavelength)); double result = std::numeric_limits::quiet_NaN(); if(method.min_wavelength.type == window_standards::Wavelength_Boundary_Type::WAVELENGTH_SET) { + logMsg("in if(method.min_wavelength.type == " + "window_standards::Wavelength_Boundary_Type::WAVELENGTH_SET)"); if(method.wavelength_set.type == window_standards::Wavelength_Set_Type::FILE) { + logMsg( + "in if(method.wavelength_set.type == " + "window_standards::Wavelength_Set_Type::FILE) with " + "method.wavelength_set.values.size = " + std::to_string(method.wavelength_set.values.size())); result = method.wavelength_set.values[0]; } else if(method.wavelength_set.type == window_standards::Wavelength_Set_Type::SOURCE) { + logMsg("in else if(method.wavelength_set.type == " + "window_standards::Wavelength_Set_Type::SOURCE) with " + "source_spectrum.getXArray().size() = " + + std::to_string(source_spectrum.getXArray().size())); result = source_spectrum.getXArray().front(); } if(method.wavelength_set.type == window_standards::Wavelength_Set_Type::DATA) { + logMsg("method.wavelength_set.type == window_standards::Wavelength_Set_Type::DATA"); result = product_data_min_wavelength; } } else if(method.min_wavelength.type == window_standards::Wavelength_Boundary_Type::NUMBER) { + logMsg("in else if(method.min_wavelength.type == " + "window_standards::Wavelength_Boundary_Type::NUMBER) with " + "method.min_wavelength.value = " + + std::to_string(method.min_wavelength.value)); result = method.min_wavelength.value; } + logMsg("end get_minimum_wavelength for method " + method.name + + " with product_data_min_wavelength = " + + std::to_string(product_data_min_wavelength) + + " result = " + std::to_string(result)); + return result; } @@ -136,28 +159,51 @@ namespace wincalc double product_data_max_wavelength, FenestrationCommon::CSeries const & source_spectrum) { + logMsg("begin get_maximum_wavelength for method " + method.name + + " with product_data_max_wavelength = " + + std::to_string(product_data_max_wavelength)); + double result = std::numeric_limits::quiet_NaN(); if(method.max_wavelength.type == window_standards::Wavelength_Boundary_Type::WAVELENGTH_SET) { + logMsg("in if(method.max_wavelength.type == window_standards::Wavelength_Boundary_Type::WAVELENGTH_SET)"); if(method.wavelength_set.type == window_standards::Wavelength_Set_Type::FILE) { + logMsg("in if(method.wavelength_set.type == " + "window_standards::Wavelength_Set_Type::FILE) with " + "method.wavelength_set.values.size = " + + std::to_string(method.wavelength_set.values.size())); + result = method.wavelength_set.values.back(); } else if(method.wavelength_set.type == window_standards::Wavelength_Set_Type::SOURCE) { + logMsg("in else if(method.wavelength_set.type == " + "window_standards::Wavelength_Set_Type::SOURCE) with " + "source_spectrum.getXArray().size() = " + + std::to_string(source_spectrum.getXArray().size())); result = source_spectrum.getXArray().back(); } if(method.wavelength_set.type == window_standards::Wavelength_Set_Type::DATA) { + logMsg("method.wavelength_set.type == window_standards::Wavelength_Set_Type::DATA"); result = product_data_max_wavelength; } } else if(method.max_wavelength.type == window_standards::Wavelength_Boundary_Type::NUMBER) { + logMsg("in else if(method.max_wavelength.type == " + "window_standards::Wavelength_Boundary_Type::NUMBER) with " + "method.max_wavelength.value = " + + std::to_string(method.max_wavelength.value)); result = method.max_wavelength.value; } + logMsg("end get_maximum_wavelength for method " + method.name + + " with product_data_max_wavelength = " + + std::to_string(product_data_max_wavelength) + + " result = " + std::to_string(result)); return result; } @@ -389,21 +435,27 @@ namespace wincalc Lambda_Range get_lambda_range(std::vector> const & products_wavelengths, window_standards::Optical_Standard_Method const & method) { + logMsg("begin get_lambda_range"); auto source_spectrum = get_spectum_values(method.source_spectrum, method, products_wavelengths); std::vector min_wavelengths; std::vector max_wavelengths; for(auto product_wavelengths : products_wavelengths) { + logMsg("in for(auto product_wavelengths : products_wavelengths)"); min_wavelengths.push_back( get_minimum_wavelength(method, product_wavelengths[0], source_spectrum)); + logMsg("before max_wavelengths.push_back"); max_wavelengths.push_back( get_maximum_wavelength(method, product_wavelengths.back(), source_spectrum)); } // The min and max lambda should be the tighest boundary not the loosest // So it should be the largest minimum and smallest maximum + logMsg("before min_wavelength = with min_wavelengths.size = " + std::to_string(min_wavelengths.size())); double min_wavelength = *std::max_element(min_wavelengths.begin(), min_wavelengths.end()); + logMsg("before max_wavelength = with max_wavelengths.size = " + std::to_string(max_wavelengths.size())); double max_wavelength = *std::min_element(max_wavelengths.begin(), max_wavelengths.end()); + logMsg("end get_lambda_range"); return Lambda_Range{min_wavelength, max_wavelength}; }