Skip to content
Snippets Groups Projects
Unverified Commit c314001e authored by Pospelov, Gennady's avatar Pospelov, Gennady Committed by GitHub
Browse files

Merge pull request #921 from rbeerwerth/develop

Provide error checking for invalid input (issue #2441/2442)
parents 57ed587b 275de0c8
No related branches found
No related tags found
No related merge requests found
...@@ -30,7 +30,9 @@ MaterialBySLDImpl::MaterialBySLDImpl(const std::string& name, double sld_real, d ...@@ -30,7 +30,9 @@ MaterialBySLDImpl::MaterialBySLDImpl(const std::string& name, double sld_real, d
kvector_t magnetization) kvector_t magnetization)
: MagneticMaterialImpl(name, magnetization) : MagneticMaterialImpl(name, magnetization)
, m_sld_real(sld_real) , m_sld_real(sld_real)
, m_sld_imag(sld_imag) , m_sld_imag(sld_imag < 0. ?
throw std::runtime_error("The imaginary part of the SLD must be greater or equal zero") :
sld_imag)
{} {}
MaterialBySLDImpl* MaterialBySLDImpl::clone() const MaterialBySLDImpl* MaterialBySLDImpl::clone() const
......
...@@ -19,7 +19,9 @@ RefractiveMaterialImpl::RefractiveMaterialImpl(const std::string& name, double d ...@@ -19,7 +19,9 @@ RefractiveMaterialImpl::RefractiveMaterialImpl(const std::string& name, double d
kvector_t magnetization) kvector_t magnetization)
: MagneticMaterialImpl(name, magnetization) : MagneticMaterialImpl(name, magnetization)
, m_delta(delta) , m_delta(delta)
, m_beta(beta) , m_beta(beta < 0. ?
throw std::runtime_error("The imaginary part of the refractive index must be greater or equal zero") :
beta)
{} {}
RefractiveMaterialImpl* RefractiveMaterialImpl::clone() const RefractiveMaterialImpl* RefractiveMaterialImpl::clone() const
......
...@@ -76,6 +76,12 @@ void MultiLayer::addLayerWithTopRoughness(const Layer& layer, const LayerRoughne ...@@ -76,6 +76,12 @@ void MultiLayer::addLayerWithTopRoughness(const Layer& layer, const LayerRoughne
throw std::runtime_error( throw std::runtime_error(
"Invalid call to MultiLayer::addLayer(): the semi-infinite top layer " "Invalid call to MultiLayer::addLayer(): the semi-infinite top layer "
"must have a pro forma thickness of 0"); "must have a pro forma thickness of 0");
if (roughness.getSigma() != 0.0)
throw std::runtime_error(
"Invalid call to MultiLayer::addLayer(): the semi-infinite top layer "
"cannot have roughness.");
} }
addAndRegisterLayer(p_new_layer); addAndRegisterLayer(p_new_layer);
} }
......
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