From 35a176f9b1901c8e59b040116d93a79071e2bd51 Mon Sep 17 00:00:00 2001 From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de> Date: Tue, 20 Jun 2023 14:26:00 +0200 Subject: [PATCH 01/10] forbid external, fronting and z-field --- Resample/Slice/Slice.cpp | 4 ++++ Resample/Slice/SliceStack.cpp | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/Resample/Slice/Slice.cpp b/Resample/Slice/Slice.cpp index 9f08bb049c9..b1dd2f50b3d 100644 --- a/Resample/Slice/Slice.cpp +++ b/Resample/Slice/Slice.cpp @@ -82,6 +82,10 @@ SpinMatrix Slice::polarizedReducedPotential(R3 k, double n_ref) const void Slice::initBField(R3 h_field, double h_z) { + // Temporary disable setting z-magnetization in all layers (see issue #653) + if(m_material.magnetization().z() != 0) + throw std::runtime_error("Processing z-magnetization is not implemented yet."); + static constexpr double Magnetic_Permeability = 4e-7 * pi; m_B_field = Magnetic_Permeability * (h_field + m_material.magnetization()); m_B_field.setZ(Magnetic_Permeability * h_z); diff --git a/Resample/Slice/SliceStack.cpp b/Resample/Slice/SliceStack.cpp index fab03b77527..612b7621d3f 100644 --- a/Resample/Slice/SliceStack.cpp +++ b/Resample/Slice/SliceStack.cpp @@ -50,6 +50,14 @@ void SliceStack::addNSlices(size_t n, double thickness, const Material& material SliceStack SliceStack::setBField(const R3& externalField) { + // Temporary disable setting non-zero magnetization in fronting medium (see issue #653) + if(this->at(0).material().magnetization() != R3()) + throw std::runtime_error("Processing fronting magnetization is not implemented yet."); + + // Temporary disable setting non-zero external field (see issue #653) + if(externalField != R3()) + throw std::runtime_error("Processing external field is not implemented yet."); + if (this->empty()) return *this; const double M_z0 = this->at(0).material().magnetization().z(); -- GitLab From 806af108634775e982db3dd7ecec9d41ea71e703 Mon Sep 17 00:00:00 2001 From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de> Date: Tue, 20 Jun 2023 11:38:28 +0200 Subject: [PATCH 02/10] no ext field in gui forms --- GUI/View/SampleDesigner/SampleForm.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/GUI/View/SampleDesigner/SampleForm.cpp b/GUI/View/SampleDesigner/SampleForm.cpp index f73d3615053..d0e5792b904 100644 --- a/GUI/View/SampleDesigner/SampleForm.cpp +++ b/GUI/View/SampleDesigner/SampleForm.cpp @@ -88,7 +88,10 @@ SampleForm::SampleForm(QWidget* parent, SampleItem* sampleItem, SampleEditorCont }); layouter.addValue(sampleItem->crossCorrLength()); - layouter.addVector(sampleItem->externalField(), false); + + // Processing external field is not implemented yet, so temporary disable it (see issue #653) + // layouter.addVector(sampleItem->externalField(), false); + auto* collapser = GroupBoxCollapser::installIntoGroupBox(props, false); collapser->setExpanded(sampleItem->isExpandInfo()); connect(collapser, &GroupBoxCollapser::toggled, this, -- GitLab From d37b2280ad48c614593d3152c96e7fff6666aa6d Mon Sep 17 00:00:00 2001 From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de> Date: Tue, 20 Jun 2023 12:01:58 +0200 Subject: [PATCH 03/10] no ext field in GUI parameter tree --- GUI/Model/Model/ParameterTreeUtil.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/GUI/Model/Model/ParameterTreeUtil.cpp b/GUI/Model/Model/ParameterTreeUtil.cpp index c54626686b9..b1ed5877b8c 100644 --- a/GUI/Model/Model/ParameterTreeUtil.cpp +++ b/GUI/Model/Model/ParameterTreeUtil.cpp @@ -104,8 +104,10 @@ void ParameterTreeBuilder::addSample() { auto* label = new ParameterLabelItem("Sample", parameterContainerItem()->parameterTreeRoot()); addParameterItem(label, m_jobItem->sampleItem()->crossCorrLength()); - if (allowMagneticFields()) - addParameterItem(label, m_jobItem->sampleItem()->externalField()); + + // Processing external field is not implemented yet, so temporary disable it (see issue #653) + // if (allowMagneticFields()) + // addParameterItem(label, m_jobItem->sampleItem()->externalField()); int iLayer = 0; for (auto* layer : m_jobItem->sampleItem()->layerItems()) { -- GitLab From ad39f80f1eb3d22bde8e9b57128078590a9f05fc Mon Sep 17 00:00:00 2001 From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de> Date: Tue, 20 Jun 2023 12:19:50 +0200 Subject: [PATCH 04/10] no z-magnetization in GUI parameter tree --- GUI/Model/Model/ParameterTreeUtil.cpp | 19 +++++++++++++++++-- GUI/Model/Model/ParameterTreeUtil.h | 1 + 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/GUI/Model/Model/ParameterTreeUtil.cpp b/GUI/Model/Model/ParameterTreeUtil.cpp index b1ed5877b8c..5f3fc140a3f 100644 --- a/GUI/Model/Model/ParameterTreeUtil.cpp +++ b/GUI/Model/Model/ParameterTreeUtil.cpp @@ -95,8 +95,11 @@ void ParameterTreeBuilder::addMaterials() addParameterItem(label, item->sldIm()); } - if (allowMagneticFields()) - addParameterItem(label, item->magnetization()); + if (allowMagneticFields()) { + // Processing z-magnetization is not implemented yet (see issue #653) + // addParameterItem(label, item->magnetization()); + addMagnetizationNoZ(label, item->magnetization()); + } } } @@ -153,6 +156,18 @@ void ParameterTreeBuilder::addParameterItem(ParameterLabelItem* parent, VectorPr addParameterItem(label, d.z()); } +void ParameterTreeBuilder::addMagnetizationNoZ(ParameterLabelItem* parent, VectorProperty& d) +{ + // Setting z-component is temporary disabled (see issue #653) + // When interaction with magnetic field in fronting medium is implemented, + // delete this method and use 'addParameterItem' instead + + auto* label = new ParameterLabelItem(d.label(), parent); + addParameterItem(label, d.x()); + addParameterItem(label, d.y()); +} + + ParameterContainerItem* ParameterTreeBuilder::parameterContainerItem() { return m_jobItem->parameterContainerItem(); diff --git a/GUI/Model/Model/ParameterTreeUtil.h b/GUI/Model/Model/ParameterTreeUtil.h index 912080d4f33..a1c6a59c516 100644 --- a/GUI/Model/Model/ParameterTreeUtil.h +++ b/GUI/Model/Model/ParameterTreeUtil.h @@ -56,6 +56,7 @@ private: void addParameterItem(ParameterLabelItem* parent, DoubleProperty& d, const QString& label = QString()); void addParameterItem(ParameterLabelItem* parent, VectorProperty& d); + void addMagnetizationNoZ(ParameterLabelItem *parent, VectorProperty &d); ParameterContainerItem* parameterContainerItem(); bool allowMagneticFields() const; -- GitLab From 5a9ea3cf001d52bce4ce551be6ccbb333155f39f Mon Sep 17 00:00:00 2001 From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de> Date: Tue, 20 Jun 2023 12:23:29 +0200 Subject: [PATCH 05/10] no z-magnetization in GUI forms --- GUI/View/SampleDesigner/LayerEditorUtil.cpp | 11 +++++++++++ GUI/View/SampleDesigner/LayerEditorUtil.h | 4 +++- GUI/View/SampleDesigner/MaterialInplaceForm.cpp | 6 ++++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/GUI/View/SampleDesigner/LayerEditorUtil.cpp b/GUI/View/SampleDesigner/LayerEditorUtil.cpp index 5602222f93b..ae41b30096f 100644 --- a/GUI/View/SampleDesigner/LayerEditorUtil.cpp +++ b/GUI/View/SampleDesigner/LayerEditorUtil.cpp @@ -135,6 +135,16 @@ void LayerEditorUtil::addVectorToGrid(QGridLayout* m_gridLayout, int firstCol, V vertically, addSpacer); } +void LayerEditorUtil::addMagnetizationNoZToGrid(QGridLayout *m_gridLayout, int firstCol, VectorProperty &v, std::function<void (double, DoubleProperty &)> setNewValue, bool vertically, bool addSpacer) +{ + // Setting z-component is temporary disabled (see issue #653) + // When interaction with magnetic field in fronting medium is implemented, + // delete this method and use 'addVectorToGrid' instead + + addMultiPropertyToGrid(m_gridLayout, firstCol, {&v.x(), &v.y()}, setNewValue, + vertically, addSpacer); +} + QLabel* LayerEditorUtil::createBoldLabel(const QString& text) { auto* l = new QLabel(text); @@ -251,3 +261,4 @@ QList<QColor> LayerEditorUtil::predefinedLayerColors() return colors; } + diff --git a/GUI/View/SampleDesigner/LayerEditorUtil.h b/GUI/View/SampleDesigner/LayerEditorUtil.h index 6c37511ac49..90cbbdf2b35 100644 --- a/GUI/View/SampleDesigner/LayerEditorUtil.h +++ b/GUI/View/SampleDesigner/LayerEditorUtil.h @@ -64,7 +64,9 @@ void addVectorToGrid(QGridLayout* m_gridLayout, int firstCol, VectorProperty& v, void addVectorToGrid(QGridLayout* m_gridLayout, int firstCol, VectorProperty& v, std::function<void(double, DoubleProperty&)> setNewValue, bool vertically, bool addSpacer); - +void addMagnetizationNoZToGrid(QGridLayout* m_gridLayout, int firstCol, VectorProperty& v, + std::function<void(double, DoubleProperty&)> setNewValue, bool vertically, + bool addSpacer); QLabel* createBoldLabel(const QString& text); diff --git a/GUI/View/SampleDesigner/MaterialInplaceForm.cpp b/GUI/View/SampleDesigner/MaterialInplaceForm.cpp index b6190564657..32c328a1f71 100644 --- a/GUI/View/SampleDesigner/MaterialInplaceForm.cpp +++ b/GUI/View/SampleDesigner/MaterialInplaceForm.cpp @@ -117,8 +117,10 @@ void MaterialInplaceForm::createWidgets() const auto setNewValue = [this](double value, DoubleProperty& d) { m_ec->setMaterialValue(m_item, value, d); }; - LayerEditorUtil::addVectorToGrid(m_layout, col, material->magnetization(), setNewValue, true, - false); + + // Processing z-magnetization is not implemented yet (see issue #653) + // LayerEditorUtil::addVectorToGrid(m_layout, col, material->magnetization(), setNewValue, true, false); + LayerEditorUtil::addMagnetizationNoZToGrid(m_layout, col, material->magnetization(), setNewValue, true, false); // -- Create UI for material selection button auto* btn = new QPushButton("...", this); -- GitLab From a5d591f44bcb532cca370cabe874671cd969d231 Mon Sep 17 00:00:00 2001 From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de> Date: Tue, 20 Jun 2023 12:31:58 +0200 Subject: [PATCH 06/10] no z-magnetization in GUI material editor --- GUI/View/MaterialEditor/MaterialEditorDialog.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/GUI/View/MaterialEditor/MaterialEditorDialog.cpp b/GUI/View/MaterialEditor/MaterialEditorDialog.cpp index d6490ff413b..ae4f564d94e 100644 --- a/GUI/View/MaterialEditor/MaterialEditorDialog.cpp +++ b/GUI/View/MaterialEditor/MaterialEditorDialog.cpp @@ -53,6 +53,10 @@ MaterialEditorDialog::MaterialEditorDialog(SampleItem* sample, QWidget* parent) configSpinbox(m_ui->ySpinBox, 3, RealLimits::limitless()); configSpinbox(m_ui->zSpinBox, 3, RealLimits::limitless()); + // Setting z-component is temporary disabled (see issue #653) + // When implemented, rm disabling + m_ui->zSpinBox->setDisabled(true); + auto* addRefractiveMaterialAction = new QAction("Add material (refractive index)", parent); addRefractiveMaterialAction->setIcon(QIcon(":/images/shape-square-plus.svg")); addRefractiveMaterialAction->setToolTip("Add new material"); -- GitLab From 69e0a50d3e04e6a781a5becc19bc498029c39d8e Mon Sep 17 00:00:00 2001 From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de> Date: Tue, 20 Jun 2023 12:55:36 +0200 Subject: [PATCH 07/10] no fronting magnetization in GUI forms --- GUI/View/SampleDesigner/MaterialInplaceForm.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/GUI/View/SampleDesigner/MaterialInplaceForm.cpp b/GUI/View/SampleDesigner/MaterialInplaceForm.cpp index 32c328a1f71..d121c6adf2e 100644 --- a/GUI/View/SampleDesigner/MaterialInplaceForm.cpp +++ b/GUI/View/SampleDesigner/MaterialInplaceForm.cpp @@ -15,6 +15,7 @@ #include "GUI/View/SampleDesigner/MaterialInplaceForm.h" #include "Base/Util/Assert.h" #include "GUI/Model/Sample/ItemWithMaterial.h" +#include "GUI/Model/Sample/LayerItem.h" #include "GUI/Model/Sample/MaterialItem.h" #include "GUI/Model/Sample/MaterialModel.h" #include "GUI/Model/Sample/SampleItem.h" @@ -120,7 +121,10 @@ void MaterialInplaceForm::createWidgets() // Processing z-magnetization is not implemented yet (see issue #653) // LayerEditorUtil::addVectorToGrid(m_layout, col, material->magnetization(), setNewValue, true, false); - LayerEditorUtil::addMagnetizationNoZToGrid(m_layout, col, material->magnetization(), setNewValue, true, false); + // When implemented, rm following lines and use 'addVectorToGrid' + const LayerItem* layer_item = dynamic_cast<LayerItem*>(m_item); + if(layer_item && !layer_item->isTopLayer()) + LayerEditorUtil::addMagnetizationNoZToGrid(m_layout, col, material->magnetization(), setNewValue, true, false); // -- Create UI for material selection button auto* btn = new QPushButton("...", this); -- GitLab From 5c84a56a1ce5408d1db0525a4de6c2089c7a3743 Mon Sep 17 00:00:00 2001 From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de> Date: Tue, 20 Jun 2023 14:36:13 +0200 Subject: [PATCH 08/10] upd issue number --- GUI/Model/Model/ParameterTreeUtil.cpp | 6 +++--- GUI/View/MaterialEditor/MaterialEditorDialog.cpp | 2 +- GUI/View/SampleDesigner/LayerEditorUtil.cpp | 2 +- GUI/View/SampleDesigner/MaterialInplaceForm.cpp | 2 +- GUI/View/SampleDesigner/SampleForm.cpp | 2 +- Resample/Slice/Slice.cpp | 2 +- Resample/Slice/SliceStack.cpp | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/GUI/Model/Model/ParameterTreeUtil.cpp b/GUI/Model/Model/ParameterTreeUtil.cpp index 5f3fc140a3f..38061e5dcfe 100644 --- a/GUI/Model/Model/ParameterTreeUtil.cpp +++ b/GUI/Model/Model/ParameterTreeUtil.cpp @@ -96,7 +96,7 @@ void ParameterTreeBuilder::addMaterials() } if (allowMagneticFields()) { - // Processing z-magnetization is not implemented yet (see issue #653) + // Processing z-magnetization is not implemented yet (see issue #654) // addParameterItem(label, item->magnetization()); addMagnetizationNoZ(label, item->magnetization()); } @@ -108,7 +108,7 @@ void ParameterTreeBuilder::addSample() auto* label = new ParameterLabelItem("Sample", parameterContainerItem()->parameterTreeRoot()); addParameterItem(label, m_jobItem->sampleItem()->crossCorrLength()); - // Processing external field is not implemented yet, so temporary disable it (see issue #653) + // Processing external field is not implemented yet, so temporary disable it (see issue #654) // if (allowMagneticFields()) // addParameterItem(label, m_jobItem->sampleItem()->externalField()); @@ -158,7 +158,7 @@ void ParameterTreeBuilder::addParameterItem(ParameterLabelItem* parent, VectorPr void ParameterTreeBuilder::addMagnetizationNoZ(ParameterLabelItem* parent, VectorProperty& d) { - // Setting z-component is temporary disabled (see issue #653) + // Setting z-component is temporary disabled (see issue #654) // When interaction with magnetic field in fronting medium is implemented, // delete this method and use 'addParameterItem' instead diff --git a/GUI/View/MaterialEditor/MaterialEditorDialog.cpp b/GUI/View/MaterialEditor/MaterialEditorDialog.cpp index ae4f564d94e..a8fe1b9d3ef 100644 --- a/GUI/View/MaterialEditor/MaterialEditorDialog.cpp +++ b/GUI/View/MaterialEditor/MaterialEditorDialog.cpp @@ -53,7 +53,7 @@ MaterialEditorDialog::MaterialEditorDialog(SampleItem* sample, QWidget* parent) configSpinbox(m_ui->ySpinBox, 3, RealLimits::limitless()); configSpinbox(m_ui->zSpinBox, 3, RealLimits::limitless()); - // Setting z-component is temporary disabled (see issue #653) + // Setting z-component is temporary disabled (see issue #654) // When implemented, rm disabling m_ui->zSpinBox->setDisabled(true); diff --git a/GUI/View/SampleDesigner/LayerEditorUtil.cpp b/GUI/View/SampleDesigner/LayerEditorUtil.cpp index ae41b30096f..89ccd7197a9 100644 --- a/GUI/View/SampleDesigner/LayerEditorUtil.cpp +++ b/GUI/View/SampleDesigner/LayerEditorUtil.cpp @@ -137,7 +137,7 @@ void LayerEditorUtil::addVectorToGrid(QGridLayout* m_gridLayout, int firstCol, V void LayerEditorUtil::addMagnetizationNoZToGrid(QGridLayout *m_gridLayout, int firstCol, VectorProperty &v, std::function<void (double, DoubleProperty &)> setNewValue, bool vertically, bool addSpacer) { - // Setting z-component is temporary disabled (see issue #653) + // Setting z-component is temporary disabled (see issue #654) // When interaction with magnetic field in fronting medium is implemented, // delete this method and use 'addVectorToGrid' instead diff --git a/GUI/View/SampleDesigner/MaterialInplaceForm.cpp b/GUI/View/SampleDesigner/MaterialInplaceForm.cpp index d121c6adf2e..b73f99436e7 100644 --- a/GUI/View/SampleDesigner/MaterialInplaceForm.cpp +++ b/GUI/View/SampleDesigner/MaterialInplaceForm.cpp @@ -119,7 +119,7 @@ void MaterialInplaceForm::createWidgets() m_ec->setMaterialValue(m_item, value, d); }; - // Processing z-magnetization is not implemented yet (see issue #653) + // Processing z-magnetization is not implemented yet (see issue #654) // LayerEditorUtil::addVectorToGrid(m_layout, col, material->magnetization(), setNewValue, true, false); // When implemented, rm following lines and use 'addVectorToGrid' const LayerItem* layer_item = dynamic_cast<LayerItem*>(m_item); diff --git a/GUI/View/SampleDesigner/SampleForm.cpp b/GUI/View/SampleDesigner/SampleForm.cpp index d0e5792b904..4897e3ddb27 100644 --- a/GUI/View/SampleDesigner/SampleForm.cpp +++ b/GUI/View/SampleDesigner/SampleForm.cpp @@ -89,7 +89,7 @@ SampleForm::SampleForm(QWidget* parent, SampleItem* sampleItem, SampleEditorCont layouter.addValue(sampleItem->crossCorrLength()); - // Processing external field is not implemented yet, so temporary disable it (see issue #653) + // Processing external field is not implemented yet, so temporary disable it (see issue #654) // layouter.addVector(sampleItem->externalField(), false); auto* collapser = GroupBoxCollapser::installIntoGroupBox(props, false); diff --git a/Resample/Slice/Slice.cpp b/Resample/Slice/Slice.cpp index b1dd2f50b3d..db9bb9ff965 100644 --- a/Resample/Slice/Slice.cpp +++ b/Resample/Slice/Slice.cpp @@ -82,7 +82,7 @@ SpinMatrix Slice::polarizedReducedPotential(R3 k, double n_ref) const void Slice::initBField(R3 h_field, double h_z) { - // Temporary disable setting z-magnetization in all layers (see issue #653) + // Temporary disable setting z-magnetization in all layers (see issue #654) if(m_material.magnetization().z() != 0) throw std::runtime_error("Processing z-magnetization is not implemented yet."); diff --git a/Resample/Slice/SliceStack.cpp b/Resample/Slice/SliceStack.cpp index 612b7621d3f..e9b892ede90 100644 --- a/Resample/Slice/SliceStack.cpp +++ b/Resample/Slice/SliceStack.cpp @@ -50,11 +50,11 @@ void SliceStack::addNSlices(size_t n, double thickness, const Material& material SliceStack SliceStack::setBField(const R3& externalField) { - // Temporary disable setting non-zero magnetization in fronting medium (see issue #653) + // Temporary disable setting non-zero magnetization in fronting medium (see issue #654) if(this->at(0).material().magnetization() != R3()) throw std::runtime_error("Processing fronting magnetization is not implemented yet."); - // Temporary disable setting non-zero external field (see issue #653) + // Temporary disable setting non-zero external field (see issue #654) if(externalField != R3()) throw std::runtime_error("Processing external field is not implemented yet."); -- GitLab From 9c9b48bb6a985e90d0d2aabb417dbf9bd4e83347 Mon Sep 17 00:00:00 2001 From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de> Date: Tue, 20 Jun 2023 14:37:32 +0200 Subject: [PATCH 09/10] upd comments --- Resample/Slice/Slice.cpp | 2 +- Resample/Slice/SliceStack.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Resample/Slice/Slice.cpp b/Resample/Slice/Slice.cpp index db9bb9ff965..7bdfdfa3a05 100644 --- a/Resample/Slice/Slice.cpp +++ b/Resample/Slice/Slice.cpp @@ -82,7 +82,7 @@ SpinMatrix Slice::polarizedReducedPotential(R3 k, double n_ref) const void Slice::initBField(R3 h_field, double h_z) { - // Temporary disable setting z-magnetization in all layers (see issue #654) + // Temporary forbid z-magnetization in all layers (see issue #654) if(m_material.magnetization().z() != 0) throw std::runtime_error("Processing z-magnetization is not implemented yet."); diff --git a/Resample/Slice/SliceStack.cpp b/Resample/Slice/SliceStack.cpp index e9b892ede90..fde2db52903 100644 --- a/Resample/Slice/SliceStack.cpp +++ b/Resample/Slice/SliceStack.cpp @@ -50,11 +50,11 @@ void SliceStack::addNSlices(size_t n, double thickness, const Material& material SliceStack SliceStack::setBField(const R3& externalField) { - // Temporary disable setting non-zero magnetization in fronting medium (see issue #654) + // Temporary forbid non-zero magnetization in fronting medium (see issue #654) if(this->at(0).material().magnetization() != R3()) throw std::runtime_error("Processing fronting magnetization is not implemented yet."); - // Temporary disable setting non-zero external field (see issue #654) + // Temporary forbid non-zero external field (see issue #654) if(externalField != R3()) throw std::runtime_error("Processing external field is not implemented yet."); -- GitLab From 8db6321d13748e89f1db988edff0d4cbe3e494fc Mon Sep 17 00:00:00 2001 From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de> Date: Tue, 20 Jun 2023 14:38:42 +0200 Subject: [PATCH 10/10] clang-format --- GUI/Model/Model/ParameterTreeUtil.h | 2 +- GUI/View/SampleDesigner/LayerEditorUtil.cpp | 9 +++++---- GUI/View/SampleDesigner/LayerEditorUtil.h | 4 ++-- GUI/View/SampleDesigner/MaterialInplaceForm.cpp | 9 +++++---- Resample/Slice/Slice.cpp | 2 +- Resample/Slice/SliceStack.cpp | 4 ++-- 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/GUI/Model/Model/ParameterTreeUtil.h b/GUI/Model/Model/ParameterTreeUtil.h index a1c6a59c516..afc38f1faa6 100644 --- a/GUI/Model/Model/ParameterTreeUtil.h +++ b/GUI/Model/Model/ParameterTreeUtil.h @@ -56,7 +56,7 @@ private: void addParameterItem(ParameterLabelItem* parent, DoubleProperty& d, const QString& label = QString()); void addParameterItem(ParameterLabelItem* parent, VectorProperty& d); - void addMagnetizationNoZ(ParameterLabelItem *parent, VectorProperty &d); + void addMagnetizationNoZ(ParameterLabelItem* parent, VectorProperty& d); ParameterContainerItem* parameterContainerItem(); bool allowMagneticFields() const; diff --git a/GUI/View/SampleDesigner/LayerEditorUtil.cpp b/GUI/View/SampleDesigner/LayerEditorUtil.cpp index 89ccd7197a9..37cf6a069fe 100644 --- a/GUI/View/SampleDesigner/LayerEditorUtil.cpp +++ b/GUI/View/SampleDesigner/LayerEditorUtil.cpp @@ -135,14 +135,16 @@ void LayerEditorUtil::addVectorToGrid(QGridLayout* m_gridLayout, int firstCol, V vertically, addSpacer); } -void LayerEditorUtil::addMagnetizationNoZToGrid(QGridLayout *m_gridLayout, int firstCol, VectorProperty &v, std::function<void (double, DoubleProperty &)> setNewValue, bool vertically, bool addSpacer) +void LayerEditorUtil::addMagnetizationNoZToGrid( + QGridLayout* m_gridLayout, int firstCol, VectorProperty& v, + std::function<void(double, DoubleProperty&)> setNewValue, bool vertically, bool addSpacer) { // Setting z-component is temporary disabled (see issue #654) // When interaction with magnetic field in fronting medium is implemented, // delete this method and use 'addVectorToGrid' instead - addMultiPropertyToGrid(m_gridLayout, firstCol, {&v.x(), &v.y()}, setNewValue, - vertically, addSpacer); + addMultiPropertyToGrid(m_gridLayout, firstCol, {&v.x(), &v.y()}, setNewValue, vertically, + addSpacer); } QLabel* LayerEditorUtil::createBoldLabel(const QString& text) @@ -261,4 +263,3 @@ QList<QColor> LayerEditorUtil::predefinedLayerColors() return colors; } - diff --git a/GUI/View/SampleDesigner/LayerEditorUtil.h b/GUI/View/SampleDesigner/LayerEditorUtil.h index 90cbbdf2b35..9af6be1d749 100644 --- a/GUI/View/SampleDesigner/LayerEditorUtil.h +++ b/GUI/View/SampleDesigner/LayerEditorUtil.h @@ -65,8 +65,8 @@ void addVectorToGrid(QGridLayout* m_gridLayout, int firstCol, VectorProperty& v, std::function<void(double, DoubleProperty&)> setNewValue, bool vertically, bool addSpacer); void addMagnetizationNoZToGrid(QGridLayout* m_gridLayout, int firstCol, VectorProperty& v, - std::function<void(double, DoubleProperty&)> setNewValue, bool vertically, - bool addSpacer); + std::function<void(double, DoubleProperty&)> setNewValue, + bool vertically, bool addSpacer); QLabel* createBoldLabel(const QString& text); diff --git a/GUI/View/SampleDesigner/MaterialInplaceForm.cpp b/GUI/View/SampleDesigner/MaterialInplaceForm.cpp index b73f99436e7..934696c62eb 100644 --- a/GUI/View/SampleDesigner/MaterialInplaceForm.cpp +++ b/GUI/View/SampleDesigner/MaterialInplaceForm.cpp @@ -120,11 +120,12 @@ void MaterialInplaceForm::createWidgets() }; // Processing z-magnetization is not implemented yet (see issue #654) - // LayerEditorUtil::addVectorToGrid(m_layout, col, material->magnetization(), setNewValue, true, false); - // When implemented, rm following lines and use 'addVectorToGrid' + // LayerEditorUtil::addVectorToGrid(m_layout, col, material->magnetization(), setNewValue, true, + // false); When implemented, rm following lines and use 'addVectorToGrid' const LayerItem* layer_item = dynamic_cast<LayerItem*>(m_item); - if(layer_item && !layer_item->isTopLayer()) - LayerEditorUtil::addMagnetizationNoZToGrid(m_layout, col, material->magnetization(), setNewValue, true, false); + if (layer_item && !layer_item->isTopLayer()) + LayerEditorUtil::addMagnetizationNoZToGrid(m_layout, col, material->magnetization(), + setNewValue, true, false); // -- Create UI for material selection button auto* btn = new QPushButton("...", this); diff --git a/Resample/Slice/Slice.cpp b/Resample/Slice/Slice.cpp index 7bdfdfa3a05..71416d93862 100644 --- a/Resample/Slice/Slice.cpp +++ b/Resample/Slice/Slice.cpp @@ -83,7 +83,7 @@ SpinMatrix Slice::polarizedReducedPotential(R3 k, double n_ref) const void Slice::initBField(R3 h_field, double h_z) { // Temporary forbid z-magnetization in all layers (see issue #654) - if(m_material.magnetization().z() != 0) + if (m_material.magnetization().z() != 0) throw std::runtime_error("Processing z-magnetization is not implemented yet."); static constexpr double Magnetic_Permeability = 4e-7 * pi; diff --git a/Resample/Slice/SliceStack.cpp b/Resample/Slice/SliceStack.cpp index fde2db52903..11ca87bc6db 100644 --- a/Resample/Slice/SliceStack.cpp +++ b/Resample/Slice/SliceStack.cpp @@ -51,11 +51,11 @@ void SliceStack::addNSlices(size_t n, double thickness, const Material& material SliceStack SliceStack::setBField(const R3& externalField) { // Temporary forbid non-zero magnetization in fronting medium (see issue #654) - if(this->at(0).material().magnetization() != R3()) + if (this->at(0).material().magnetization() != R3()) throw std::runtime_error("Processing fronting magnetization is not implemented yet."); // Temporary forbid non-zero external field (see issue #654) - if(externalField != R3()) + if (externalField != R3()) throw std::runtime_error("Processing external field is not implemented yet."); if (this->empty()) -- GitLab