From dacf661c962f2e2095479f688d3a23f32644548b Mon Sep 17 00:00:00 2001 From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de> Date: Thu, 23 Mar 2023 14:23:29 +0100 Subject: [PATCH 01/13] use native data for alignment check --- GUI/Model/Device/InstrumentItems.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/GUI/Model/Device/InstrumentItems.cpp b/GUI/Model/Device/InstrumentItems.cpp index c97eac70819..5cd3029c37f 100644 --- a/GUI/Model/Device/InstrumentItems.cpp +++ b/GUI/Model/Device/InstrumentItems.cpp @@ -401,16 +401,10 @@ bool SpecularInstrumentItem::alignedWith(const RealItem* item) const if (!item->hasNativeData()) return false; - // TODO do not compare native axis with main data axis due to different units - // remove native data from everywhere + // TODO remove native data from everywhere // https://jugit.fz-juelich.de/mlz/bornagain/-/issues/331 - // - // const auto& native_axis = item->nativeDatafield()->axis(0); - // return *instrumentAxis == native_axis; - // - // compare instrument axis with the main data axis instead - const auto& data_axis = item->dataItem()->datafield()->axis(0); - return *instrumentAxis == data_axis; + const auto& native_axis = item->nativeDatafield()->axis(0); + return *instrumentAxis == native_axis; } const ICoordSystem* SpecularInstrumentItem::createCoordSystem() const -- GitLab From b1ea9f2e668a7ee6af5e3c9b67d04a13e0058a53 Mon Sep 17 00:00:00 2001 From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de> Date: Thu, 23 Mar 2023 14:33:52 +0100 Subject: [PATCH 02/13] upd forms --- GUI/View/Instrument/AlphaScanEditor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GUI/View/Instrument/AlphaScanEditor.cpp b/GUI/View/Instrument/AlphaScanEditor.cpp index 761db415db2..77113b160fe 100644 --- a/GUI/View/Instrument/AlphaScanEditor.cpp +++ b/GUI/View/Instrument/AlphaScanEditor.cpp @@ -52,10 +52,10 @@ AlphaScanEditor::AlphaScanEditor(QWidget* parent, GrazingScanItem* item) gform->addRow(m_selector); //... update axis type combo (needs m_form) - if (idx != typeComboBox->currentIndex()) + if (idx != typeComboBox->currentIndex()) { typeComboBox->setCurrentIndex(idx); - else - onAxisTypeSelected(idx); // trigger update manually + onAxisTypeSelected(idx); + } typeComboBox->setEnabled(m_item->pointwiseAlphaAxisDefined()); connect(typeComboBox, qOverload<int>(&QComboBox::currentIndexChanged), this, &AlphaScanEditor::onAxisTypeSelected); -- GitLab From 9a5c89cc2fbc535f03fc0f2e2e8d8fc318b5e886 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Fri, 24 Mar 2023 14:36:28 +0100 Subject: [PATCH 03/13] rm '()' from fct names in error messages to facilitate grepping fct calls --- Base/Axis/CustomBinAxis.cpp | 2 +- Base/Axis/FixedBinAxis.cpp | 4 ++-- Base/Axis/VariableBinAxis.cpp | 10 +++++----- Device/Detector/IDetector.cpp | 4 ++-- Device/Detector/RectangularDetector.cpp | 4 ++-- Device/IO/DataFormatUtils.cpp | 2 +- Device/IO/ReadWriteNumpyTXT.cpp | 4 ++-- .../Resolution/ConvolutionDetectorResolution.cpp | 12 ++++++------ Device/Resolution/Convolve.cpp | 11 +++++------ Fit/Adapter/GeneticMinimizer.cpp | 2 +- Fit/Adapter/MinimizerAdapter.cpp | 4 ++-- Fit/Adapter/ResidualFunctionAdapter.cpp | 8 ++++---- Fit/Kernel/Minimizer.cpp | 2 +- Fit/Kernel/MinimizerFactory.cpp | 2 +- Fit/Kernel/PyCallback.cpp | 4 ++-- Fit/Minimizer/IMinimizer.cpp | 8 ++++---- Fit/Minimizer/MinimizerInfo.cpp | 2 +- Fit/Minimizer/MinimizerOptions.cpp | 4 ++-- Fit/Param/Parameters.cpp | 14 +++++++------- Fit/TestEngine/MinimizerTestPlan.cpp | 2 +- Fit/Tools/MinimizerUtils.cpp | 2 +- Fit/Tools/OptionContainer.cpp | 8 ++++---- Fit/Tools/OptionContainer.h | 4 ++-- GUI/Model/Data/ComboProperty.cpp | 2 +- GUI/Model/Data/DataItem.cpp | 2 +- GUI/Model/FromCore/ItemizeSimulation.cpp | 2 +- GUI/Model/Job/FitSuiteItem.cpp | 4 ++-- GUI/Model/Job/JobItem.cpp | 2 +- GUI/Model/Model/JobQueueData.cpp | 8 ++++---- GUI/Model/Project/ProjectDocument.cpp | 2 +- GUI/Support/Data/JobWorker.cpp | 5 ++--- GUI/View/Fit/FitSessionController.cpp | 2 +- GUI/View/Fit/FitSessionManager.cpp | 2 +- GUI/View/Fit/ParameterTuningWidget.cpp | 2 +- GUI/View/Project/ProjectManager.cpp | 4 ++-- GUI/View/Projection/SaveProjectionsAssistant.cpp | 2 +- GUI/View/Widget/DocksController.cpp | 2 +- Sample/HardParticle/Cone.cpp | 2 +- Sample/Interface/LayerInterface.cpp | 2 +- Sim/Fitting/FitObjective.cpp | 2 +- Sim/Fitting/FitPrintService.cpp | 2 +- Sim/Fitting/FitStatus.cpp | 2 +- Sim/Fitting/PyFittingCallbacks.cpp | 4 ++-- Tests/Unit/GUI/TestProjectUtils.cpp | 4 ++-- Tests/Unit/GUI/Utils.cpp | 2 +- Tests/Unit/GUI/Utils.h | 2 +- 46 files changed, 90 insertions(+), 92 deletions(-) diff --git a/Base/Axis/CustomBinAxis.cpp b/Base/Axis/CustomBinAxis.cpp index 3dc56d890eb..57c0d97aedd 100644 --- a/Base/Axis/CustomBinAxis.cpp +++ b/Base/Axis/CustomBinAxis.cpp @@ -50,7 +50,7 @@ CustomBinAxis* CustomBinAxis::clone() const Bin1D CustomBinAxis::bin(size_t index) const { if (index >= m_nbins) - throw std::runtime_error("CustomBinAxis::bin() -> called with invalid index >= m_nbins"); + throw std::runtime_error("CustomBinAxis::bin -> called with invalid index >= m_nbins"); Bin1D result(m_bin_centers[index], m_bin_centers[index]); return result; diff --git a/Base/Axis/FixedBinAxis.cpp b/Base/Axis/FixedBinAxis.cpp index a543f9d88de..2aa1fa5b8b8 100644 --- a/Base/Axis/FixedBinAxis.cpp +++ b/Base/Axis/FixedBinAxis.cpp @@ -44,7 +44,7 @@ double FixedBinAxis::operator[](size_t index) const Bin1D FixedBinAxis::bin(size_t index) const { if (index >= m_nbins) - throw std::runtime_error("FixedBinAxis::bin() -> Error. Wrong index."); + throw std::runtime_error("FixedBinAxis::bin -> Error. Wrong index."); double step = (m_end - m_start) / m_nbins; Bin1D result(m_start + step * index, m_start + step * (index + 1)); @@ -85,7 +85,7 @@ void FixedBinAxis::clip(double lower, double upper) { if (lower >= upper) throw std::runtime_error( - "FixedBinAxis::clip() -> Error. 'lower' should be smaller than 'upper'"); + "FixedBinAxis::clip -> Error. 'lower' should be smaller than 'upper'"); if (lower < min()) lower = bin(0).center(); diff --git a/Base/Axis/VariableBinAxis.cpp b/Base/Axis/VariableBinAxis.cpp index 6acd43084a6..60241dce213 100644 --- a/Base/Axis/VariableBinAxis.cpp +++ b/Base/Axis/VariableBinAxis.cpp @@ -45,7 +45,7 @@ double VariableBinAxis::operator[](size_t index) const Bin1D VariableBinAxis::bin(size_t index) const { if (index >= m_nbins) - throw std::runtime_error("VariableBinAxis::bin() -> Error. Wrong index."); + throw std::runtime_error("VariableBinAxis::bin -> Error. Wrong index."); Bin1D result(m_bin_boundaries[index], m_bin_boundaries[index + 1]); return result; @@ -69,7 +69,7 @@ double VariableBinAxis::binCenter(size_t index) const size_t VariableBinAxis::findClosestIndex(double value) const { if (m_bin_boundaries.size() < 2) - throw std::runtime_error("VariableBinAxis::findClosestIndex() -> Error! " + throw std::runtime_error("VariableBinAxis::findClosestIndex -> Error! " "VariableBinAxis not correctly initialized"); if (value < min()) return 0; @@ -95,7 +95,7 @@ std::vector<double> VariableBinAxis::binCenters() const void VariableBinAxis::clip(double lower, double upper) { if (lower >= upper) - throw std::runtime_error("VariableBinAxis::clip() -> Error. " + throw std::runtime_error("VariableBinAxis::clip -> Error. " "'lower' should be smaller than 'upper'"); if (lower < min()) @@ -150,7 +150,7 @@ void VariableBinAxis::setBinBoundaries(const std::vector<double>& bin_boundaries std::sort(vec_sorted.begin(), vec_sorted.end()); for (size_t i = 0; i < bin_boundaries.size(); ++i) { if (vec_sorted[i] != bin_boundaries[i]) - throw std::runtime_error("VariableBinAxis::setBinBoundaries() -> Error. " + throw std::runtime_error("VariableBinAxis::setBinBoundaries -> Error. " "Array with bin edges is not sorted."); } @@ -158,7 +158,7 @@ void VariableBinAxis::setBinBoundaries(const std::vector<double>& bin_boundaries vec.erase(std::unique(vec.begin(), vec.end()), vec.end()); if (vec.size() != bin_boundaries.size()) - throw std::runtime_error("VariableBinAxis::setBinBoundaries() -> Error. " + throw std::runtime_error("VariableBinAxis::setBinBoundaries -> Error. " "Array with bin edges contains repeating values."); m_bin_boundaries = bin_boundaries; diff --git a/Device/Detector/IDetector.cpp b/Device/Detector/IDetector.cpp index ee62bcd9dcf..0503017b514 100644 --- a/Device/Detector/IDetector.cpp +++ b/Device/Detector/IDetector.cpp @@ -242,11 +242,11 @@ size_t IDetector::detectorIndexToRegionOfInterestIndex(const size_t detectorInde const size_t ny = ycoord(detectorIndex, y.detectorSize); if (ny < y.lowerIndex || ny > y.upperIndex) - throw std::runtime_error("IDetector::detectorIndexToRegionOfInterestIndex() -> Error."); + throw std::runtime_error("IDetector::detectorIndexToRegionOfInterestIndex -> Error."); const size_t nx = xcoord(detectorIndex, x.detectorSize, y.detectorSize); if (nx < x.lowerIndex || nx > x.upperIndex) - throw std::runtime_error("IDetector::detectorIndexToRegionOfInterestIndex() -> Error."); + throw std::runtime_error("IDetector::detectorIndexToRegionOfInterestIndex -> Error."); return ny - y.lowerIndex + (nx - x.lowerIndex) * y.roiSize; } diff --git a/Device/Detector/RectangularDetector.cpp b/Device/Detector/RectangularDetector.cpp index d158cee54c3..551632aea18 100644 --- a/Device/Detector/RectangularDetector.cpp +++ b/Device/Detector/RectangularDetector.cpp @@ -202,7 +202,7 @@ void RectangularDetector::setDistanceAndOffset(double distance, double u0, doubl { if (distance <= 0.0) { std::ostringstream message; - message << "RectangularDetector::setPerpendicularToSample() -> Error. " + message << "RectangularDetector::setPerpendicularToSample -> Error. " << "Distance to sample cannot be negative or zero"; throw std::runtime_error(message.str()); } @@ -233,7 +233,7 @@ void RectangularDetector::initNormalVector(const R3 central_k) } else - throw std::runtime_error("RectangularDetector::init() -> Unknown detector arrangement"); + throw std::runtime_error("RectangularDetector::init -> Unknown detector arrangement"); } void RectangularDetector::initUandV() diff --git a/Device/IO/DataFormatUtils.cpp b/Device/IO/DataFormatUtils.cpp index 52a47a92718..a580d031596 100644 --- a/Device/IO/DataFormatUtils.cpp +++ b/Device/IO/DataFormatUtils.cpp @@ -64,7 +64,7 @@ IAxis* createFixedBinLikeAxis(std::istringstream iss) std::string name; size_t nbins(0); if (!(iss >> name >> nbins)) - throw std::runtime_error("createFixedBinLikeAxis() -> Error. Cannot parse the string."); + throw std::runtime_error("createFixedBinLikeAxis -> Error. Cannot parse the string."); std::vector<double> boundaries; DataUtils::Format::readLineOfDoubles(boundaries, iss); diff --git a/Device/IO/ReadWriteNumpyTXT.cpp b/Device/IO/ReadWriteNumpyTXT.cpp index 9b026d8233f..1970d89c62a 100644 --- a/Device/IO/ReadWriteNumpyTXT.cpp +++ b/Device/IO/ReadWriteNumpyTXT.cpp @@ -57,12 +57,12 @@ Datafield* ReadWriteNumpyTXT::readDatafield(std::istream& input_stream) ncols = data[0].size(); if (ncols == 0) - throw std::runtime_error("ReadNumpyTXTStrategy::readDatafield() -> Error. " + throw std::runtime_error("ReadNumpyTXTStrategy::readDatafield -> Error. " "Cannot parse file"); for (size_t row = 0; row < nrows; row++) { if (data[row].size() != ncols) - throw std::runtime_error("ReadNumpyTXTStrategy::readDatafield() -> Error. " + throw std::runtime_error("ReadNumpyTXTStrategy::readDatafield -> Error. " "Number of elements is different from row to row."); } diff --git a/Device/Resolution/ConvolutionDetectorResolution.cpp b/Device/Resolution/ConvolutionDetectorResolution.cpp index 92804faffdc..aa650e256eb 100644 --- a/Device/Resolution/ConvolutionDetectorResolution.cpp +++ b/Device/Resolution/ConvolutionDetectorResolution.cpp @@ -58,7 +58,7 @@ void ConvolutionDetectorResolution::applyDetectorResolution(Datafield* intensity { if (intensity_map->rank() != m_rank) { throw std::runtime_error( - "ConvolutionDetectorResolution::applyDetectorResolution() -> Error! " + "ConvolutionDetectorResolution::applyDetectorResolution -> Error! " "Intensity map must have same dimension as detector resolution function."); } switch (m_rank) { @@ -70,7 +70,7 @@ void ConvolutionDetectorResolution::applyDetectorResolution(Datafield* intensity break; default: throw std::runtime_error( - "ConvolutionDetectorResolution::applyDetectorResolution() -> Error! " + "ConvolutionDetectorResolution::applyDetectorResolution -> Error! " "Class ConvolutionDetectorResolution must be initialized with dimension 1 or 2."); } } @@ -85,7 +85,7 @@ void ConvolutionDetectorResolution::apply1dConvolution(Datafield* intensity_map) ASSERT(m_res_function_1d == nullptr); if (intensity_map->rank() != 1) throw std::runtime_error( - "ConvolutionDetectorResolution::apply1dConvolution() -> Error! " + "ConvolutionDetectorResolution::apply1dConvolution -> Error! " "Number of axes for intensity map does not correspond to the dimension of the map."); const IAxis& axis = intensity_map->axis(0); // Construct source vector from original intensity map @@ -96,7 +96,7 @@ void ConvolutionDetectorResolution::apply1dConvolution(Datafield* intensity_map) // Construct kernel vector from resolution function if (axis.size() != data_size) throw std::runtime_error( - "ConvolutionDetectorResolution::apply1dConvolution() -> Error! " + "ConvolutionDetectorResolution::apply1dConvolution -> Error! " "Size of axis for intensity map does not correspond to size of data in the map."); double step_size = std::abs(axis[0] - axis[axis.size() - 1]) / (data_size - 1); double mid_value = axis[axis.size() / 2]; // because Convolve expects zero at midpoint @@ -118,7 +118,7 @@ void ConvolutionDetectorResolution::apply2dConvolution(Datafield* intensity_map) ASSERT(m_res_function_2d); if (intensity_map->rank() != 2) throw std::runtime_error( - "ConvolutionDetectorResolution::apply2dConvolution() -> Error! " + "ConvolutionDetectorResolution::apply2dConvolution -> Error! " "Number of axes for intensity map does not correspond to the dimension of the map."); const IAxis& axis_1 = intensity_map->axis(0); const IAxis& axis_2 = intensity_map->axis(1); @@ -132,7 +132,7 @@ void ConvolutionDetectorResolution::apply2dConvolution(Datafield* intensity_map) size_t raw_data_size = raw_source_vector.size(); if (raw_data_size != axis_size_1 * axis_size_2) throw std::runtime_error( - "ConvolutionDetectorResolution::apply2dConvolution() -> Error! " + "ConvolutionDetectorResolution::apply2dConvolution -> Error! " "Intensity map data size does not match the product of its axes' sizes"); for (auto it = raw_source_vector.begin(); it != raw_source_vector.end(); it += axis_size_2) { std::vector<double> row_vector(it, it + axis_size_2); diff --git a/Device/Resolution/Convolve.cpp b/Device/Resolution/Convolve.cpp index 7b97bcc843a..5792a038e75 100644 --- a/Device/Resolution/Convolve.cpp +++ b/Device/Resolution/Convolve.cpp @@ -133,7 +133,7 @@ void Convolve::init(int h_src, int w_src, int h_kernel, int w_kernel) { if (!h_src || !w_src || !h_kernel || !w_kernel) { std::ostringstream os; - os << "Convolve::init() -> Panic! Wrong dimensions " << h_src << " " << w_src << " " + os << "Convolve::init -> Panic! Wrong dimensions " << h_src << " " << w_src << " " << h_kernel << " " << w_kernel << std::endl; throw std::runtime_error(os.str()); } @@ -229,19 +229,18 @@ void Convolve::init(int h_src, int w_src, int h_kernel, int w_kernel) ws.p_forw_src = fftw_plan_dft_r2c_2d(ws.h_fftw, ws.w_fftw, ws.in_src, (fftw_complex*)ws.out_src, FFTW_ESTIMATE); if (ws.p_forw_src == nullptr) - throw std::runtime_error("Convolve::init() -> Error! Cannot initialise p_forw_src plan."); + throw std::runtime_error("Convolve::init -> Error! Cannot initialise p_forw_src plan."); ws.p_forw_kernel = fftw_plan_dft_r2c_2d(ws.h_fftw, ws.w_fftw, ws.in_kernel, (fftw_complex*)ws.out_kernel, FFTW_ESTIMATE); if (ws.p_forw_kernel == nullptr) - throw std::runtime_error( - "Convolve::init() -> Error! Cannot initialise p_forw_kernel plan."); + throw std::runtime_error("Convolve::init -> Error! Cannot initialise p_forw_kernel plan."); // The backward FFT takes ws.out_kernel as input ws.p_back = fftw_plan_dft_c2r_2d(ws.h_fftw, ws.w_fftw, (fftw_complex*)ws.out_kernel, ws.dst_fft, FFTW_ESTIMATE); if (ws.p_back == nullptr) - throw std::runtime_error("Convolve::init() -> Error! Cannot initialise p_back plan."); + throw std::runtime_error("Convolve::init -> Error! Cannot initialise p_back plan."); } /* ************************************************************************* */ @@ -251,7 +250,7 @@ void Convolve::init(int h_src, int w_src, int h_kernel, int w_kernel) void Convolve::fftw_circular_convolution(const double2d_t& src, const double2d_t& kernel) { if (ws.h_fftw <= 0 || ws.w_fftw <= 0) - throw std::runtime_error("Convolve::fftw_convolve() -> Panic! Initialization is missed."); + throw std::runtime_error("Convolve::fftw_convolve -> Panic! Initialization is missed."); double *ptr, *ptr_end, *ptr2; diff --git a/Fit/Adapter/GeneticMinimizer.cpp b/Fit/Adapter/GeneticMinimizer.cpp index ec88f8678c6..a97733e081a 100644 --- a/Fit/Adapter/GeneticMinimizer.cpp +++ b/Fit/Adapter/GeneticMinimizer.cpp @@ -94,7 +94,7 @@ void GeneticMinimizer::setParameter(unsigned int index, const mumufit::Parameter { if (!par.limits().isFixed() && !par.limits().isLimited()) { std::ostringstream ostr; - ostr << "GeneticMinimizer::setParameter() -> Error! " + ostr << "GeneticMinimizer::setParameter -> Error! " << "Genetic minimizer requires either fixed or " << "limited AttLimits::limited(left,right) parameter. " << " Parameter name '" << par.name() << "', limits:" << par.limits().toString(); diff --git a/Fit/Adapter/MinimizerAdapter.cpp b/Fit/Adapter/MinimizerAdapter.cpp index 5ab7badec11..ee023f98db3 100644 --- a/Fit/Adapter/MinimizerAdapter.cpp +++ b/Fit/Adapter/MinimizerAdapter.cpp @@ -165,11 +165,11 @@ void MinimizerAdapter::setParameter(unsigned int index, const mumufit::Parameter else - throw std::runtime_error("BasicMinimizer::setParameter() -> Error! Unexpected parameter."); + throw std::runtime_error("BasicMinimizer::setParameter -> Error! Unexpected parameter."); if (!success) { std::ostringstream ostr; - ostr << "BasicMinimizer::setParameter() -> Error! Cannot set minimizer's fit parameter"; + ostr << "BasicMinimizer::setParameter -> Error! Cannot set minimizer's fit parameter"; ostr << "Index:" << index << " name '" << par.name() << "'"; throw std::runtime_error(ostr.str()); } diff --git a/Fit/Adapter/ResidualFunctionAdapter.cpp b/Fit/Adapter/ResidualFunctionAdapter.cpp index f48a1ec4323..2b30e761c26 100644 --- a/Fit/Adapter/ResidualFunctionAdapter.cpp +++ b/Fit/Adapter/ResidualFunctionAdapter.cpp @@ -79,7 +79,7 @@ std::vector<double> ResidualFunctionAdapter::get_residuals(const std::vector<dou { if (pars.size() != m_parameters.size()) { std::ostringstream ostr; - ostr << "ResidualFunctionAdapter::residuals() -> Error. Number of fit parameters " + ostr << "ResidualFunctionAdapter::residuals -> Error. Number of fit parameters " << "has changed in the course of minimization. Initially was " << m_parameters.size() << " become " << pars.size() << "\n"; throw std::runtime_error(ostr.str()); @@ -90,7 +90,7 @@ std::vector<double> ResidualFunctionAdapter::get_residuals(const std::vector<dou if (result.size() != m_datasize) { std::ostringstream ostr; - ostr << "ResidualFunctionAdapter::residuals() -> Error. Size of data " + ostr << "ResidualFunctionAdapter::residuals -> Error. Size of data " << "has changed in the course of minimization. Initial length " << m_datasize << " new length " << result.size() << "\n"; throw std::runtime_error(ostr.str()); @@ -111,7 +111,7 @@ double ResidualFunctionAdapter::element_residual(const std::vector<double>& pars if (!gradients.empty()) { // Non zero size means that minimizer wants to know gradients. if (pars.size() != gradients.size()) - throw std::runtime_error("ResidualFunctionAdapter::element_residual() -> Error. " + throw std::runtime_error("ResidualFunctionAdapter::element_residual -> Error. " "Number of gradients doesn't match number of fit parameters."); if (index == 0) calculate_gradients(pars); @@ -132,7 +132,7 @@ double ResidualFunctionAdapter::chi2(const std::vector<double>& pars) int fnorm = static_cast<int>(m_datasize) - static_cast<int>(m_parameters.freeParameterCount()); if (fnorm <= 0) - throw std::runtime_error("ResidualFunctionAdapter::chi2() -> Error. Normalization is 0"); + throw std::runtime_error("ResidualFunctionAdapter::chi2 -> Error. Normalization is 0"); return result / fnorm; } diff --git a/Fit/Kernel/Minimizer.cpp b/Fit/Kernel/Minimizer.cpp index 03186e57e12..ea9d40797f5 100644 --- a/Fit/Kernel/Minimizer.cpp +++ b/Fit/Kernel/Minimizer.cpp @@ -56,5 +56,5 @@ MinimizerResult Minimizer::minimize(const PyCallback& callback, const Parameters return minimize(fcn, parameters); } - throw std::runtime_error("Minimizer::minimize() -> Error. Unexpected user function"); + throw std::runtime_error("Minimizer::minimize -> Error. Unexpected user function"); } diff --git a/Fit/Kernel/MinimizerFactory.cpp b/Fit/Kernel/MinimizerFactory.cpp index 4c1a711aa81..564187c2225 100644 --- a/Fit/Kernel/MinimizerFactory.cpp +++ b/Fit/Kernel/MinimizerFactory.cpp @@ -51,7 +51,7 @@ IMinimizer* MinimizerFactory::createMinimizer(const std::string& minimizerName, if (!result) { std::ostringstream ostr; - ostr << "MinimizerFactory::MinimizerFactory() -> Error! Cannot create minimizer for given " + ostr << "MinimizerFactory::MinimizerFactory -> Error! Cannot create minimizer for given " "collection name '" << minimizerName << "' or algorithm '" << algorithmType << "'" << std::endl; ostr << "Possible names are:" << std::endl; diff --git a/Fit/Kernel/PyCallback.cpp b/Fit/Kernel/PyCallback.cpp index d9b508ced5c..bbef821bb01 100644 --- a/Fit/Kernel/PyCallback.cpp +++ b/Fit/Kernel/PyCallback.cpp @@ -28,10 +28,10 @@ PyCallback::~PyCallback() = default; double PyCallback::call_scalar(mumufit::Parameters) const { - throw std::runtime_error("PyCallback::call_scalar() -> Error. Not implemented"); + throw std::runtime_error("PyCallback::call_scalar -> Error. Not implemented"); } std::vector<double> PyCallback::call_residuals(mumufit::Parameters) const { - throw std::runtime_error("PyCallback::call_residuals() -> Error. Not implemented"); + throw std::runtime_error("PyCallback::call_residuals -> Error. Not implemented"); } diff --git a/Fit/Minimizer/IMinimizer.cpp b/Fit/Minimizer/IMinimizer.cpp index 0922ed918c5..c636dd688b4 100644 --- a/Fit/Minimizer/IMinimizer.cpp +++ b/Fit/Minimizer/IMinimizer.cpp @@ -20,20 +20,20 @@ IMinimizer::~IMinimizer() = default; mumufit::MinimizerResult IMinimizer::minimize_scalar(fcn_scalar_t, mumufit::Parameters) { - throw std::runtime_error("IMinimizer::minimize_scalar() -> Not implemented."); + throw std::runtime_error("IMinimizer::minimize_scalar -> Not implemented."); } mumufit::MinimizerResult IMinimizer::minimize_residual(fcn_residual_t, mumufit::Parameters) { - throw std::runtime_error("IMinimizer::minimize_residual() -> Not implemented."); + throw std::runtime_error("IMinimizer::minimize_residual -> Not implemented."); } double IMinimizer::minValue() const { - throw std::runtime_error("IMinimizer::minValue() -> Not implemented."); + throw std::runtime_error("IMinimizer::minValue -> Not implemented."); } void IMinimizer::setOptions(const std::string&) { - throw std::runtime_error("IMinimizer::setOptions() -> Not implemented."); + throw std::runtime_error("IMinimizer::setOptions -> Not implemented."); } diff --git a/Fit/Minimizer/MinimizerInfo.cpp b/Fit/Minimizer/MinimizerInfo.cpp index 7e883676aa2..751d30e4664 100644 --- a/Fit/Minimizer/MinimizerInfo.cpp +++ b/Fit/Minimizer/MinimizerInfo.cpp @@ -26,7 +26,7 @@ void MinimizerInfo::setAlgorithmName(const std::string& algorithmName) } std::ostringstream msg; - msg << "MinimizerInfo::setAlgorithmName() -> Error. Algorithm name '" << algorithmName + msg << "MinimizerInfo::setAlgorithmName -> Error. Algorithm name '" << algorithmName << "' is not in the list of defined algorithms ("; for (const AlgorithmInfo& algo : m_algorithms) msg << algo.name() << " "; diff --git a/Fit/Minimizer/MinimizerOptions.cpp b/Fit/Minimizer/MinimizerOptions.cpp index 4381b047f0f..b81583a9841 100644 --- a/Fit/Minimizer/MinimizerOptions.cpp +++ b/Fit/Minimizer/MinimizerOptions.cpp @@ -43,7 +43,7 @@ void MinimizerOptions::setOptionString(const std::string& options) processCommand(opt); } catch (std::exception& ex) { std::ostringstream ostr; - ostr << "MinimizerOptions::setOptions() -> Error. Cannot parse option string '" << options + ostr << "MinimizerOptions::setOptions -> Error. Cannot parse option string '" << options << "'.\n, error message '" << ex.what() << "'"; throw std::runtime_error(ostr.str()); } @@ -56,7 +56,7 @@ void MinimizerOptions::processCommand(const std::string& command) { std::vector<std::string> tokens = mumufit::stringUtils::split(command, "="); if (tokens.size() != 2) - throw std::runtime_error("MinimizerOptions::processOption() -> Cannot parse option '" + throw std::runtime_error("MinimizerOptions::processOption -> Cannot parse option '" + command + "'"); std::string name = tokens[0]; diff --git a/Fit/Param/Parameters.cpp b/Fit/Param/Parameters.cpp index bad6f519921..12df12a2116 100644 --- a/Fit/Param/Parameters.cpp +++ b/Fit/Param/Parameters.cpp @@ -22,8 +22,8 @@ using namespace mumufit; void Parameters::add(const Parameter& par) { if (exists(par.name())) - throw std::runtime_error("Parameters::add() -> Error. Parameter with the name '" - + par.name() + "' already exists."); + throw std::runtime_error("Parameters::add -> Error. Parameter with the name '" + par.name() + + "' already exists."); m_parameters.push_back(par); } @@ -68,11 +68,11 @@ void Parameters::setValues(const std::vector<double>& values) size_t index = 0; for (auto& par : m_parameters) { if (std::isnan(values[index])) - throw std::runtime_error("Parameters::setValues() -> Error." + throw std::runtime_error("Parameters::setValues -> Error." " Attempt to set nan '" + par.name() + "'."); if (std::isinf(values[index])) - throw std::runtime_error("Parameters::setValues() -> Error. Attempt to set inf '" + throw std::runtime_error("Parameters::setValues -> Error. Attempt to set inf '" + par.name() + "'."); par.setValue(values[index]); ++index; @@ -122,7 +122,7 @@ Parameters::corr_matrix_t Parameters::correlationMatrix() const void Parameters::setCorrelationMatrix(const Parameters::corr_matrix_t& matrix) { if (matrix.size() != size()) - throw std::runtime_error("Parameters::setCorrelationMatrix() -> Error. Wrong " + throw std::runtime_error("Parameters::setCorrelationMatrix -> Error. Wrong " "dimension of correlation matrix."); m_corr_matrix = matrix; } @@ -150,7 +150,7 @@ void Parameters::check_array_size(const std::vector<double>& values) const { if (values.size() != m_parameters.size()) { std::ostringstream ostr; - ostr << "Parameters::check_array_size() -> Error. Size of input array " << values.size() + ostr << "Parameters::check_array_size -> Error. Size of input array " << values.size() << " doesn't mach number of fit parameters " << m_parameters.size() << "." << std::endl; throw std::runtime_error(ostr.str()); @@ -160,6 +160,6 @@ void Parameters::check_array_size(const std::vector<double>& values) const size_t Parameters::check_index(size_t index) const { if (index >= m_parameters.size()) - throw std::runtime_error("Parameters::check_index() -> Index out of bounds"); + throw std::runtime_error("Parameters::check_index -> Index out of bounds"); return index; } diff --git a/Fit/TestEngine/MinimizerTestPlan.cpp b/Fit/TestEngine/MinimizerTestPlan.cpp index 333d01dd032..554800c6074 100644 --- a/Fit/TestEngine/MinimizerTestPlan.cpp +++ b/Fit/TestEngine/MinimizerTestPlan.cpp @@ -72,7 +72,7 @@ bool MinimizerTestPlan::valuesAsExpected(const std::vector<double>& values) cons bool success = true; if (m_parameter_references.size() != values.size()) - throw std::runtime_error("FunctionTestPlan::valuesAsExpected() -> Error. Sizes differ."); + throw std::runtime_error("FunctionTestPlan::valuesAsExpected -> Error. Sizes differ."); for (size_t i = 0; i < values.size(); ++i) { const ParameterReference& ref = m_parameter_references[i]; diff --git a/Fit/Tools/MinimizerUtils.cpp b/Fit/Tools/MinimizerUtils.cpp index 942f159ae2a..41a27d7c6f1 100644 --- a/Fit/Tools/MinimizerUtils.cpp +++ b/Fit/Tools/MinimizerUtils.cpp @@ -84,7 +84,7 @@ bool mumufit::utils::numbersDiffer(double a, double b, double tol) { constexpr double eps = std::numeric_limits<double>::epsilon(); if (tol < 1) - throw std::runtime_error("mumufit::utils::numbersDiffer() -> Error.Not intended for tol<1"); + throw std::runtime_error("mumufit::utils::numbersDiffer -> Error.Not intended for tol<1"); return std::abs(a - b) > eps * std::max(tol * eps, std::abs(b)); } diff --git a/Fit/Tools/OptionContainer.cpp b/Fit/Tools/OptionContainer.cpp index f6a4a61570d..5bb9f060719 100644 --- a/Fit/Tools/OptionContainer.cpp +++ b/Fit/Tools/OptionContainer.cpp @@ -38,8 +38,8 @@ OptionContainer::option_t OptionContainer::option(const std::string& optionName) return option; } - throw std::runtime_error("Configurable::getOption() -> Error. No option with name '" - + optionName + "'."); + throw std::runtime_error("Configurable::getOption -> Error. No option with name '" + optionName + + "'."); } OptionContainer::option_t OptionContainer::option(const std::string& optionName) const @@ -49,8 +49,8 @@ OptionContainer::option_t OptionContainer::option(const std::string& optionName) return option; } - throw std::runtime_error("Configurable::getOption() -> Error. No option with name '" - + optionName + "'."); + throw std::runtime_error("Configurable::getOption -> Error. No option with name '" + optionName + + "'."); } bool OptionContainer::exists(const std::string& name) diff --git a/Fit/Tools/OptionContainer.h b/Fit/Tools/OptionContainer.h index 818a7451fe1..4e300b795ec 100644 --- a/Fit/Tools/OptionContainer.h +++ b/Fit/Tools/OptionContainer.h @@ -70,7 +70,7 @@ OptionContainer::option_t OptionContainer::addOption(const std::string& optionNa const std::string& description) { if (exists(optionName)) - throw std::runtime_error("OptionContainer::addOption() -> Error. Option '" + optionName + throw std::runtime_error("OptionContainer::addOption -> Error. Option '" + optionName + "' exists."); option_t result(new MultiOption(optionName, value, description)); @@ -90,7 +90,7 @@ void OptionContainer::setOptionValue(const std::string& optionName, T value) option(optionName)->value() = value; if (option(optionName)->value().index() != option(optionName)->defaultValue().index()) throw std::runtime_error( - "OptionContainer::setOptionValue() -> Error. Attempt to set different" + "OptionContainer::setOptionValue -> Error. Attempt to set different" "type to option '" + optionName + "'"); } diff --git a/GUI/Model/Data/ComboProperty.cpp b/GUI/Model/Data/ComboProperty.cpp index f3b8f9286ea..cd736e42588 100644 --- a/GUI/Model/Data/ComboProperty.cpp +++ b/GUI/Model/Data/ComboProperty.cpp @@ -61,7 +61,7 @@ QString ComboProperty::currentValue() const void ComboProperty::setCurrentValue(const QString& name) { if (!m_values.contains(name)) - throw Error("ComboProperty::setValue() -> Error. Combo doesn't contain " + throw Error("ComboProperty::setValue -> Error. Combo doesn't contain " "value " + name); setCurrentIndex(m_values.indexOf(name)); diff --git a/GUI/Model/Data/DataItem.cpp b/GUI/Model/Data/DataItem.cpp index 2a7f98efef8..9c77c97636c 100644 --- a/GUI/Model/Data/DataItem.cpp +++ b/GUI/Model/Data/DataItem.cpp @@ -64,7 +64,7 @@ void DataItem::setDatafield(Datafield* data) void DataItem::setRawDataVector(const std::vector<double>& data) { if (m_datafield->size() != data.size()) - throw Error("DataItem::setVector() -> Error. " + throw Error("DataItem::setVector -> Error. " "Different data size."); std::unique_lock<std::mutex> lock(m_update_data_mutex); m_datafield->setVector(data); diff --git a/GUI/Model/FromCore/ItemizeSimulation.cpp b/GUI/Model/FromCore/ItemizeSimulation.cpp index 46f161c7edc..71246653f02 100644 --- a/GUI/Model/FromCore/ItemizeSimulation.cpp +++ b/GUI/Model/FromCore/ItemizeSimulation.cpp @@ -305,7 +305,7 @@ void setDetectorResolution(DetectorItem* detector_item, const IDetector& detecto item->setSigmaX(scale * resfunc->sigmaX()); item->setSigmaY(scale * resfunc->sigmaY()); } else { - throw Error("setDetectorResolution() -> Error. " + throw Error("setDetectorResolution -> Error. " "Unknown detector resolution function"); } } else diff --git a/GUI/Model/Job/FitSuiteItem.cpp b/GUI/Model/Job/FitSuiteItem.cpp index 8544847b80e..76862fc05e5 100644 --- a/GUI/Model/Job/FitSuiteItem.cpp +++ b/GUI/Model/Job/FitSuiteItem.cpp @@ -42,7 +42,7 @@ FitSuiteItem::FitSuiteItem() FitParameterContainerItem* FitSuiteItem::createFitParametersContainerItem() { if (m_fitContainer) - throw Error("FitSuiteItem::createFitParametersContainer() -> Error. Attempt to create " + throw Error("FitSuiteItem::createFitParametersContainer -> Error. Attempt to create " "a second FitParameterContainer."); m_fitContainer = std::make_unique<FitParameterContainerItem>(); @@ -57,7 +57,7 @@ FitParameterContainerItem* FitSuiteItem::fitParameterContainerItem() MinimizerContainerItem* FitSuiteItem::createMinimizerContainerItem() { if (m_minimizerContainer) - throw Error("FitSuiteItem::createMinimizerContainer() -> Error. Attempt to create " + throw Error("FitSuiteItem::createMinimizerContainer -> Error. Attempt to create " "a second MinimizerContainer."); m_minimizerContainer = std::make_unique<MinimizerContainerItem>(); diff --git a/GUI/Model/Job/JobItem.cpp b/GUI/Model/Job/JobItem.cpp index 0fd271a9db6..5fa3fe324f9 100644 --- a/GUI/Model/Job/JobItem.cpp +++ b/GUI/Model/Job/JobItem.cpp @@ -248,7 +248,7 @@ FitSuiteItem* JobItem::fitSuiteItem() FitSuiteItem* JobItem::createFitSuiteItem() { if (m_fitSuiteItem) - throw Error("JobItem::createFitSuiteItem() -> Error. Attempt to create " + throw Error("JobItem::createFitSuiteItem -> Error. Attempt to create " "a second FitSuiteItem."); m_fitSuiteItem = std::make_unique<FitSuiteItem>(); diff --git a/GUI/Model/Model/JobQueueData.cpp b/GUI/Model/Model/JobQueueData.cpp index 84ffe66fa96..1490555ecaa 100644 --- a/GUI/Model/Model/JobQueueData.cpp +++ b/GUI/Model/Model/JobQueueData.cpp @@ -40,14 +40,14 @@ void JobQueueData::runJob(JobItem* jobItem) return; if (getSimulation(identifier)) - throw Error("JobQueueData::runJob() -> Error. ISimulation is already existing."); + throw Error("JobQueueData::runJob -> Error. ISimulation is already existing."); try { auto simulation = GUI::ToCore::itemsToSimulation( *jobItem->sampleItem(), *jobItem->instrumentItem(), jobItem->simulationOptionsItem()); m_simulations[identifier] = simulation.release(); } catch (const std::exception& ex) { - QString message("JobQueueData::runJob() -> Error. " + QString message("JobQueueData::runJob -> Error. " "Attempt to create sample/instrument object from user description " "has failed with following error message.\n\n"); message += QString::fromStdString(std::string(ex.what())); @@ -188,7 +188,7 @@ void JobQueueData::assignForDeletion(QThread* thread) } } - throw Error("JobQueueData::assignForDeletion() -> Error! Cannot find thread."); + throw Error("JobQueueData::assignForDeletion -> Error! Cannot find thread."); } //! Removes JobRunner from the map of known runners, assigns it for deletion. @@ -205,7 +205,7 @@ void JobQueueData::assignForDeletion(JobWorker* worker) } } - throw Error("JobQueueData::assignForDeletion() -> Error! Cannot find the runner."); + throw Error("JobQueueData::assignForDeletion -> Error! Cannot find the runner."); } void JobQueueData::clearSimulation(const QString& identifier) diff --git a/GUI/Model/Project/ProjectDocument.cpp b/GUI/Model/Project/ProjectDocument.cpp index 2c564dc90bf..01efa4da6c7 100644 --- a/GUI/Model/Project/ProjectDocument.cpp +++ b/GUI/Model/Project/ProjectDocument.cpp @@ -156,7 +156,7 @@ void ProjectDocument::saveProjectFileWithData(const QString& projectPullPath) { QFile file(projectPullPath); if (!file.open(QFile::ReadWrite | QIODevice::Truncate | QFile::Text)) - throw Error("ProjectDocument::save_project_file() -> Error. Cannot open " + throw Error("ProjectDocument::save_project_file -> Error. Cannot open " "file '" + projectPullPath + "' for writing."); diff --git a/GUI/Support/Data/JobWorker.cpp b/GUI/Support/Data/JobWorker.cpp index b02c4a7fd79..cf3b4e8bb3b 100644 --- a/GUI/Support/Data/JobWorker.cpp +++ b/GUI/Support/Data/JobWorker.cpp @@ -63,15 +63,14 @@ void JobWorker::start() } catch (const std::exception& ex) { m_job_status = JobStatus::Failed; m_percentage_done = 100; - m_failure_message = - "JobRunner::start() -> ISimulation failed with exception throw:\n\n"; + m_failure_message = "JobRunner::start -> ISimulation failed with exception throw:\n\n"; m_failure_message.append(QString(ex.what())); } } else { m_job_status = JobStatus::Failed; m_percentage_done = 100; - m_failure_message = "JobRunner::start() -> Error. ISimulation doesn't exist."; + m_failure_message = "JobRunner::start -> Error. ISimulation doesn't exist."; } m_simulation_end = QDateTime::currentDateTime(); diff --git a/GUI/View/Fit/FitSessionController.cpp b/GUI/View/Fit/FitSessionController.cpp index 1c7f09f8c95..a212ae5877d 100644 --- a/GUI/View/Fit/FitSessionController.cpp +++ b/GUI/View/Fit/FitSessionController.cpp @@ -53,7 +53,7 @@ FitSessionController::~FitSessionController() = default; void FitSessionController::setJobItem(JobItem* jobItem) { if (m_jobItem && m_jobItem != jobItem) - throw Error("FitSuiteManager::setJobItem() -> JobItem was already set."); + throw Error("FitSuiteManager::setJobItem -> JobItem was already set."); m_jobItem = jobItem; ASSERT(m_jobItem); diff --git a/GUI/View/Fit/FitSessionManager.cpp b/GUI/View/Fit/FitSessionManager.cpp index a87a01c681f..93760537ad8 100644 --- a/GUI/View/Fit/FitSessionManager.cpp +++ b/GUI/View/Fit/FitSessionManager.cpp @@ -61,7 +61,7 @@ void FitSessionManager::removeController(JobItem* jobItem) { auto it = m_item_to_controller.find(jobItem); if (it == m_item_to_controller.end()) - throw Error("FitActivityManager::removeFitSession() -> Error. " + throw Error("FitActivityManager::removeFitSession -> Error. " "Cannot find fit session"); if (m_activeController == it.value()) diff --git a/GUI/View/Fit/ParameterTuningWidget.cpp b/GUI/View/Fit/ParameterTuningWidget.cpp index 87cf15ea1ae..36d132ca9ea 100644 --- a/GUI/View/Fit/ParameterTuningWidget.cpp +++ b/GUI/View/Fit/ParameterTuningWidget.cpp @@ -140,7 +140,7 @@ void ParameterTuningWidget::updateParameterModel() return; if (!jobItem()->sampleItem() || !jobItem()->instrumentItem()) - throw Error("ModelTuningWidget::updateParameterModel() -> Error." + throw Error("ModelTuningWidget::updateParameterModel -> Error." "JobItem doesn't have sample or instrument model."); delete m_parameterTuningModel; diff --git a/GUI/View/Project/ProjectManager.cpp b/GUI/View/Project/ProjectManager.cpp index 10bea9b6df9..840ca3ef0cc 100644 --- a/GUI/View/Project/ProjectManager.cpp +++ b/GUI/View/Project/ProjectManager.cpp @@ -64,7 +64,7 @@ ProjectManager::~ProjectManager() ProjectManager* ProjectManager::instance() { if (!s_instance) - throw Error("ProjectManager::instance() -> Error. Attempt to access " + throw Error("ProjectManager::instance -> Error. Attempt to access " "non existing ProjectManager."); return s_instance; @@ -338,7 +338,7 @@ void ProjectManager::openProject(QString projectPullPath) void ProjectManager::createNewProject() { if (gProjectDocument.has_value()) - throw Error("ProjectManager::createNewProject() -> Project already exists"); + throw Error("ProjectManager::createNewProject -> Project already exists"); gProjectDocument = new ProjectDocument(); diff --git a/GUI/View/Projection/SaveProjectionsAssistant.cpp b/GUI/View/Projection/SaveProjectionsAssistant.cpp index 2ad98af66bf..171274d6f24 100644 --- a/GUI/View/Projection/SaveProjectionsAssistant.cpp +++ b/GUI/View/Projection/SaveProjectionsAssistant.cpp @@ -79,7 +79,7 @@ void SaveProjectionsAssistant::saveProjections(QWidget* parent, IntensityDataIte QFile file(fileName); if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) - throw Error("TestGUI::Project::Utils::createTestFile() -> Error. " + throw Error("TestGUI::Project::Utils::createTestFile -> Error. " "Cannot create file"); m_field = intensityItem->datafield(); diff --git a/GUI/View/Widget/DocksController.cpp b/GUI/View/Widget/DocksController.cpp index 07d611f3c8c..fe1da67323d 100644 --- a/GUI/View/Widget/DocksController.cpp +++ b/GUI/View/Widget/DocksController.cpp @@ -85,7 +85,7 @@ QDockWidget* DocksController::addDockForWidget(QWidget* widget) void DocksController::addWidget(int id, QWidget* widget, Qt::DockWidgetArea area) { if (m_docks.find(id) != m_docks.end()) - throw Error("DocksController::addWidget() -> Error. " + throw Error("DocksController::addWidget -> Error. " "Attempt to add widget id twice"); auto* dock = addDockForWidget(widget); diff --git a/Sample/HardParticle/Cone.cpp b/Sample/HardParticle/Cone.cpp index fc8c6717fdf..320c9d6cec4 100644 --- a/Sample/HardParticle/Cone.cpp +++ b/Sample/HardParticle/Cone.cpp @@ -73,7 +73,7 @@ std::string Cone::validate() const if (m_cot_alpha * m_height > m_radius) { std::ostringstream ostr; - ostr << "Cone() -> Error in class initialization "; + ostr << "Cone -> Error in class initialization "; ostr << "with parameters radius:" << m_radius; ostr << " m_height:" << m_height; ostr << " alpha[rad]:" << m_alpha << "\n\n"; diff --git a/Sample/Interface/LayerInterface.cpp b/Sample/Interface/LayerInterface.cpp index cc6a4413d89..18ccf55c0d4 100644 --- a/Sample/Interface/LayerInterface.cpp +++ b/Sample/Interface/LayerInterface.cpp @@ -26,7 +26,7 @@ LayerInterface::~LayerInterface() = default; LayerInterface* LayerInterface::clone() const { - throw std::runtime_error("LayerInterface::clone() -> Not allowed to clone."); + throw std::runtime_error("LayerInterface::clone -> Not allowed to clone."); } LayerInterface* LayerInterface::createSmoothInterface(const Layer* top_layer, diff --git a/Sim/Fitting/FitObjective.cpp b/Sim/Fitting/FitObjective.cpp index bc64c5326a0..9bd376c3546 100644 --- a/Sim/Fitting/FitObjective.cpp +++ b/Sim/Fitting/FitObjective.cpp @@ -322,7 +322,7 @@ void FitObjective::execSimulations(const mumufit::Parameters& params) throw std::runtime_error("Fitting was interrupted by the user."); if (m_fit_objects.empty()) - throw std::runtime_error("FitObjective::execSimulations() -> Error. " + throw std::runtime_error("FitObjective::execSimulations -> Error. " "No simulation/data defined."); for (auto& obj : m_fit_objects) diff --git a/Sim/Fitting/FitPrintService.cpp b/Sim/Fitting/FitPrintService.cpp index c13b0edd246..d91333c61d8 100644 --- a/Sim/Fitting/FitPrintService.cpp +++ b/Sim/Fitting/FitPrintService.cpp @@ -60,7 +60,7 @@ std::string FitPrintService::iterationHeaderString(const FitObjective& objective { std::ostringstream result; - result << "FitPrintService::update() -> Info." + result << "FitPrintService::update -> Info." << " NCall:" << objective.iterationInfo().iterationCount() << " Chi2:" << std::scientific << std::setprecision(8) << objective.iterationInfo().chi2() << "\n"; diff --git a/Sim/Fitting/FitStatus.cpp b/Sim/Fitting/FitStatus.cpp index 20248aad6a1..e7de6bc21e3 100644 --- a/Sim/Fitting/FitStatus.cpp +++ b/Sim/Fitting/FitStatus.cpp @@ -75,7 +75,7 @@ IterationInfo FitStatus::iterationInfo() const mumufit::MinimizerResult FitStatus::minimizerResult() const { if (!m_minimizer_result) - throw std::runtime_error("FitStatus::minimizerResult() -> Minimizer result wasn't set. " + throw std::runtime_error("FitStatus::minimizerResult -> Minimizer result wasn't set. " "Make sure that FitObjective::finalize() was called."); return {*m_minimizer_result}; diff --git a/Sim/Fitting/PyFittingCallbacks.cpp b/Sim/Fitting/PyFittingCallbacks.cpp index 45bb58a826e..ee8c59e7e7a 100644 --- a/Sim/Fitting/PyFittingCallbacks.cpp +++ b/Sim/Fitting/PyFittingCallbacks.cpp @@ -22,7 +22,7 @@ PyBuilderCallback::~PyBuilderCallback() = default; ISimulation* PyBuilderCallback::build_simulation(const mumufit::Parameters&) const { - throw std::runtime_error("PyBuilderCallback::build_simulation() -> Error. Not implemented"); + throw std::runtime_error("PyBuilderCallback::build_simulation -> Error. Not implemented"); } // --- PyObserverCallback --- @@ -33,5 +33,5 @@ PyObserverCallback::~PyObserverCallback() = default; void PyObserverCallback::update(const FitObjective&) { - throw std::runtime_error("PyObserverCallback::update() -> Error. Not implemented"); + throw std::runtime_error("PyObserverCallback::update -> Error. Not implemented"); } diff --git a/Tests/Unit/GUI/TestProjectUtils.cpp b/Tests/Unit/GUI/TestProjectUtils.cpp index 3badfe090f0..ab963e44d82 100644 --- a/Tests/Unit/GUI/TestProjectUtils.cpp +++ b/Tests/Unit/GUI/TestProjectUtils.cpp @@ -15,7 +15,7 @@ QStringList nonXMLDataInDir(const QString& dirname) QDir dir(dirname); if (!dir.exists()) - throw Error("GUI::Project::Utils::nonXMLDataInDir() -> Error. Non existing " + throw Error("GUI::Project::Utils::nonXMLDataInDir -> Error. Non existing " "directory '" + dirname + "'."); @@ -33,7 +33,7 @@ protected: QFile file(filename); if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) - throw Error("TestGUI::Project::Utils::createTestFile() -> Error. " + throw Error("TestGUI::Project::Utils::createTestFile -> Error. " "Cannot create file"); QTextStream out(&file); diff --git a/Tests/Unit/GUI/Utils.cpp b/Tests/Unit/GUI/Utils.cpp index 204f7cad33d..1172c6533c8 100644 --- a/Tests/Unit/GUI/Utils.cpp +++ b/Tests/Unit/GUI/Utils.cpp @@ -35,7 +35,7 @@ void UTest::GUI::create_dir(const QString& dir_name) QDir(dir_name).removeRecursively(); if (!QDir(".").mkdir(dir_name)) - throw Error("UTest::GUI::create_dir() -> Error. Cannot create '" + dir_name + throw Error("UTest::GUI::create_dir -> Error. Cannot create '" + dir_name + "' in parent directory '.'."); } diff --git a/Tests/Unit/GUI/Utils.h b/Tests/Unit/GUI/Utils.h index 19df90843cb..c7e3bece9e3 100644 --- a/Tests/Unit/GUI/Utils.h +++ b/Tests/Unit/GUI/Utils.h @@ -74,7 +74,7 @@ void readXMLFile(QString path, T& model, QString tag) r.readNextStartElement(); if (r.name().toString() != tag) - throw Error("UTest::GUI::readXMLFile() -> Error. The found tag '" + r.name().toString() + throw Error("UTest::GUI::readXMLFile -> Error. The found tag '" + r.name().toString() + "' differs from '" + tag + "' in file '" + path + "'"); model.readFrom(&r); -- GitLab From 21eba47db6bd47fec834bced455d87eb21a75a1b Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Fri, 24 Mar 2023 14:07:10 +0100 Subject: [PATCH 04/13] GUI JobWorker: extend 'try' coverage; rm special treatment for impossible case of no m_simulation --- GUI/Support/Data/JobWorker.cpp | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/GUI/Support/Data/JobWorker.cpp b/GUI/Support/Data/JobWorker.cpp index cf3b4e8bb3b..3bb200b2594 100644 --- a/GUI/Support/Data/JobWorker.cpp +++ b/GUI/Support/Data/JobWorker.cpp @@ -13,6 +13,7 @@ // ************************************************************************************************ #include "GUI/Support/Data/JobWorker.h" +#include "Base/Util/Assert.h" #include "Device/Histo/SimulationResult.h" #include "Sim/Simulation/ScatteringSimulation.h" #include <QDateTime> @@ -48,29 +49,20 @@ void JobWorker::start() m_result.release(); emit started(); - if (m_simulation) { + try { + m_job_status = JobStatus::Running; + ASSERT(m_simulation); m_simulation->subscribe([this](size_t percentage_done) { return updateProgress(static_cast<int>(percentage_done)); }); - - m_job_status = JobStatus::Running; - - try { - SimulationResult result = m_simulation->simulate(); - if (m_job_status != JobStatus::Canceled) - m_job_status = JobStatus::Completed; - m_result = std::make_unique<SimulationResult>(result); - } catch (const std::exception& ex) { - m_job_status = JobStatus::Failed; - m_percentage_done = 100; - m_failure_message = "JobRunner::start -> ISimulation failed with exception throw:\n\n"; - - m_failure_message.append(QString(ex.what())); - } - } else { + SimulationResult result = m_simulation->simulate(); + if (m_job_status != JobStatus::Canceled) + m_job_status = JobStatus::Completed; + m_result = std::make_unique<SimulationResult>(result); + } catch (const std::exception& ex) { m_job_status = JobStatus::Failed; m_percentage_done = 100; - m_failure_message = "JobRunner::start -> Error. ISimulation doesn't exist."; + m_failure_message = ex.what(); } m_simulation_end = QDateTime::currentDateTime(); -- GitLab From d76cbec6eb32386035754a6c39a5928480608ee5 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Thu, 23 Mar 2023 17:40:30 +0100 Subject: [PATCH 05/13] Failed assertion throws runtime_error; message box moved to GUI main loop try..catch wrapper --- App/CMakeLists.txt | 2 +- App/MessageHandler.cpp | 51 ------------------------------------------ App/MessageHandler.h | 22 ------------------ App/main.cpp | 26 ++++++++++----------- Base/Util/Assert.cpp | 19 ---------------- Base/Util/Assert.h | 23 +++++-------------- 6 files changed, 18 insertions(+), 125 deletions(-) delete mode 100644 App/MessageHandler.cpp delete mode 100644 App/MessageHandler.h delete mode 100644 Base/Util/Assert.cpp diff --git a/App/CMakeLists.txt b/App/CMakeLists.txt index 29e139099e6..eda9c53e98a 100644 --- a/App/CMakeLists.txt +++ b/App/CMakeLists.txt @@ -8,7 +8,7 @@ else() set(executable_name bornagain) endif() -set(source_files main.cpp AppOptions.cpp MessageHandler.cpp) +set(source_files main.cpp AppOptions.cpp) # ----------------------------------------------------------------------------- # Qt configuration diff --git a/App/MessageHandler.cpp b/App/MessageHandler.cpp deleted file mode 100644 index 84c8cc6c447..00000000000 --- a/App/MessageHandler.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// ************************************************************************************************ -// -// BornAgain: simulate and fit reflection and scattering -// -//! @file App/MessageHandler.cpp -//! @brief Implements function MessageHandler -//! -//! @homepage http://www.bornagainproject.org -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2018 -//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS) -// -// ************************************************************************************************ - -#include "App/MessageHandler.h" -#include <QMessageBox> -#include <iostream> - -//! This is set by main to be the message handler of our GUI. -void messageHandler(QtMsgType type, const QMessageLogContext&, const QString& msg) -{ - switch (type) { - case QtDebugMsg: - if (msg.size() == 0) // KDE will pass a zero-length msg qstring - break; - std::cerr << "DEBUG: " << msg.toStdString() << std::endl; - break; - case QtInfoMsg: - std::cerr << "INFO: " << msg.toStdString() << std::endl; - break; - case QtWarningMsg: - default: - if (msg.left(4) == "QXcb") - return; - std::cerr << "WARNING: " << msg.toStdString() << std::endl; - // QMessageBox::warning(QApplication::activeWindow(), qAppName(), msg); - break; - case QtFatalMsg: - std::cerr << "FATAL: " << msg.toStdString() << std::endl; - qApp->restoreOverrideCursor(); - QMessageBox msgbox(QMessageBox::Critical, "BornAgain: fatal bug", - "Sorry, you encountered a fatal bug.\n" - "The application will terminate.\n" - "Please note the following and inform the maintainers.\n\n" - + msg + "\n", - QMessageBox::Ok, QApplication::activeWindow()); - msgbox.exec(); - qApp->quit(); - exit(1); - } -} diff --git a/App/MessageHandler.h b/App/MessageHandler.h deleted file mode 100644 index cfcd54a0a87..00000000000 --- a/App/MessageHandler.h +++ /dev/null @@ -1,22 +0,0 @@ -// ************************************************************************************************ -// -// BornAgain: simulate and fit reflection and scattering -// -//! @file App/MessageHandler.h -//! @brief Declares function MessageHandler -//! -//! @homepage http://www.bornagainproject.org -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2018 -//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS) -// -// ************************************************************************************************ - -#ifndef BORNAGAIN_APP_MESSAGEHANDLER_H -#define BORNAGAIN_APP_MESSAGEHANDLER_H - -#include <QApplication> - -void messageHandler(QtMsgType type, const QMessageLogContext&, const QString& msg); - -#endif // BORNAGAIN_APP_MESSAGEHANDLER_H diff --git a/App/main.cpp b/App/main.cpp index ae887e8c7c3..4b374e71fb0 100644 --- a/App/main.cpp +++ b/App/main.cpp @@ -13,7 +13,6 @@ // ************************************************************************************************ #include "App/AppOptions.h" -#include "App/MessageHandler.h" #include "Base/Util/Assert.h" #include "GUI/Application/ApplicationSettings.h" #include "GUI/Support/Util/Path.h" @@ -21,6 +20,7 @@ #include "GUI/View/Main/MainWindow.h" #include "GUI/View/Tool/Globals.h" #include "config_build.h" +#include <QApplication> #include <QDir> #include <QIcon> #include <QLocale> @@ -28,15 +28,6 @@ #include <QMetaType> #include <QtGlobal> -auto guiFailedAssertion = [](std::string msg) { -#ifdef BA_DEBUG - std::cerr << "FATAL (catched in debug mode): " << msg << std::endl; - std::raise(11); // abort so that we can inspect the backtrace -#else - qFatal("%s", msg.c_str()); -#endif -}; - int main(int argc, char* argv[]) { ApplicationOptions options(argc, argv); @@ -54,9 +45,6 @@ int main(int argc, char* argv[]) ApplicationSettings applicationSettings; - qInstallMessageHandler(messageHandler); - failedAssertion = guiFailedAssertion; - register1DDataLoaders(); auto style = applicationSettings.styleToUse(); @@ -74,5 +62,15 @@ int main(int argc, char* argv[]) win.loadProject(options.projectFile()); win.show(); - return QApplication::exec(); + try { + return QApplication::exec(); + } catch (const std::exception& ex) { + QMessageBox msgbox(QMessageBox::Critical, "BornAgain: fatal bug", + QString("Sorry, you encountered a fatal bug.\n" + "The application will terminate.\n" + "Please note the following and inform the maintainers.\n\n") + + ex.what() + "\n", + QMessageBox::Ok, QApplication::activeWindow()); + msgbox.exec(); + } } diff --git a/Base/Util/Assert.cpp b/Base/Util/Assert.cpp deleted file mode 100644 index 39ede6f9478..00000000000 --- a/Base/Util/Assert.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// ************************************************************************************************ -// -// BornAgain: simulate and fit reflection and scattering -// -//! @file Base/Util/Assert.cpp -//! @brief Initializes function failedAssertion -//! -//! @homepage http://www.bornagainproject.org -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2018 -//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS) -// -// ************************************************************************************************ - -#include "Base/Util/Assert.h" - -std::function<void(std::string)> failedAssertion = [](std::string msg) { - throw std::runtime_error(msg); -}; diff --git a/Base/Util/Assert.h b/Base/Util/Assert.h index 1c4a66c3563..6a6e4116bef 100644 --- a/Base/Util/Assert.h +++ b/Base/Util/Assert.h @@ -19,22 +19,13 @@ #define BORNAGAIN_BASE_UTIL_ASSERT_H #include "Wrap/WinDllMacros.h" -#include <functional> #include <string> -// Function called upon failed assert; set in Assert.cpp, overriden by GUI. -extern BA_BASE_API_ std::function<void(std::string)> failedAssertion; - // ASSERT macro: terminate if condition is false. // // Implementation notes: // - Must be declared as a macro, not a function, so that we can use preprocessor // macros for informative error messages. -// - Must terminate with a throw statement to prevent compiler warning -Wreturn-type. -// - In the GUI, the function pointer failedAssertion will be reset to call qFatal, -// which then pops up a message window (as defined by qInstallMessageHandler). -// - No direct call to qFatal here, because we do not want core to depend on Qt, -// lest Python wheel becomes too difficult. #ifdef BA_DEBUG @@ -42,23 +33,19 @@ extern BA_BASE_API_ std::function<void(std::string)> failedAssertion; #include <iostream> #define ASSERT(condition) \ if (!(condition)) { \ - std::cerr << "Assertion " << (#condition) << " failed in " << __FILE__ << ", line " \ - << __LINE__ << std::endl; \ + std::cerr << "Assertion " #condition " failed in " __FILE__ ", line " << __LINE__ \ + << std::endl; \ std::raise(SIGTERM); /* abort so that we can inspect the backtrace */ \ throw std::runtime_error("Assertion failed ... and we should never get here"); \ } #else -#include <sstream> #include <stdexcept> #define ASSERT(condition) \ - if (!(condition)) { \ - std::stringstream msg; \ - msg << "Assertion " << (#condition) << " failed in " << __FILE__ << ", line " << __LINE__; \ - failedAssertion(msg.str()); \ - throw std::runtime_error("Assertion failed ... and we should never get here"); \ - } + if (!(condition)) \ + throw std::runtime_error("Assertion " #condition " failed in " __FILE__ ", line " \ + + std::to_string(__LINE__)); #endif // BA_DEBUG -- GitLab From 6e3201d4d45606fb2db0d208e0e777a34109a2ee Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Thu, 23 Mar 2023 17:54:21 +0100 Subject: [PATCH 06/13] corr include --- GUI/View/Loaders/AutomaticDataLoader1D.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/GUI/View/Loaders/AutomaticDataLoader1D.cpp b/GUI/View/Loaders/AutomaticDataLoader1D.cpp index b2c91716eb3..e93bb5abcdd 100644 --- a/GUI/View/Loaders/AutomaticDataLoader1D.cpp +++ b/GUI/View/Loaders/AutomaticDataLoader1D.cpp @@ -20,6 +20,7 @@ #include "GUI/Support/IO/ImportDataInfo.h" #include "GUI/Support/XML/DeserializationException.h" #include "GUI/View/Loaders/AutomaticDataLoader1DResultModel.h" +#include <sstream> QString AutomaticDataLoader1D::name() const { -- GitLab From b091a7895637dca4ba4af0bf797d4367df78e33d Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Fri, 24 Mar 2023 13:21:56 +0100 Subject: [PATCH 07/13] use QApplication instance; set return values --- App/main.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/App/main.cpp b/App/main.cpp index 4b374e71fb0..aa5d01f0d46 100644 --- a/App/main.cpp +++ b/App/main.cpp @@ -36,11 +36,11 @@ int main(int argc, char* argv[]) qRegisterMetaType<QVector<double>>("QVector<double>"); QApplication app(argc, argv); - QApplication::setApplicationName("BornAgain"); - QApplication::setApplicationVersion(GUI::Util::Path::getBornAgainVersionString()); - QApplication::setOrganizationName("BornAgain"); + app.setApplicationName("BornAgain"); + app.setApplicationVersion(GUI::Util::Path::getBornAgainVersionString()); + app.setOrganizationName("BornAgain"); #ifndef Q_OS_MAC - QApplication::setWindowIcon(QIcon(":/images/BornAgain.ico")); + app.setWindowIcon(QIcon(":/images/BornAgain.ico")); #endif ApplicationSettings applicationSettings; @@ -62,8 +62,9 @@ int main(int argc, char* argv[]) win.loadProject(options.projectFile()); win.show(); + int ret = -1; try { - return QApplication::exec(); + ret = app.exec(); } catch (const std::exception& ex) { QMessageBox msgbox(QMessageBox::Critical, "BornAgain: fatal bug", QString("Sorry, you encountered a fatal bug.\n" @@ -72,5 +73,7 @@ int main(int argc, char* argv[]) + ex.what() + "\n", QMessageBox::Ok, QApplication::activeWindow()); msgbox.exec(); + return 1; } + return ret; } -- GitLab From 79a3dec67ff61c1bcfdf65a7b48de169dcf2462e Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Fri, 24 Mar 2023 15:12:32 +0100 Subject: [PATCH 08/13] Failed assert also writes to stderr. Extended try block in main.cpp. MsgBox launched from newly created app. --- App/main.cpp | 45 +++++++++++++++++++++++---------------------- Base/Util/Assert.h | 9 +++++++-- 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/App/main.cpp b/App/main.cpp index aa5d01f0d46..e9fcf9b959f 100644 --- a/App/main.cpp +++ b/App/main.cpp @@ -35,43 +35,44 @@ int main(int argc, char* argv[]) QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates)); qRegisterMetaType<QVector<double>>("QVector<double>"); - QApplication app(argc, argv); - app.setApplicationName("BornAgain"); - app.setApplicationVersion(GUI::Util::Path::getBornAgainVersionString()); - app.setOrganizationName("BornAgain"); + int ret = -1; + try { + QApplication app(argc, argv); + app.setApplicationName("BornAgain"); + app.setApplicationVersion(GUI::Util::Path::getBornAgainVersionString()); + app.setOrganizationName("BornAgain"); #ifndef Q_OS_MAC - app.setWindowIcon(QIcon(":/images/BornAgain.ico")); + app.setWindowIcon(QIcon(":/images/BornAgain.ico")); #endif - ApplicationSettings applicationSettings; + ApplicationSettings applicationSettings; - register1DDataLoaders(); + register1DDataLoaders(); - auto style = applicationSettings.styleToUse(); - applicationSettings.loadStyle(style); + auto style = applicationSettings.styleToUse(); + applicationSettings.loadStyle(style); - QString dir = GUI::Util::Path::appDataFolder(); - if (!QDir().exists(dir)) - QDir().mkpath(dir); + QString dir = GUI::Util::Path::appDataFolder(); + if (!QDir().exists(dir)) + QDir().mkpath(dir); - MainWindow win; - GUI::Global::mainWindow = &win; - if (options.find("geometry")) - win.resize(options.mainWindowSize()); - if (options.find("project-file")) - win.loadProject(options.projectFile()); - win.show(); + MainWindow win; + GUI::Global::mainWindow = &win; + if (options.find("geometry")) + win.resize(options.mainWindowSize()); + if (options.find("project-file")) + win.loadProject(options.projectFile()); + win.show(); - int ret = -1; - try { ret = app.exec(); } catch (const std::exception& ex) { + QApplication app(argc, argv); QMessageBox msgbox(QMessageBox::Critical, "BornAgain: fatal bug", QString("Sorry, you encountered a fatal bug.\n" "The application will terminate.\n" "Please note the following and inform the maintainers.\n\n") + ex.what() + "\n", - QMessageBox::Ok, QApplication::activeWindow()); + QMessageBox::Ok, nullptr); msgbox.exec(); return 1; } diff --git a/Base/Util/Assert.h b/Base/Util/Assert.h index 6a6e4116bef..86a40bb38a0 100644 --- a/Base/Util/Assert.h +++ b/Base/Util/Assert.h @@ -41,11 +41,16 @@ #else +#include <iostream> #include <stdexcept> #define ASSERT(condition) \ - if (!(condition)) \ + if (!(condition)) { \ + std::cerr << "Throwing runtime_error: Assertion " #condition " failed in " __FILE__ \ + ", line " \ + << __LINE__ << std::endl; \ throw std::runtime_error("Assertion " #condition " failed in " __FILE__ ", line " \ - + std::to_string(__LINE__)); + + std::to_string(__LINE__)); \ + } #endif // BA_DEBUG -- GitLab From ddfd5a0fdf8a9b81f4a9cde3337352b5c6f72bd1 Mon Sep 17 00:00:00 2001 From: AlQuemist <alquemist@Lyriks> Date: Fri, 24 Mar 2023 14:08:17 +0100 Subject: [PATCH 09/13] Linux-CI: add extra dependencies (libdeflate, libwebp and libLerc) for libtiff --- devtools/deploy/linux/adjust_pkg_linux.sh.in | 2 +- devtools/deploy/linux/mk_pypack_linux.sh.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/devtools/deploy/linux/adjust_pkg_linux.sh.in b/devtools/deploy/linux/adjust_pkg_linux.sh.in index c08fae4afe9..f155f361737 100644 --- a/devtools/deploy/linux/adjust_pkg_linux.sh.in +++ b/devtools/deploy/linux/adjust_pkg_linux.sh.in @@ -57,7 +57,7 @@ echo "$TITLE: package root = '$pkg_root_dir', " \ # libraries allowed to be included in the package libs_inc_re='cerf|formfactor|gsl|fftw|boost|tiff|jpeg|jbig|Qt' # compression libraries -libs_inc_re=${libs_inc_re}'|zstd|lzma|deflate|bz2' +libs_inc_re=${libs_inc_re}'|zstd|lzma|deflate|bz2|Lerc' # secondary dependencies # X11 interface (libQt5XcbQpa): libs_inc_re=${libs_inc_re}'|XcbQpa|xcb-xinerama|xcb-xinput' diff --git a/devtools/deploy/linux/mk_pypack_linux.sh.in b/devtools/deploy/linux/mk_pypack_linux.sh.in index 57f37149027..ca77ba50745 100644 --- a/devtools/deploy/linux/mk_pypack_linux.sh.in +++ b/devtools/deploy/linux/mk_pypack_linux.sh.in @@ -48,7 +48,7 @@ fi echo "$TITLE: library directories = '$libdir', '$xlibdir'" # libraries allowed to be included in the package -libs_inc_re='cerf|formfactor|gsl|fftw|boost|zstd|lzma|bz2|tiff|jpeg|jbig' +libs_inc_re='cerf|formfactor|gsl|fftw|boost|zstd|lzma|bz2|tiff|jpeg|jbig|deflate|webp|Lerc' # extract dependency names and locations from the raw output of `ldd` # NOTE: ldd returns all dependencies recursively. -- GitLab From a7a506b37e841a0e13b67706dd3d210db8610bc8 Mon Sep 17 00:00:00 2001 From: AlQuemist <alquemist@Lyriks> Date: Fri, 24 Mar 2023 14:13:10 +0100 Subject: [PATCH 10/13] GitLab-CI: minor cleanup of Windows section --- .gitlab-ci.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 76ed2ea2c6a..b3ce2545281 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -108,14 +108,12 @@ windows: - $QT_MSVC_DIR = "C:/Qt/6.2.4/msvc2019_64" - $QTCMake_DIR = "$QT_MSVC_DIR/lib/cmake" - $BUILD_DIR = "build" - - echo "# Pythonpath1 <$Env:PYTHONPATH>" - - echo "# CI_PRJ_DIR <$Env:CI_PROJECT_DIR>" - - $env:PYTHONPATH += "$CI_PROJECT_DIR/build/lib" # change the system PATH temporarily (needed for tests) + - $env:PYTHONPATH += "$CI_PROJECT_DIR/build/lib" - $env:PATH = "$QT_MSVC_DIR/bin;$env:PATH" - - echo "# Pythonpath2 <$Env:PYTHONPATH>" # list powershell properties - - echo "# Path <$Env:Path>" + - echo "# Path '<$Env:Path>'" + - echo "# PythonPath '<$Env:PYTHONPATH>'" - echo "# Powershell <$PSHOME>`n PS Profile <$PROFILE>`n PS Command-Path <$PSCOMMANDPATH>" # list all environmental variables - 'dir Env:' -- GitLab From ac95af06710a734c6d1500e9d43af52fc61a4621 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Fri, 24 Mar 2023 17:11:13 +0100 Subject: [PATCH 11/13] Extend message on failed assertion: 'BUG:', 'Please report ...' --- Base/Util/Assert.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Base/Util/Assert.h b/Base/Util/Assert.h index 86a40bb38a0..0ea4d52899c 100644 --- a/Base/Util/Assert.h +++ b/Base/Util/Assert.h @@ -48,8 +48,12 @@ std::cerr << "Throwing runtime_error: Assertion " #condition " failed in " __FILE__ \ ", line " \ << __LINE__ << std::endl; \ - throw std::runtime_error("Assertion " #condition " failed in " __FILE__ ", line " \ - + std::to_string(__LINE__)); \ + throw std::runtime_error("BUG: Assertion " #condition " failed in " __FILE__ ", line " \ + + std::to_string(__LINE__) \ + + ".\n" \ + "Please report this to the maintainers:\n" \ + "- https://jugit.fz-juelich.de/mlz/bornagain/-/issues/new or\n" \ + "- contact@bornagainproject.org."); \ } #endif // BA_DEBUG -- GitLab From 7713c45ec59b61857b886e56d7dfdbee5be455ef Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Sun, 26 Mar 2023 12:25:10 +0200 Subject: [PATCH 12/13] hugo config corr baseURL --- hugo/config.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hugo/config.toml b/hugo/config.toml index b8fdec5fa8a..96fc532e2dc 100644 --- a/hugo/config.toml +++ b/hugo/config.toml @@ -1,4 +1,6 @@ -baseURL = "https://bornagainproject.org/git-main" +# baseURL terminates with version number or "git-main" +baseURL = "https://bornagainproject.org/20.0" + languageCode = "en-us" title = "BornAgain" MetaDataFormat = "toml" -- GitLab From 9c4956fed81ece92af8afd5886ddafc865c2fb74 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Sun, 26 Mar 2023 12:54:26 +0200 Subject: [PATCH 13/13] hugo config revert version to git-main --- hugo/config.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hugo/config.toml b/hugo/config.toml index 96fc532e2dc..7b94cf7a190 100644 --- a/hugo/config.toml +++ b/hugo/config.toml @@ -1,5 +1,5 @@ # baseURL terminates with version number or "git-main" -baseURL = "https://bornagainproject.org/20.0" +baseURL = "https://bornagainproject.org/git-main" languageCode = "en-us" title = "BornAgain" @@ -21,7 +21,7 @@ PygmentsStyle = "vs" release_number = "20.0" # version name is either release_number or "git-main" - version_name = "20.0" + version_name = "git-main" recommended_python_major = "3" recommended_python_minor = "9" -- GitLab