Skip to content
Snippets Groups Projects
Commit 8f444e9e authored by Yurov, Dmitry's avatar Yurov, Dmitry
Browse files

Prevent using materials of several types in Simulation and SpecularSimulation

Redmine: #1872
parent 707ef53f
No related branches found
No related tags found
No related merge requests found
......@@ -104,6 +104,9 @@ void Simulation::setBeamPolarization(const kvector_t bloch_vector)
void Simulation::prepareSimulation()
{
updateSample();
if (!m_sample_provider.sample()->containsCompliantMaterials())
throw std::runtime_error("Error in Simulation::prepareSimulation(): non-default materials of "
"several types are used in the sample provided");
gsl_set_error_handler_off();
}
......
......@@ -17,6 +17,7 @@
#include "IMultiLayerBuilder.h"
#include "MultiLayer.h"
#include "SpecularMatrix.h"
#include "MaterialUtils.h"
#include <memory>
SpecularSimulation::SpecularSimulation()
......@@ -89,6 +90,12 @@ void SpecularSimulation::prepareSimulation()
throw Exceptions::ClassInitializationException(
"SpecularSimulation::checkSimulation() -> Error. No sample set");
// Check if the sample provided contains non-default materials of the same type.
// TODO: replace with Multilayer::containsCompliantMaterials when working on SpecularSimulation class
if (MaterialUtils::checkMaterialTypes(mP_sample->containedMaterials()) == MATERIAL_TYPES::InvalidMaterialType)
throw std::runtime_error("Error in SpecularSimulation::prepareSimulation(): non-default "
"materials of several types in the sample provided");
updateCoefficientDataAxes();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment