BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
SpecularStrategyBuilder.cpp
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Core/Computation/SpecularStrategyBuilder.cpp
6 //! @brief Implements class SpecularStrategyBuilder.
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************** //
14 
21 
22 std::unique_ptr<ISpecularStrategy> SpecularStrategyBuilder::build(const MultiLayer& sample,
23  const bool magnetic)
24 {
25  auto roughnessModel = sample.roughnessModel();
26 
27  if (magnetic) {
28  if (roughnessModel == RoughnessModel::TANH || roughnessModel == RoughnessModel::DEFAULT) {
29 
30  return std::make_unique<SpecularMagneticNewTanhStrategy>();
31 
32  } else if (roughnessModel == RoughnessModel::NEVOT_CROCE) {
33 
34  return std::make_unique<SpecularMagneticNewNCStrategy>();
35 
36  } else
37  throw std::logic_error("Invalid roughness model");
38 
39  } else {
40  if (roughnessModel == RoughnessModel::TANH || roughnessModel == RoughnessModel::DEFAULT) {
41  return std::make_unique<SpecularScalarTanhStrategy>();
42 
43  } else if (roughnessModel == RoughnessModel::NEVOT_CROCE) {
44 
45  return std::make_unique<SpecularScalarNCStrategy>();
46 
47  } else
48  throw std::logic_error("Invalid roughness model");
49  }
50 }
Defines helper functions for MultiLayer objects.
Defines class SpecularMagneticNewNCStrategy.
Defines class SpecularMagneticNewTanhStrategy.
Defines class SpecularScalarNCStrategy.
Defines class SpecularScalarTanhStrategy.
Defines class SpecularStrategyBuilder.
Our sample model: a stack of layers one below the other.
Definition: MultiLayer.h:42
RoughnessModel roughnessModel() const
Definition: MultiLayer.h:83
static std::unique_ptr< ISpecularStrategy > build(const MultiLayer &sample, const bool magnetic)