Skip to content
Snippets Groups Projects
Commit 9e3d6bce authored by Matthias Puchner's avatar Matthias Puchner
Browse files

Do not allow integration over Xi in Windows (see issue #160 for details)

parent 469f8981
No related branches found
No related tags found
1 merge request!529Do not allow integration over Xi in Windows
Pipeline #51670 passed
......@@ -13,6 +13,7 @@
// ************************************************************************************************
#include "GUI/Model/Sample/SampleValidator.h"
#include "GUI/Model/Sample/InterferenceItems.h"
#include "GUI/Model/Sample/LayerItem.h"
#include "GUI/Model/Sample/MultiLayerItem.h"
#include "GUI/Model/Sample/ParticleCompositionItem.h"
......@@ -39,6 +40,29 @@ void SampleValidator::validateItem(const SessionItem* item)
addMessage("Particle composition doesn't have any particles.");
}
void SampleValidator::validateInterferences(const LayerItem* layer)
{
#ifdef WIN32
ASSERT(layer);
int iLayout = 0;
for (auto* layout : layer->layouts()) {
iLayout++;
if (auto* c = dynamic_cast<const Interference2DAbstractLatticeItem*>(
layout->interference().currentItem()))
if (c->xiIntegration()) {
QString message =
QString("Interference function of layer '%1', Particle layout %2: "
"Integration over Xi is currently not supported "
"under Windows")
.arg(layer->layerName())
.arg(iLayout);
addMessage(message);
}
}
#endif
}
void SampleValidator::addMessage(const QString& m)
{
m_messages += QString("* ") + m + "\n";
......@@ -56,7 +80,8 @@ bool SampleValidator::isValidMultiLayer(const MultiLayerItem* multilayer)
if (layers.front()->layouts().isEmpty())
addMessage("The single layer in your MultiLayer should contain a particle layout.");
for (auto* layer : layers)
for (auto* layer : layers) {
validateInterferences(layer);
for (auto* layout : layer->layouts()) {
if (layout->particles().isEmpty())
addMessage("Particle layout doesn't contain any particles.");
......@@ -65,7 +90,7 @@ bool SampleValidator::isValidMultiLayer(const MultiLayerItem* multilayer)
iterateItems(particle);
}
}
}
if (!m_messages.isEmpty())
m_messages = "Can't setup DWBA simulation for given MultiLayer.\n" + m_messages;
......
......@@ -22,6 +22,7 @@ class MultiLayerItem;
class ParticleCompositionItem;
class ParticleCoreShellItem;
class ParticleLayoutItem;
class LayerItem;
//! Validates SampleModel for MultiLayerItem suitable for simulation
class SampleValidator {
......@@ -34,6 +35,8 @@ private:
void iterateItems(const SessionItem* parentItem);
void validateItem(const SessionItem* item);
void validateInterferences(const LayerItem* item);
//! Adds this message to the report.
void addMessage(const QString& m);
......
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