diff --git a/.clang-tidy b/.clang-tidy index fc9cb947657c7be57b9fabea3cad8ae4db576813..5385a84890e695dea88dec082b85ffa65dabf9e6 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -13,10 +13,8 @@ Checks: ' bugprone-copy-constructor-init, bugprone-exception-escape, bugprone-misplaced-widening-cast, -bugprone-unused-return-value, clang-analyzer-optin.cplusplus.VirtualCall, cppcoreguidelines-explicit-virtual-functions, -cppcoreguidelines-prefer-member-initializer, cppcoreguidelines-pro-type-const-cast, hicpp-move-const-arg, llvm-qualified-auto, diff --git a/Base/Axis/Frame.cpp b/Base/Axis/Frame.cpp index 78620cedf12a7dfad4a7fc5cb3ac30fa7ce7573c..9b226387c57508e5a40a2e0f0f4c4195e99b99c3 100644 --- a/Base/Axis/Frame.cpp +++ b/Base/Axis/Frame.cpp @@ -140,7 +140,7 @@ Frame* Frame::plottableFrame() const auto* s = new Scale(axis(k).plottableScale()); outaxes.emplace_back(s); } - return new Frame(std::move(outaxes)); + return new Frame(outaxes); } Frame* Frame::angularFrame(double lambda, double alpha_i) const @@ -169,5 +169,5 @@ Frame* Frame::flat() const for (const Scale* s : m_axes) if (s->size() > 1) outaxes.emplace_back(s->clone()); - return new Frame(std::move(outaxes)); + return new Frame(outaxes); } diff --git a/CMakeLists.txt b/CMakeLists.txt index 63a8c910fe8568e151b99b4a067c9fd895ab7da9..4ec59c6f43be63cf27a6b1af1e30cac9ebd8e81b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -160,6 +160,7 @@ endif() if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(CLANG ON) + string(APPEND CMAKE_CXX_FLAGS " -Wno-misleading-indentation") elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") set(GCC ON) string(APPEND CMAKE_CXX_FLAGS " -fdiagnostics-color=always") diff --git a/Device/Data/Datafield.cpp b/Device/Data/Datafield.cpp index c4995e38c04684428152c4660358737aea1f1c94..76bc5caa8feb3fd2bf478b2c0a1f653a1fe3d236 100644 --- a/Device/Data/Datafield.cpp +++ b/Device/Data/Datafield.cpp @@ -286,7 +286,7 @@ Datafield* Datafield::crop(double xmin, double ymin, double xmax, double ymax) c const Scale* xclipped = xAxis().clipped(xmin, xmax).clone(); const Scale* yclipped = yAxis().clipped(ymin, ymax).clone(); - Frame* outframe = new Frame(xclipped, yclipped); + const auto* outframe = new Frame(xclipped, yclipped); ASSERT(outframe->size() == out.size()); return new Datafield(outframe, out); @@ -308,7 +308,7 @@ Datafield* Datafield::crop(double xmin, double xmax) const } } const Scale* xclipped = xAxis().clipped(xmin, xmax).clone(); - Frame* outframe = new Frame(xclipped); + const auto* outframe = new Frame(xclipped); ASSERT(outframe->xAxis().size() == out.size()); return new Datafield(outframe, out, errout); diff --git a/Device/IO/ReadWrite2DTable.cpp b/Device/IO/ReadWrite2DTable.cpp index 6ca49a3043c56fbf74dc965d60b4f3a11b8edc66..51282614b670fc2377305e87bd6d67120e20a835 100644 --- a/Device/IO/ReadWrite2DTable.cpp +++ b/Device/IO/ReadWrite2DTable.cpp @@ -137,9 +137,9 @@ Datafield readBareIntensity(std::istream& input_stream) } // namespace -Datafield Util::RW::read2DTable(std::istream& input_stream, const ImportSettings2D* p) +Datafield Util::RW::read2DTable(std::istream& input_stream, const ImportSettings2D* pars) { - if (!p || !p->has_axes) + if (!pars || !pars->has_axes) return readBareIntensity(input_stream); // read table with axes info @@ -156,19 +156,19 @@ Datafield Util::RW::read2DTable(std::istream& input_stream, const ImportSettings std::vector<double> q_row(data.front().size()); std::vector<double> q_col(data.size()); - q_row = p->first_row ? data.front() : data.back(); + q_row = pars->first_row ? data.front() : data.back(); for (size_t i = 0; i < nrows; i++) - q_col[i] = p->first_col ? data[i].front() : data[i].back(); + q_col[i] = pars->first_col ? data[i].front() : data[i].back(); // remove redundant elements from axes and data - if (p->first_row) { + if (pars->first_row) { q_col.erase(q_col.begin()); data.erase(data.begin()); } else { q_col.pop_back(); data.pop_back(); } - if (p->first_col) { + if (pars->first_col) { q_row.erase(q_row.begin()); for (auto& row : data) row.erase(row.begin()); @@ -203,16 +203,16 @@ Datafield Util::RW::read2DTable(std::istream& input_stream, const ImportSettings // scale axes double fac = 1.; - Coordinate xOutCoord = p->xCoord; - Coordinate yOutCoord = p->yCoord; - if (p->xCoord.unit() == "1/angstrom") { + Coordinate xOutCoord = pars->xCoord; + Coordinate yOutCoord = pars->yCoord; + if (pars->xCoord.unit() == "1/angstrom") { fac = 10; - xOutCoord = {p->xCoord.name(), "1/nm"}; - yOutCoord = {p->yCoord.name(), "1/nm"}; - } else if (p->xCoord.unit() == "deg") { + xOutCoord = {pars->xCoord.name(), "1/nm"}; + yOutCoord = {pars->yCoord.name(), "1/nm"}; + } else if (pars->xCoord.unit() == "deg") { fac = pi / 180.; - xOutCoord = {p->xCoord.name(), "rad"}; - yOutCoord = {p->yCoord.name(), "rad"}; + xOutCoord = {pars->xCoord.name(), "rad"}; + yOutCoord = {pars->yCoord.name(), "rad"}; } for (auto& q : q_row) q *= fac; @@ -220,9 +220,9 @@ Datafield Util::RW::read2DTable(std::istream& input_stream, const ImportSettings q *= fac; // interpret axes - std::vector<double> qy = p->swap_axes ? q_col : q_row; - std::vector<double> qz = p->swap_axes ? q_row : q_col; - if (p->swap_axes) + std::vector<double> qy = pars->swap_axes ? q_col : q_row; + std::vector<double> qz = pars->swap_axes ? q_row : q_col; + if (pars->swap_axes) data = DataUtil::transpose(data); // flatten values diff --git a/Device/IO/ReadWrite2DTable.h b/Device/IO/ReadWrite2DTable.h index 227206fa16f267e83badd6ccf834a1650587fae0..82d4fd704d1ae4713ab1a979f6de453a536e4140 100644 --- a/Device/IO/ReadWrite2DTable.h +++ b/Device/IO/ReadWrite2DTable.h @@ -26,7 +26,7 @@ struct ImportSettings2D; namespace Util::RW { //! Reads 2D table from ASCII file. -Datafield read2DTable(std::istream& input_stream, const ImportSettings2D* importSettings = nullptr); +Datafield read2DTable(std::istream& input_stream, const ImportSettings2D* pars = nullptr); //! Writes Datafield to ASCII file with 2D table layout as in numpy.savetxt. void write2DTable(const Datafield& data, std::ostream& output_stream); diff --git a/GUI/Model/Detector/DetectorItem.cpp b/GUI/Model/Detector/DetectorItem.cpp index 803b88cdcaf91bed266821c14882f0e4125ac414..da9fedc60e2fa6370be556f55fc5fc648c9f5955 100644 --- a/GUI/Model/Detector/DetectorItem.cpp +++ b/GUI/Model/Detector/DetectorItem.cpp @@ -70,9 +70,9 @@ std::unique_ptr<IDetector> DetectorItem::createDetector() const auto result = std::make_unique<Detector2D>(x_wid, y_wid, n_x, n_y, x_cen, y_cen); if (m_masks) { - for (const auto m : *m_masks) { + for (const auto* m : *m_masks) { if (m->isVisible()) { - if (auto* ii = dynamic_cast<const RegionOfInterestItem*>(m)) { + if (const auto* ii = dynamic_cast<const RegionOfInterestItem*>(m)) { result->setRegionOfInterest(ii->xLow(), ii->yLow(), ii->xUp(), ii->yUp()); } else { std::unique_ptr<IShape2D> shape(m->createShape()); diff --git a/GUI/Model/File/DatafileItem.cpp b/GUI/Model/File/DatafileItem.cpp index 3e6785c465fdce8b107078ee40a290aa9c9aca85..a9d7bd98eee3ae98374ed2a59bb624da334f4337 100644 --- a/GUI/Model/File/DatafileItem.cpp +++ b/GUI/Model/File/DatafileItem.cpp @@ -59,7 +59,7 @@ DatafileItem::~DatafileItem() = default; DatafileItem* DatafileItem::clone() const { - DatafileItem* result = new DatafileItem; + auto* result = new DatafileItem; GUI::Util::copyContents(this, result); if (m_data_item) result->m_data_item->setDatafield(*m_data_item->c_field()); diff --git a/GUI/Model/Type/NamedItem.cpp b/GUI/Model/Type/NamedItem.cpp index de9c0ac25a8127d0b2657da3414533ba2d066f06..3ade16a0d729438499755dfd428cb50e16b87bce 100644 --- a/GUI/Model/Type/NamedItem.cpp +++ b/GUI/Model/Type/NamedItem.cpp @@ -41,7 +41,7 @@ void NamedItem::renumber(const QStringList& extant_names) // Determine highest number for given stem in extant_items int imax = 0; - for (QString tname : extant_names) { + for (const QString& tname : extant_names) { QStringList ts = ::splitName(tname); if (ts.isEmpty()) { if (tname == stem) diff --git a/GUI/View/Canvas/MaskEditorCanvas.cpp b/GUI/View/Canvas/MaskEditorCanvas.cpp index b9c2e2e3a007c57fbd8a3b4c25932b8119d62b03..1deac05845c476c5e27d92ff8396af98e0b7b94e 100644 --- a/GUI/View/Canvas/MaskEditorCanvas.cpp +++ b/GUI/View/Canvas/MaskEditorCanvas.cpp @@ -38,7 +38,7 @@ Datafield* createMaskedField(const Data2DItem* data) MaskStack detectorMask; for (const MaskItem* t : *data->masks()) { if (t->isVisible()) { - if (auto* roiItem = dynamic_cast<const RegionOfInterestItem*>(t)) + if (const auto* roiItem = dynamic_cast<const RegionOfInterestItem*>(t)) roi = roiItem->createShape(); else { std::unique_ptr<IShape2D> shape(t->createShape()); @@ -155,7 +155,7 @@ void MaskEditorCanvas::onPresentationChange(bool pixelized) m_data_item->setInterpolated(m_backup_interpolated); } - if (auto* container = m_data_item->masks()) + if (const auto* container = m_data_item->masks()) for (MaskItem* t : *container) t->setIsVisible(!pixelized && t->wasVisible()); } diff --git a/GUI/View/FitControl/FitObjectiveBuilder.cpp b/GUI/View/FitControl/FitObjectiveBuilder.cpp index a7bcf68823c1837026eca2d4792a2fa4ea9fe04a..f71788f87baf26c06267f30945c780fd96473f53 100644 --- a/GUI/View/FitControl/FitObjectiveBuilder.cpp +++ b/GUI/View/FitControl/FitObjectiveBuilder.cpp @@ -76,7 +76,7 @@ std::unique_ptr<FitObjective> FitObjectiveBuilder::createFitObjective() const return buildSimulation(params); }; - auto* dfile_item = m_job_item->dfileItem(); + const auto* dfile_item = m_job_item->dfileItem(); ASSERT(dfile_item); const DataItem* intensity_item = dfile_item->dataItem(); diff --git a/GUI/View/FitControl/MinimizerEditor.cpp b/GUI/View/FitControl/MinimizerEditor.cpp index d61087bb9e4ce9a3f9cc4d2fd9c4dc19400be1ec..249423cdf90a12454a1599b5f6dc8b10c4d084b4 100644 --- a/GUI/View/FitControl/MinimizerEditor.cpp +++ b/GUI/View/FitControl/MinimizerEditor.cpp @@ -41,13 +41,13 @@ void MinimizerEditor::setJobItem(JobItem* job_item) setMinContainerItem(job_item->fitSuiteItem()->minimizerContainerItem()); } -void MinimizerEditor::setMinContainerItem(MinimizerContainerItem* containerItem) +void MinimizerEditor::setMinContainerItem(MinimizerContainerItem* container_item) { - ASSERT(containerItem); + ASSERT(container_item); GUI::Util::Layout::clearLayout(m_main_layout); m_updaters.clear(); - m_container_item = containerItem; + m_container_item = container_item; if (!m_container_item) return; diff --git a/GUI/View/FitControl/MinimizerEditor.h b/GUI/View/FitControl/MinimizerEditor.h index 4bbcab0e9c428a407516a9fc23cda2d8de42eef6..c3cfe4683305ba4e5feba4ccf9b2bc828cad476c 100644 --- a/GUI/View/FitControl/MinimizerEditor.h +++ b/GUI/View/FitControl/MinimizerEditor.h @@ -30,8 +30,8 @@ public: MinimizerEditor(QWidget* parent = nullptr); public slots: - void setJobItem(JobItem* jobItem); - void setMinContainerItem(MinimizerContainerItem* containerItem); + void setJobItem(JobItem* job_item); + void setMinContainerItem(MinimizerContainerItem* container_item); private: void createGroupedAlgorithmsCombo(); diff --git a/GUI/View/Loader/ImportDialogs.cpp b/GUI/View/Loader/ImportDialogs.cpp index 9b4fcbdf168b5ad881d21fe5e0822b1a928c8c2c..2e00c2e45b8a7ee74556153eb5eda5973b4c207e 100644 --- a/GUI/View/Loader/ImportDialogs.cpp +++ b/GUI/View/Loader/ImportDialogs.cpp @@ -167,64 +167,64 @@ Import1dDialog::Import1dDialog(QWidget* parent, QString fname) Import2dDialog::Import2dDialog(QWidget* parent, QString fname) : ImportDialog(parent, fname) { - auto vbox = new QVBoxLayout; + auto* vbox = new QVBoxLayout; setLayout(vbox); - auto gridLayout = new QGridLayout; + auto* gridLayout = new QGridLayout; vbox->addLayout(gridLayout); - auto has_axes = new QCheckBox("Table contains axes"); + auto* has_axes = new QCheckBox("Table contains axes"); has_axes->setChecked(Msettings.has_axes); gridLayout->addWidget(has_axes, 0, 0); // connect statement is below, as it needs access to other widgets - auto swap_axes = new QCheckBox("Swap axes"); + auto* swap_axes = new QCheckBox("Swap axes"); swap_axes->setChecked(Msettings.swap_axes); gridLayout->addWidget(swap_axes, 1, 0); // row - auto row_label = new QLabel("Row:"); + auto* row_label = new QLabel("Row:"); gridLayout->addWidget(row_label, 2, 0); - auto row_first = new QRadioButton("first"); + auto* row_first = new QRadioButton("first"); row_first->setChecked(Msettings.first_row); gridLayout->addWidget(row_first, 2, 1); connect(row_first, &QRadioButton::toggled, [](bool b) { Msettings.first_row = b; }); - auto row_last = new QRadioButton("last"); + auto* row_last = new QRadioButton("last"); row_last->setChecked(!Msettings.first_row); gridLayout->addWidget(row_last, 2, 2); connect(row_last, &QRadioButton::toggled, [](bool b) { Msettings.first_row = !b; }); - auto row_group = new QButtonGroup; + auto* row_group = new QButtonGroup; row_group->addButton(row_first); row_group->addButton(row_last); // column - auto col_label = new QLabel("Column:"); + auto* col_label = new QLabel("Column:"); gridLayout->addWidget(col_label, 3, 0); - auto col_first = new QRadioButton("first"); + auto* col_first = new QRadioButton("first"); col_first->setChecked(Msettings.first_col); gridLayout->addWidget(col_first, 3, 1); connect(col_first, &QRadioButton::toggled, [](bool b) { Msettings.first_col = b; }); - auto col_last = new QRadioButton("last"); + auto* col_last = new QRadioButton("last"); col_last->setChecked(!Msettings.first_col); gridLayout->addWidget(col_last, 3, 2); connect(col_last, &QRadioButton::toggled, [](bool b) { Msettings.first_col = !b; }); - auto col_group = new QButtonGroup; + auto* col_group = new QButtonGroup; col_group->addButton(col_first); col_group->addButton(col_last); // Q units - auto form_l = new QFormLayout; + auto* form_l = new QFormLayout; vbox->addLayout(form_l); - auto unit_label = new QLabel("Axes are given in units of:"); + auto* unit_label = new QLabel("Axes are given in units of:"); const std::vector<std::string> xCoords{"qy (1/nm)", "qy (1/angstrom)", "phi_i (rad)", "phi_i (deg)"}; @@ -232,7 +232,7 @@ Import2dDialog::Import2dDialog(QWidget* parent, QString fname) "alpha_i (deg)"}; ASSERT(xCoords.size() == yCoords.size()); - auto qUnitCombo = new QComboBox; + auto* qUnitCombo = new QComboBox; form_l->addRow(unit_label, qUnitCombo); qUnitCombo->addItem("1/nm"); qUnitCombo->addItem("1/Ã…"); @@ -286,10 +286,10 @@ Import2dDialog::Import2dDialog(QWidget* parent, QString fname) }); has_axes->toggled(Msettings.has_axes); - auto buttonline = new QHBoxLayout; + auto* buttonline = new QHBoxLayout; vbox->addLayout(buttonline); - auto okButton = new QPushButton("OK"); + auto* okButton = new QPushButton("OK"); buttonline->addWidget(okButton); okButton->setDefault(true); connect(okButton, &QPushButton::clicked, this, &Import2dDialog::accept); diff --git a/GUI/View/Loader/ProjectionsSaver.cpp b/GUI/View/Loader/ProjectionsSaver.cpp index 568bbc9fdd67e1b737d3449eb9cf095cb25d0c85..59edb6e39e5be734e33bc720d698c0ca2a92c457 100644 --- a/GUI/View/Loader/ProjectionsSaver.cpp +++ b/GUI/View/Loader/ProjectionsSaver.cpp @@ -96,7 +96,7 @@ ProjectionsData projectionsData(Qt::Orientation projectionsType, const Data2DIte ProjectionsData result; result.is_horizontal = (projectionsType == Qt::Horizontal); - for (auto* item : projectionItems(projectionsType, data_item)) { + for (const auto* item : projectionItems(projectionsType, data_item)) { std::unique_ptr<Datafield> field; Projection data; diff --git a/GUI/View/Plotter/ProjectionsPlot.cpp b/GUI/View/Plotter/ProjectionsPlot.cpp index ed9b983457a0318b4f75a7298712e24b04f3041a..5a064edc3549ab8dc819ea759e26eb5ff321c6fb 100644 --- a/GUI/View/Plotter/ProjectionsPlot.cpp +++ b/GUI/View/Plotter/ProjectionsPlot.cpp @@ -170,7 +170,7 @@ void ProjectionsPlot::updateProjectionsData() void ProjectionsPlot::updateProjections() { ASSERT(m_data_item); - auto* all_prjns = m_data_item->prjns(); + const auto* all_prjns = m_data_item->prjns(); if (!all_prjns) return; for (const auto* prjn : *all_prjns) diff --git a/GUI/View/Sample/LayerForm.h b/GUI/View/Sample/LayerForm.h index 2ef2581ef6457637052b60074044e7229f4c17ff..34f750051b6d585562f288427d697a23fa89fdb6 100644 --- a/GUI/View/Sample/LayerForm.h +++ b/GUI/View/Sample/LayerForm.h @@ -31,8 +31,8 @@ public: LayerForm(QWidget* parent, LayerItem* layerItem, SampleEditorController* ec); void updateLayerPositionDependentElements(); - void onLayoutAdded(ParticleLayoutItem* layoutItem); - void onAboutToRemoveLayout(ParticleLayoutItem* layoutItem); + void onLayoutAdded(ParticleLayoutItem* t); + void onAboutToRemoveLayout(ParticleLayoutItem* t); LayerItem* layerItem() const { return m_layer; } void updateTitle(); void expand(); diff --git a/GUI/View/Sample/ParticleLayoutForm.cpp b/GUI/View/Sample/ParticleLayoutForm.cpp index c1f9ea165b958310aea6e51b283252c8d15b68b2..e7164e88b45c6883db0707f22a736514bb550a62 100644 --- a/GUI/View/Sample/ParticleLayoutForm.cpp +++ b/GUI/View/Sample/ParticleLayoutForm.cpp @@ -115,7 +115,7 @@ void ParticleLayoutForm::updateDensityValue() void ParticleLayoutForm::updateTitle(const LayerItem* layerItem) { - const auto layouts = layerItem->layoutItems(); + const auto& layouts = layerItem->layoutItems(); if (layouts.size() > 1) setTitle("Particle layout " + QString::number(Vec::indexOfPtr(m_layout_item, layouts) + 1)); else diff --git a/GUI/View/Sample/SampleEditor.h b/GUI/View/Sample/SampleEditor.h index cac47b6727886c4e3adfe5ca657ee48c5c96c279..8679e269451639ecb9398134a4a6ddeab6a0eed9 100644 --- a/GUI/View/Sample/SampleEditor.h +++ b/GUI/View/Sample/SampleEditor.h @@ -29,7 +29,7 @@ public: SampleEditor(); ~SampleEditor() override; - void setCurrentSample(SampleItem* sampleItem); + void setCurrentSample(SampleItem* t); signals: void requestViewInRealspace(Item3D* itemToShow); diff --git a/GUI/View/Scene/MaskGraphicsScene.cpp b/GUI/View/Scene/MaskGraphicsScene.cpp index 946bf2b053f0b5926533fd149f78258964eeef5e..3c7247755a20b54d0476d1f896af139f1cb57020 100644 --- a/GUI/View/Scene/MaskGraphicsScene.cpp +++ b/GUI/View/Scene/MaskGraphicsScene.cpp @@ -42,7 +42,7 @@ template <class T> bool areaContains(QVector<QGraphicsItem*> items) } // namespace -MaskGraphicsScene::MaskGraphicsScene() {} +MaskGraphicsScene::MaskGraphicsScene() = default; MaskGraphicsScene::~MaskGraphicsScene() = default; @@ -320,7 +320,7 @@ void MaskGraphicsScene::removeOverlay(OverlayItem* item) { if (auto it = m_mask2overlay.find(item); it != m_mask2overlay.end()) { // at first, delete views for the points of the PolygonItem - if (auto* polygon_item = dynamic_cast<const PolygonItem*>(item)) + if (const auto* polygon_item = dynamic_cast<const PolygonItem*>(item)) for (PointItem* point_item : polygon_item->points()) removeOverlay(point_item); diff --git a/GUI/View/Setup/MasksPanel.cpp b/GUI/View/Setup/MasksPanel.cpp index 7e2794eee73c0abcb3f1c918eb352cb9084cce16..8e9e54431167d84c920800532139b0bd87ed5952 100644 --- a/GUI/View/Setup/MasksPanel.cpp +++ b/GUI/View/Setup/MasksPanel.cpp @@ -43,7 +43,7 @@ void addSpinBox(MaskItem* mask, QFormLayout* layout, DoubleProperty& property) MasksPanel::MasksPanel(std::function<MasksSet*()> set_source, bool mask_not_prjn) - : m_set_source(set_source) + : m_set_source(std::move(set_source)) , m_set_view(new SetView(nullptr)) , m_mask_not_prjn(mask_not_prjn) { diff --git a/GUI/View/View/InstrumentView.cpp b/GUI/View/View/InstrumentView.cpp index 4e14331ad9e8f51a467f64d3c25daaf033abf643..853a22393787a014f7e7c09f220e435d7811a1e6 100644 --- a/GUI/View/View/InstrumentView.cpp +++ b/GUI/View/View/InstrumentView.cpp @@ -78,7 +78,7 @@ void InstrumentView::setToolbarActions(QToolBar* toolbar) //... New-instrument actions auto new_action = [this, toolbar](const QString& name, const QString& description) { - QAction* a = new QAction("New " + name, this); + auto* a = new QAction("New " + name, this); a->setIcon(QIcon(":/images/shape-square-plus.svg")); a->setToolTip("Add new " + description + " instrument with default settings"); toolbar->addAction(a); diff --git a/GUI/View/View/JobView.h b/GUI/View/View/JobView.h index 71c3a21f402e4df723043291b95059b47b1d0533..d8b73721617d5c266a780f1ac895323367427b24 100644 --- a/GUI/View/View/JobView.h +++ b/GUI/View/View/JobView.h @@ -47,7 +47,7 @@ public slots: void onJobSelectionChanged(); private slots: - void onJobSelected(JobItem* jobItem); + void onJobSelected(JobItem* job_item); private: JobItem* selectedJobItem(); diff --git a/Resample/Particle/ReCompound.cpp b/Resample/Particle/ReCompound.cpp index 47ab7e757a6ce5e676c9c8ca80f3ed17e951ea1f..f904affe1f8711c803b9663914f10cd61af8a7d4 100644 --- a/Resample/Particle/ReCompound.cpp +++ b/Resample/Particle/ReCompound.cpp @@ -96,7 +96,7 @@ bool ReCompound::consideredEqualTo(const IReParticle& ire) const if (!m_components[i]->consideredEqualTo(*other[i])) return false; - if (m_components.size() > 0) { + if (!m_components.empty()) { const R3 shift = posDiff(m_components.front()->position(), other.front()->position()); for (size_t i = 1; i < m_components.size(); i++) if (shift != posDiff(m_components[i]->position(), other[i]->position())) @@ -110,7 +110,7 @@ bool ReCompound::consideredEqualTo(const IReParticle& ire) const const R3* ReCompound::position() const { - if (m_components.size() == 0) + if (m_components.empty()) return nullptr; return m_components.front()->position(); diff --git a/Resample/Specular/ComputeFluxMagnetic.cpp b/Resample/Specular/ComputeFluxMagnetic.cpp index 882564dc1911abbe19b1f0e5ab3295cd2af9bc6f..cb2cf20fb64081b2a7d3f1c55d81929fafd1c9fc 100644 --- a/Resample/Specular/ComputeFluxMagnetic.cpp +++ b/Resample/Specular/ComputeFluxMagnetic.cpp @@ -183,7 +183,7 @@ std::vector<MatrixFlux> computeTR(const SliceStack& slices, const std::vector<co for (size_t i = N - 1; i > 0; --i) { const auto* roughness = slices.bottomRoughness(i); const double sigma = roughness ? roughness->sigma() : 0.; - const auto r_model = roughness ? roughness->roughnessModel() : nullptr; + const auto* r_model = roughness ? roughness->roughnessModel() : nullptr; // compute the 2x2 blocks of the transfer matrix const auto [sp, sm] = refractionMatrixBlocks(TR[i - 1], TR[i], sigma, r_model); @@ -289,7 +289,7 @@ SpinMatrix Compute::polarizedReflectivity(const SliceStack& slices, MatrixFlux tr_i = createCoeff(i - 1); const auto* roughness = slices.bottomRoughness(i - 1); const double sigma = roughness ? roughness->sigma() : 0.; - const auto r_model = roughness ? roughness->roughnessModel() : nullptr; + const auto* r_model = roughness ? roughness->roughnessModel() : nullptr; // compute the 2x2 blocks of the transfer matrix const auto [sp, sm] = ::refractionMatrixBlocks(tr_i, tr_i1, sigma, r_model); diff --git a/Resample/Specular/ComputeFluxScalar.cpp b/Resample/Specular/ComputeFluxScalar.cpp index 723ed05f202f95bd0bab10b3b94ba08359406fb0..10a158ff00135b448f53aa37108efb8cc4afbaf6 100644 --- a/Resample/Specular/ComputeFluxScalar.cpp +++ b/Resample/Specular/ComputeFluxScalar.cpp @@ -85,7 +85,7 @@ std::vector<Spinor> computeTR(const SliceStack& slices, const std::vector<comple const size_t jlast = X[i]; const auto* roughness = slices.bottomRoughness(jthis); const double sigma = roughness ? roughness->sigma() : 0.; - const auto r_model = roughness ? roughness->roughnessModel() : nullptr; + const auto* r_model = roughness ? roughness->roughnessModel() : nullptr; const auto [slp, slm] = transition(kz[jthis], kz[jlast], sigma, r_model); @@ -139,7 +139,7 @@ complex_t Compute::scalarReflectivity(const SliceStack& slices, const std::vecto for (size_t i = N - 1; i > 0; i--) { const auto* roughness = slices.bottomRoughness(i - 1); const double sigma = roughness ? roughness->sigma() : 0.; - const auto r_model = roughness ? roughness->roughnessModel() : nullptr; + const auto* r_model = roughness ? roughness->roughnessModel() : nullptr; const auto [sp, sm] = ::transition(kz[i - 1], kz[i], sigma, r_model); diff --git a/Sample/StandardSample/MagneticLayersBuilder.cpp b/Sample/StandardSample/MagneticLayersBuilder.cpp index d49c76fab7d9f9cc595c7008abb0c38c37ee0752..9f7bb09db1edd6187c201f6cbf33694f8d610c89 100644 --- a/Sample/StandardSample/MagneticLayersBuilder.cpp +++ b/Sample/StandardSample/MagneticLayersBuilder.cpp @@ -120,10 +120,10 @@ ExemplarySamples::createSimpleMagneticRotationWithRoughness(const std::string& r sigmaRoughness = 0.; } else if (roughnessKey == "Tanh") { sigmaRoughness = 2. * Units::angstrom; - roughnessModel.reset(new TanhRoughness); + roughnessModel = std::make_unique<TanhRoughness>(); } else if (roughnessKey == "Erf") { sigmaRoughness = 2. * Units::angstrom; - roughnessModel.reset(new ErfRoughness); + roughnessModel = std::make_unique<ErfRoughness>(); } else ASSERT_NEVER;