Skip to content
Snippets Groups Projects
Commit 5fe6c1b6 authored by Mikhail Svechnikov's avatar Mikhail Svechnikov
Browse files

[m.i765] Allow (x,y,z) magnetization for particles in any layer (#765) (Closes #765)

Merging branch 'm.i765'  into 'main'.

See merge request !2021
parents 145d5252 32154297
No related branches found
No related tags found
1 merge request!2021Allow (x,y,z) magnetization for particles in any layer (#765)
Pipeline #115170 failed
...@@ -100,16 +100,17 @@ void LayerEditorUtil::addMultiPropertyToGrid(QGridLayout* m_gridLayout, int firs ...@@ -100,16 +100,17 @@ void LayerEditorUtil::addMultiPropertyToGrid(QGridLayout* m_gridLayout, int firs
addSpacer); addSpacer);
} }
void LayerEditorUtil::addMagnetizationNoZToGrid( void LayerEditorUtil::addMagnetizationToGrid(
QGridLayout* m_gridLayout, int firstCol, VectorProperty& v, 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,
bool with_z)
{ {
// Setting z-component is temporary disabled (see issue #654) if (with_z)
// When interaction with magnetic field in fronting medium is implemented, addMultiPropertyToGrid(m_gridLayout, firstCol, {&v.x(), &v.y(), &v.z()}, setNewValue,
// delete this method and use 'addVectorToGrid' instead vertically, addSpacer);
else
addMultiPropertyToGrid(m_gridLayout, firstCol, {&v.x(), &v.y()}, setNewValue, vertically, addMultiPropertyToGrid(m_gridLayout, firstCol, {&v.x(), &v.y()}, setNewValue, vertically,
addSpacer); addSpacer);
} }
QWidget* LayerEditorUtil::createWidgetForItemWithParticles(QWidget* parentWidget, QWidget* LayerEditorUtil::createWidgetForItemWithParticles(QWidget* parentWidget,
......
...@@ -54,9 +54,9 @@ void addMultiPropertyToGrid(QGridLayout* m_gridLayout, int firstCol, ...@@ -54,9 +54,9 @@ void addMultiPropertyToGrid(QGridLayout* m_gridLayout, int firstCol,
const DoubleProperties& valueProperties, SampleEditorController* ec, const DoubleProperties& valueProperties, SampleEditorController* ec,
bool addSpacer); bool addSpacer);
void addMagnetizationNoZToGrid(QGridLayout* m_gridLayout, int firstCol, VectorProperty& v, void addMagnetizationToGrid(QGridLayout* m_gridLayout, int firstCol, VectorProperty& v,
std::function<void(double, DoubleProperty&)> setNewValue, std::function<void(double, DoubleProperty&)> setNewValue,
bool vertically, bool addSpacer); bool vertically, bool addSpacer, bool with_z);
QWidget* createWidgetForItemWithParticles(QWidget* parentWidget, QWidget* createWidgetForItemWithParticles(QWidget* parentWidget,
ItemWithParticles* itemWithParticles, bool allowAbundance, ItemWithParticles* itemWithParticles, bool allowAbundance,
......
...@@ -119,12 +119,13 @@ void MaterialInplaceForm::createWidgets() ...@@ -119,12 +119,13 @@ void MaterialInplaceForm::createWidgets()
}; };
// Processing z-magnetization is not implemented yet (see issue #654) // 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); const LayerItem* layer_item = dynamic_cast<LayerItem*>(m_item);
if (layer_item && !layer_item->isTopLayer()) if (layer_item && !layer_item->isTopLayer())
LayerEditorUtil::addMagnetizationNoZToGrid(m_layout, col, material->magnetization(), LayerEditorUtil::addMagnetizationToGrid(m_layout, col, material->magnetization(),
setNewValue, true, false); setNewValue, true, false, false);
if (!layer_item)
LayerEditorUtil::addMagnetizationToGrid(m_layout, col, material->magnetization(),
setNewValue, true, false, true);
// -- Create UI for material selection button // -- Create UI for material selection button
auto* btn = new QPushButton("...", this); auto* btn = new QPushButton("...", this);
......
...@@ -84,7 +84,7 @@ void Slice::initBField(R3 h_field, double h_z) ...@@ -84,7 +84,7 @@ void Slice::initBField(R3 h_field, double h_z)
{ {
// Temporary forbid z-magnetization in all layers (see issue #654) // 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."); throw std::runtime_error("Processing z-magnetization of layers is not implemented.");
static constexpr double Magnetic_Permeability = 4e-7 * pi; static constexpr double Magnetic_Permeability = 4e-7 * pi;
m_B_field = Magnetic_Permeability * (h_field + m_material.magnetization()); m_B_field = Magnetic_Permeability * (h_field + m_material.magnetization());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment