BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
Beam Class Reference

An incident neutron or x-ray beam. More...

Inheritance diagram for Beam:
[legend]
Collaboration diagram for Beam:
[legend]

Public Member Functions

 Beam (const Beam &other)
 
 Beam (double intensity, double wavelength, const Direction &direction)
 
virtual ~Beam ()
 
void accept (INodeVisitor *visitor) const override
 Calls the INodeVisitor's visit method. More...
 
int copyNumber (const INode *node) const
 Returns copyNumber of child, which takes into account existence of children with same name. More...
 
ParameterPool * createParameterTree () const
 Creates new parameter pool, with all local parameters and those of its children. More...
 
Direction direction () const
 
std::string displayName () const
 Returns display name, composed from the name of node and it's copy number. More...
 
const IFootprintFactor * footprintFactor () const
 Returns footprint factor. More...
 
kvector_t getBlochVector () const
 
kvector_t getCentralK () const
 Returns the wavevector. More...
 
std::vector< const INode * > getChildren () const override
 Returns a vector of children. More...
 
const std::string & getName () const
 
Eigen::Matrix2cd getPolarization () const
 Returns the polarization density matrix (in spin basis along z-axis) More...
 
double intensity () const
 Returns the beam intensity in neutrons/sec. More...
 
virtual void onChange ()
 Action to be taken in inherited class when a parameter has changed. More...
 
Beam & operator= (const Beam &other)
 
RealParameter * parameter (const std::string &name) const
 Returns parameter with given 'name'. More...
 
ParameterPool * parameterPool () const
 Returns pointer to the parameter pool. More...
 
std::string parametersToString () const
 Returns multiline string representing available parameters. More...
 
INode * parent ()
 
const INode * parent () const
 
std::vector< const INode * > progeny () const
 Returns a vector of all descendants. More...
 
void registerChild (INode *node)
 
RealParameter & registerParameter (const std::string &name, double *parpointer)
 
void registerVector (const std::string &base_name, kvector_t *p_vec, const std::string &units="nm")
 
void removeParameter (const std::string &name)
 
void removeVector (const std::string &base_name)
 
void setDirection (const Direction &direction)
 
void setFootprintFactor (const IFootprintFactor &shape_factor)
 Sets footprint factor to the beam. More...
 
void setInclination (const double alpha)
 
void setIntensity (double intensity)
 Sets the beam intensity in neutrons/sec. More...
 
void setName (const std::string &name)
 
void setParameterValue (const std::string &name, double value)
 
virtual void setParent (const INode *newParent)
 
void setPolarization (const kvector_t bloch_vector)
 Sets the polarization density matrix according to the given Bloch vector. More...
 
void setVectorValue (const std::string &base_name, kvector_t value)
 
void setWavelength (double wavelength)
 
virtual std::string treeToString () const
 Returns multiline string representing tree structure below the node. More...
 
double wavelength () const
 

Static Public Member Functions

static Beam horizontalBeam ()
 
static std::string XComponentName (const std::string &base_name)
 
static std::string YComponentName (const std::string &base_name)
 
static std::string ZComponentName (const std::string &base_name)
 

Protected Attributes

const size_t m_NP
 
std::vector< double > m_P
 

Private Member Functions

 Beam ()
 

Private Attributes

double m_alpha
 
kvector_t m_bloch_vector
 Bloch vector encoding the beam's polarization. More...
 
double m_intensity
 beam intensity (neutrons/sec) More...
 
std::string m_name
 
const INode * m_parent {nullptr}
 
double m_phi
 
std::unique_ptr< ParameterPool > m_pool
 parameter pool (kind of pointer-to-implementation) More...
 
std::unique_ptr< IFootprintFactor > m_shape_factor
 footprint correction handler More...
 
double m_wavelength
 

Detailed Description

An incident neutron or x-ray beam.

Definition at line 27 of file Beam.h.

Constructor & Destructor Documentation

◆ Beam() [1/3]

Beam::Beam ( double  intensity,
double  wavelength,
const Direction &  direction 
)

Definition at line 24 of file Beam.cpp.

27  // , m_direction(direction)
29  , m_phi(direction.phi())
30 {
31  setName("Beam");
33  registerParameter("Wavelength", &m_wavelength).setUnit("nm").setNonnegative();
34  registerParameter("InclinationAngle", &m_alpha).setUnit("rad").setLimited(0, INCLINATION_LIMIT);
35  registerParameter("AzimuthalAngle", &m_phi).setUnit("rad").setLimited(-M_PI_2, M_PI_2);
36  registerVector("BlochVector", &m_bloch_vector, "");
37 }
static constexpr double INCLINATION_LIMIT
Definition: Beam.cpp:22
#define M_PI_2
Definition: Constants.h:45
double m_alpha
Definition: Beam.h:72
Direction direction() const
Definition: Beam.h:45
double m_wavelength
Definition: Beam.h:70
kvector_t m_bloch_vector
Bloch vector encoding the beam's polarization.
Definition: Beam.h:75
double m_phi
Definition: Beam.h:73
double intensity() const
Returns the beam intensity in neutrons/sec.
Definition: Beam.h:42
double wavelength() const
Definition: Beam.h:43
double m_intensity
beam intensity (neutrons/sec)
Definition: Beam.h:69
double phi() const
Definition: Direction.h:30
double alpha() const
Definition: Direction.h:29
void registerVector(const std::string &base_name, kvector_t *p_vec, const std::string &units="nm")
void setName(const std::string &name)
RealParameter & registerParameter(const std::string &name, double *parpointer)
RealParameter & setNonnegative()
RealParameter & setLimited(double lower, double upper)
RealParameter & setUnit(const std::string &name)

References INCLINATION_LIMIT, m_alpha, m_bloch_vector, m_intensity, m_phi, M_PI_2, m_wavelength, IParametricComponent::registerParameter(), IParametricComponent::registerVector(), RealParameter::setLimited(), IParametricComponent::setName(), RealParameter::setNonnegative(), and RealParameter::setUnit().

Here is the call graph for this function:

◆ Beam() [2/3]

Beam::Beam ( const Beam &  other)

Definition at line 44 of file Beam.cpp.

44  : Beam(other.m_intensity, other.m_wavelength, other.direction())
45 {
47  setName(other.getName());
48  if (other.m_shape_factor) {
49  m_shape_factor.reset(other.m_shape_factor->clone());
51  }
52 }
std::unique_ptr< IFootprintFactor > m_shape_factor
footprint correction handler
Definition: Beam.h:74
void registerChild(INode *node)
Definition: INode.cpp:57
const std::string & getName() const

References IParametricComponent::getName(), m_bloch_vector, m_shape_factor, INode::registerChild(), and IParametricComponent::setName().

Here is the call graph for this function:

◆ ~Beam()

Beam::~Beam ( )
virtualdefault

◆ Beam() [3/3]

Beam::Beam ( )
private

Referenced by horizontalBeam().

Member Function Documentation

◆ accept()

void Beam::accept ( INodeVisitor *  visitor) const
inlineoverridevirtual

Calls the INodeVisitor's visit method.

Implements INode.

Definition at line 38 of file Beam.h.

38 { visitor->visit(this); }
virtual void visit(const BasicLattice2D *)
Definition: INodeVisitor.h:151

References INodeVisitor::visit().

Here is the call graph for this function:

◆ copyNumber()

int INode::copyNumber ( const INode *  node) const
inherited

Returns copyNumber of child, which takes into account existence of children with same name.

Definition at line 94 of file INode.cpp.

95 {
96  if (node->parent() != this)
97  return -1;
98 
99  int result(-1), count(0);
100  for (auto child : getChildren()) {
101 
102  if (child == nullptr)
103  throw std::runtime_error("INode::copyNumber() -> Error. Nullptr as child.");
104 
105  if (child == node)
106  result = count;
107 
108  if (child->getName() == node->getName())
109  ++count;
110  }
111 
112  return count > 1 ? result : -1;
113 }
const INode * parent() const
Definition: INode.cpp:84
virtual std::vector< const INode * > getChildren() const
Returns a vector of children.
Definition: INode.cpp:63

References INode::getChildren(), IParametricComponent::getName(), and INode::parent().

Referenced by INode::displayName().

Here is the call graph for this function:

◆ createParameterTree()

ParameterPool * INode::createParameterTree ( ) const
virtualinherited

Creates new parameter pool, with all local parameters and those of its children.

Reimplemented from IParametricComponent.

Definition at line 126 of file INode.cpp.

127 {
128  std::unique_ptr<ParameterPool> result(new ParameterPool);
129 
130  for (const INode* child : progeny()) {
131  const std::string path = NodeUtils::nodePath(child, parent()) + "/";
132  child->parameterPool()->copyToExternalPool(path, result.get());
133  }
134 
135  return result.release();
136 }
Base class for tree-like structures containing parameterized objects.
Definition: INode.h:49
std::vector< const INode * > progeny() const
Returns a vector of all descendants.
Definition: INode.cpp:68
Container with parameters for IParametricComponent object.
Definition: ParameterPool.h:29
std::string nodePath(const INode *node, const INode *root=nullptr)
Returns path composed of node's displayName, with respect to root node.
Definition: NodeUtils.cpp:89

References NodeUtils::nodePath(), INode::parent(), and INode::progeny().

Referenced by ISimulation::runSimulation(), DepthProbeSimulation::validateParametrization(), OffSpecularSimulation::validateParametrization(), and SpecularSimulation::validateParametrization().

Here is the call graph for this function:

◆ direction()

◆ displayName()

std::string INode::displayName ( ) const
inherited

Returns display name, composed from the name of node and it's copy number.

Definition at line 115 of file INode.cpp.

116 {
117  std::string result = getName();
118  if (m_parent) {
119  int index = m_parent->copyNumber(this);
120  if (index >= 0)
121  result = result + std::to_string(index);
122  }
123  return result;
124 }
const INode * m_parent
Definition: INode.h:83
int copyNumber(const INode *node) const
Returns copyNumber of child, which takes into account existence of children with same name.
Definition: INode.cpp:94

References INode::copyNumber(), IParametricComponent::getName(), and INode::m_parent.

Referenced by NodeUtils::nodePath().

Here is the call graph for this function:

◆ footprintFactor()

const IFootprintFactor * Beam::footprintFactor ( ) const

Returns footprint factor.

Definition at line 101 of file Beam.cpp.

102 {
103  return m_shape_factor.get();
104 }

References m_shape_factor.

Referenced by DepthProbeSimulation::normalize().

◆ getBlochVector()

kvector_t Beam::getBlochVector ( ) const

Definition at line 122 of file Beam.cpp.

123 {
124  return m_bloch_vector;
125 }

References m_bloch_vector.

Referenced by TransformFromDomain::setGISASBeamItem().

◆ getCentralK()

kvector_t Beam::getCentralK ( ) const

Returns the wavevector.

Definition at line 73 of file Beam.cpp.

74 {
75  return M_TWOPI / m_wavelength * Direction(-direction().alpha(), direction().phi()).vector();
76 }
#define M_TWOPI
Definition: Constants.h:54
A direction in three-dimensional space.
Definition: Direction.h:24
kvector_t vector() const
Returns Cartesian 3D vector.
Definition: Direction.cpp:24

References direction(), M_TWOPI, m_wavelength, and Direction::vector().

Referenced by RectangularDetector::init().

Here is the call graph for this function:

◆ getChildren()

std::vector< const INode * > Beam::getChildren ( ) const
overridevirtual

Returns a vector of children.

Reimplemented from INode.

Definition at line 140 of file Beam.cpp.

141 {
142  if (m_shape_factor)
143  return {m_shape_factor.get()};
144  return {};
145 }

References m_shape_factor.

◆ getName()

◆ getPolarization()

Eigen::Matrix2cd Beam::getPolarization ( ) const

Returns the polarization density matrix (in spin basis along z-axis)

Definition at line 127 of file Beam.cpp.

128 {
129  Eigen::Matrix2cd result;
130  double x = m_bloch_vector.x();
131  double y = m_bloch_vector.y();
132  double z = m_bloch_vector.z();
133  result(0, 0) = (1.0 + z) / 2.0;
134  result(0, 1) = complex_t(x, -y) / 2.0;
135  result(1, 0) = complex_t(x, y) / 2.0;
136  result(1, 1) = (1.0 - z) / 2.0;
137  return result;
138 }
std::complex< double > complex_t
Definition: Complex.h:20
T z() const
Returns z-component in cartesian coordinate system.
Definition: BasicVector3D.h:67
T y() const
Returns y-component in cartesian coordinate system.
Definition: BasicVector3D.h:65
T x() const
Returns x-component in cartesian coordinate system.
Definition: BasicVector3D.h:63

References m_bloch_vector, BasicVector3D< T >::x(), BasicVector3D< T >::y(), and BasicVector3D< T >::z().

Referenced by ISimulation2D::generateSimulationElements().

Here is the call graph for this function:

◆ horizontalBeam()

Beam Beam::horizontalBeam ( )
static

Definition at line 39 of file Beam.cpp.

40 {
41  return Beam(1.0, 1.0, {0, 0});
42 }

References Beam().

Here is the call graph for this function:

◆ intensity()

double Beam::intensity ( ) const
inline

◆ onChange()

◆ operator=()

Beam & Beam::operator= ( const Beam &  other)

Definition at line 54 of file Beam.cpp.

55 {
56  m_intensity = other.m_intensity;
57  m_wavelength = other.m_wavelength;
58  // m_direction = other.m_direction;
59  m_alpha = other.m_alpha;
60  m_phi = other.m_phi;
62  setName(other.getName());
63  if (other.m_shape_factor) {
64  m_shape_factor.reset(other.m_shape_factor->clone());
66  } else
67  m_shape_factor.release();
68  return *this;
69 }

References IParametricComponent::getName(), m_alpha, m_bloch_vector, m_intensity, m_phi, m_shape_factor, m_wavelength, INode::registerChild(), and IParametricComponent::setName().

Here is the call graph for this function:

◆ parameter()

RealParameter * IParametricComponent::parameter ( const std::string &  name) const
inherited

Returns parameter with given 'name'.

Definition at line 86 of file IParametricComponent.cpp.

87 {
88  return m_pool->parameter(name);
89 }
std::unique_ptr< ParameterPool > m_pool
parameter pool (kind of pointer-to-implementation)
QString const & name(EShape k)
Definition: particles.cpp:21

References IParametricComponent::m_pool, and RealSpace::Particles::name().

Referenced by DepthProbeSimulation::initialize(), SpecularSimulation::initialize(), Lattice3D::initialize(), IParticle::registerAbundance(), ParticleLayout::registerParticleDensity(), IParticle::registerPosition(), Layer::registerThickness(), Lattice2D::setRotationEnabled(), and DistributionLogNormal::setUnits().

Here is the call graph for this function:

◆ parameterPool()

ParameterPool* IParametricComponent::parameterPool ( ) const
inlineinherited

Returns pointer to the parameter pool.

Definition at line 39 of file IParametricComponent.h.

39 { return m_pool.get(); } // has non-const usages!

References IParametricComponent::m_pool.

Referenced by INode::INode(), IParametricComponent::IParametricComponent(), pyfmt2::argumentList(), SampleBuilderNode::borrow_builder_parameters(), SampleBuilderNode::reset(), and IDistribution1D::setUnits().

◆ parametersToString()

std::string IParametricComponent::parametersToString ( ) const
inherited

Returns multiline string representing available parameters.

Definition at line 43 of file IParametricComponent.cpp.

44 {
45  std::ostringstream result;
46  std::unique_ptr<ParameterPool> P_pool(createParameterTree());
47  result << *P_pool << "\n";
48  return result.str();
49 }
virtual ParameterPool * createParameterTree() const
Creates new parameter pool, with all local parameters and those of its children.

References IParametricComponent::createParameterTree().

Here is the call graph for this function:

◆ parent() [1/2]

INode * INode::parent ( )
inherited

Definition at line 89 of file INode.cpp.

90 {
91  return const_cast<INode*>(m_parent);
92 }

References INode::m_parent.

◆ parent() [2/2]

◆ progeny()

std::vector< const INode * > INode::progeny ( ) const
inherited

Returns a vector of all descendants.

Definition at line 68 of file INode.cpp.

69 {
70  std::vector<const INode*> result;
71  result.push_back(this);
72  for (const auto* child : getChildren()) {
73  for (const auto* p : child->progeny())
74  result.push_back(p);
75  }
76  return result;
77 }

References INode::getChildren().

Referenced by INode::createParameterTree(), and ParticleDistribution::generateParticles().

Here is the call graph for this function:

◆ registerChild()

void INode::registerChild ( INode *  node)
inherited

Definition at line 57 of file INode.cpp.

58 {
59  ASSERT(node);
60  node->setParent(this);
61 }
#define ASSERT(condition)
Definition: Assert.h:31
virtual void setParent(const INode *newParent)
Definition: INode.cpp:79

References ASSERT, and INode::setParent().

Referenced by Beam(), Crystal::Crystal(), IDetector::IDetector(), Instrument::Instrument(), InterferenceFunction2DLattice::InterferenceFunction2DLattice(), InterferenceFunction2DParaCrystal::InterferenceFunction2DParaCrystal(), InterferenceFunction2DSuperLattice::InterferenceFunction2DSuperLattice(), InterferenceFunctionFinite2DLattice::InterferenceFunctionFinite2DLattice(), Particle::Particle(), ParticleDistribution::ParticleDistribution(), ParticleLayout::addAndRegisterAbstractParticle(), ParticleCoreShell::addAndRegisterCore(), MultiLayer::addAndRegisterInterface(), MultiLayer::addAndRegisterLayer(), ParticleCoreShell::addAndRegisterShell(), Layer::addLayout(), ParticleComposition::addParticlePointer(), ISimulation::initialize(), MesoCrystal::initialize(), operator=(), Instrument::operator=(), IParticle::rotate(), ParticleLayout::setAndRegisterInterferenceFunction(), ISimulation::setBackground(), InterferenceFunction1DLattice::setDecayFunction(), InterferenceFunction2DLattice::setDecayFunction(), Instrument::setDetector(), IDetector::setDetectorResolution(), setFootprintFactor(), Particle::setFormFactor(), InterferenceFunctionFinite3DLattice::setLattice(), InterferenceFunctionRadialParaCrystal::setProbabilityDistribution(), InterferenceFunction2DParaCrystal::setProbabilityDistributions(), ConvolutionDetectorResolution::setResolutionFunction(), IParticle::setRotation(), LayerInterface::setRoughness(), and InterferenceFunction2DSuperLattice::setSubstructureIFF().

Here is the call graph for this function:

◆ registerParameter()

RealParameter & IParametricComponent::registerParameter ( const std::string &  name,
double *  parpointer 
)
inherited

Definition at line 51 of file IParametricComponent.cpp.

52 {
53  return m_pool->addParameter(
54  new RealParameter(name, data, getName(), [&]() -> void { onChange(); }));
55 }
virtual void onChange()
Action to be taken in inherited class when a parameter has changed.
Wraps a parameter of type double.
Definition: RealParameter.h:31

References IParametricComponent::getName(), IParametricComponent::m_pool, RealSpace::Particles::name(), and IParametricComponent::onChange().

Referenced by BasicLattice2D::BasicLattice2D(), Beam(), CylindersInBABuilder::CylindersInBABuilder(), DetectionProperties::DetectionProperties(), HexagonalLattice2D::HexagonalLattice2D(), IInterferenceFunction::IInterferenceFunction(), INode::INode(), InterferenceFunction1DLattice::InterferenceFunction1DLattice(), InterferenceFunction2DParaCrystal::InterferenceFunction2DParaCrystal(), InterferenceFunctionHardDisk::InterferenceFunctionHardDisk(), InterferenceFunctionRadialParaCrystal::InterferenceFunctionRadialParaCrystal(), InterferenceFunctionTwin::InterferenceFunctionTwin(), Lattice2D::Lattice2D(), LayerRoughness::LayerRoughness(), MultiLayer::MultiLayer(), ParticleDistribution::ParticleDistribution(), PlainMultiLayerBySLDBuilder::PlainMultiLayerBySLDBuilder(), ResolutionFunction2DGaussian::ResolutionFunction2DGaussian(), ResonatorBuilder::ResonatorBuilder(), SquareLattice2D::SquareLattice2D(), TriangularRippleBuilder::TriangularRippleBuilder(), IParticle::registerAbundance(), ParticleLayout::registerParticleDensity(), Layer::registerThickness(), IParametricComponent::registerVector(), ParticleLayout::registerWeight(), and Lattice2D::setRotationEnabled().

Here is the call graph for this function:

◆ registerVector()

void IParametricComponent::registerVector ( const std::string &  base_name,
kvector_t *  p_vec,
const std::string &  units = "nm" 
)
inherited

Definition at line 57 of file IParametricComponent.cpp.

59 {
60  registerParameter(XComponentName(base_name), &((*p_vec)[0])).setUnit(units);
61  registerParameter(YComponentName(base_name), &((*p_vec)[1])).setUnit(units);
62  registerParameter(ZComponentName(base_name), &((*p_vec)[2])).setUnit(units);
63 }
static std::string XComponentName(const std::string &base_name)
static std::string ZComponentName(const std::string &base_name)
static std::string YComponentName(const std::string &base_name)
MVVM_MODEL_EXPORT std::string base_name(const std::string &path)
Provide the filename of a file path.
Definition: fileutils.cpp:78

References ModelView::Utils::base_name(), IParametricComponent::registerParameter(), RealParameter::setUnit(), IParametricComponent::XComponentName(), IParametricComponent::YComponentName(), and IParametricComponent::ZComponentName().

Referenced by Beam(), DetectionProperties::DetectionProperties(), InterferenceFunctionTwin::InterferenceFunctionTwin(), MultiLayer::MultiLayer(), Lattice3D::initialize(), and IParticle::registerPosition().

Here is the call graph for this function:

◆ removeParameter()

void IParametricComponent::removeParameter ( const std::string &  name)
inherited

Definition at line 91 of file IParametricComponent.cpp.

92 {
93  m_pool->removeParameter(name);
94 }

References IParametricComponent::m_pool, and RealSpace::Particles::name().

Referenced by IParticle::registerAbundance(), ParticleLayout::registerParticleDensity(), Layer::registerThickness(), IParametricComponent::removeVector(), and Lattice2D::setRotationEnabled().

Here is the call graph for this function:

◆ removeVector()

void IParametricComponent::removeVector ( const std::string &  base_name)
inherited

Definition at line 96 of file IParametricComponent.cpp.

References ModelView::Utils::base_name(), IParametricComponent::removeParameter(), IParametricComponent::XComponentName(), IParametricComponent::YComponentName(), and IParametricComponent::ZComponentName().

Referenced by IParticle::registerPosition().

Here is the call graph for this function:

◆ setDirection()

void Beam::setDirection ( const Direction &  direction)

Definition at line 86 of file Beam.cpp.

87 {
88  if (direction.alpha() < 0.0)
89  throw std::runtime_error(
90  "Beam::setCentralK() -> Error. Inclination angle alpha_i can't be negative.");
91  // m_direction = direction;
93  m_phi = direction.phi();
94 }

References Direction::alpha(), direction(), m_alpha, m_phi, and Direction::phi().

Referenced by Instrument::setBeamParameters().

Here is the call graph for this function:

◆ setFootprintFactor()

void Beam::setFootprintFactor ( const IFootprintFactor &  shape_factor)

Sets footprint factor to the beam.

Definition at line 106 of file Beam.cpp.

107 {
108  m_shape_factor.reset(shape_factor.clone());
110 }
virtual IFootprintFactor * clone() const =0

References IFootprintFactor::clone(), m_shape_factor, and INode::registerChild().

Referenced by DepthProbeSimulation::setBeamParameters().

Here is the call graph for this function:

◆ setInclination()

void Beam::setInclination ( const double  alpha)

Definition at line 96 of file Beam.cpp.

97 {
98  m_alpha = alpha;
99 }

References m_alpha.

Referenced by OffSpecularSimulation::initSimulationElementVector().

◆ setIntensity()

void Beam::setIntensity ( double  intensity)
inline

Sets the beam intensity in neutrons/sec.

Definition at line 61 of file Beam.h.

References intensity(), and m_intensity.

Here is the call graph for this function:

◆ setName()

void IParametricComponent::setName ( const std::string &  name)
inlineinherited

Definition at line 69 of file IParametricComponent.h.

69 { m_name = name; }

References IParametricComponent::m_name, and RealSpace::Particles::name().

Referenced by BasicLattice2D::BasicLattice2D(), Beam(), ConvolutionDetectorResolution::ConvolutionDetectorResolution(), Crystal::Crystal(), DetectionProperties::DetectionProperties(), DistributionHandler::DistributionHandler(), FormFactorCoreShell::FormFactorCoreShell(), FormFactorCrystal::FormFactorCrystal(), FormFactorDecoratorMaterial::FormFactorDecoratorMaterial(), FormFactorDecoratorPositionFactor::FormFactorDecoratorPositionFactor(), FormFactorDecoratorRotation::FormFactorDecoratorRotation(), FormFactorWeighted::FormFactorWeighted(), HexagonalLattice2D::HexagonalLattice2D(), IDetector::IDetector(), INode::INode(), Instrument::Instrument(), InterferenceFunction1DLattice::InterferenceFunction1DLattice(), InterferenceFunction2DLattice::InterferenceFunction2DLattice(), InterferenceFunction2DParaCrystal::InterferenceFunction2DParaCrystal(), InterferenceFunction2DSuperLattice::InterferenceFunction2DSuperLattice(), InterferenceFunction3DLattice::InterferenceFunction3DLattice(), InterferenceFunctionFinite2DLattice::InterferenceFunctionFinite2DLattice(), InterferenceFunctionFinite3DLattice::InterferenceFunctionFinite3DLattice(), InterferenceFunctionHardDisk::InterferenceFunctionHardDisk(), InterferenceFunctionNone::InterferenceFunctionNone(), InterferenceFunctionRadialParaCrystal::InterferenceFunctionRadialParaCrystal(), InterferenceFunctionTwin::InterferenceFunctionTwin(), ISampleBuilder::ISampleBuilder(), IsGISAXSDetector::IsGISAXSDetector(), Lattice3D::Lattice3D(), Layer::Layer(), LayerInterface::LayerInterface(), LayerRoughness::LayerRoughness(), MultiLayer::MultiLayer(), ParticleCoreShell::ParticleCoreShell(), ParticleDistribution::ParticleDistribution(), ParticleLayout::ParticleLayout(), RectangularDetector::RectangularDetector(), ResolutionFunction2DGaussian::ResolutionFunction2DGaussian(), SampleBuilderNode::SampleBuilderNode(), SphericalDetector::SphericalDetector(), SquareLattice2D::SquareLattice2D(), Layer::clone(), LayersWithAbsorptionBuilder::createSampleByIndex(), Basic2DParaCrystalBuilder::createSampleByIndex(), ParticleInVacuumBuilder::createSampleByIndex(), SimpleMagneticRotationBuilder::createSampleByIndex(), DepthProbeSimulation::initialize(), GISASSimulation::initialize(), OffSpecularSimulation::initialize(), SpecularSimulation::initialize(), SpecularDetector1D::initialize(), MesoCrystal::initialize(), Particle::initialize(), ParticleComposition::initialize(), operator=(), SampleBuilderNode::operator=(), SampleBuilderNode::reset(), and SampleBuilderNode::setSBN().

Here is the call graph for this function:

◆ setParameterValue()

void IParametricComponent::setParameterValue ( const std::string &  name,
double  value 
)
inherited

Definition at line 65 of file IParametricComponent.cpp.

66 {
67  if (name.find('*') == std::string::npos && name.find('/') == std::string::npos) {
68  m_pool->setParameterValue(name, value);
69  } else {
70  std::unique_ptr<ParameterPool> P_pool{createParameterTree()};
71  if (name.find('*') != std::string::npos)
72  P_pool->setMatchedParametersValue(name, value);
73  else
74  P_pool->setParameterValue(name, value);
75  }
76 }
int setMatchedParametersValue(const std::string &wildcards, double value)
Sets value of the nonzero parameters that match pattern ('*' allowed), or throws.

References IParametricComponent::createParameterTree(), IParametricComponent::m_pool, RealSpace::Particles::name(), and ParameterPool::setMatchedParametersValue().

Referenced by AsymRippleBuilder::buildSample(), and IParametricComponent::setVectorValue().

Here is the call graph for this function:

◆ setParent()

void INode::setParent ( const INode *  newParent)
virtualinherited

Reimplemented in SampleProvider.

Definition at line 79 of file INode.cpp.

80 {
81  m_parent = newParent;
82 }

References INode::m_parent.

Referenced by INode::registerChild(), SampleProvider::setBuilder(), and SampleProvider::setParent().

◆ setPolarization()

void Beam::setPolarization ( const kvector_t  bloch_vector)

Sets the polarization density matrix according to the given Bloch vector.

Definition at line 112 of file Beam.cpp.

113 {
114  if (bloch_vector.mag() > 1.0) {
115  throw std::runtime_error(
116  "Beam::setPolarization: "
117  "The given Bloch vector cannot represent a real physical ensemble");
118  }
119  m_bloch_vector = bloch_vector;
120 }
double mag() const
Returns magnitude of the vector.

References m_bloch_vector, and BasicVector3D< T >::mag().

Referenced by StandardSimulations::BasicGISAS00(), StandardSimulations::BasicPolarizedGISAS(), StandardSimulations::MaxiGISAS00(), StandardSimulations::MiniGISASPolarizationMM(), StandardSimulations::MiniGISASPolarizationMP(), StandardSimulations::MiniGISASPolarizationPM(), and StandardSimulations::MiniGISASPolarizationPP().

Here is the call graph for this function:

◆ setVectorValue()

void IParametricComponent::setVectorValue ( const std::string &  base_name,
kvector_t  value 
)
inherited

Definition at line 78 of file IParametricComponent.cpp.

79 {
83 }
void setParameterValue(const std::string &name, double value)

References ModelView::Utils::base_name(), IParametricComponent::setParameterValue(), BasicVector3D< T >::x(), IParametricComponent::XComponentName(), BasicVector3D< T >::y(), IParametricComponent::YComponentName(), BasicVector3D< T >::z(), and IParametricComponent::ZComponentName().

Here is the call graph for this function:

◆ setWavelength()

void Beam::setWavelength ( double  wavelength)

Definition at line 78 of file Beam.cpp.

79 {
80  if (wavelength <= 0.0)
81  throw std::runtime_error(
82  "Beam::setCentralK() -> Error. Wavelength can't be negative or zero.");
84 }

References m_wavelength, and wavelength().

Referenced by Instrument::setBeamParameters().

Here is the call graph for this function:

◆ treeToString()

std::string INode::treeToString ( ) const
virtualinherited

Returns multiline string representing tree structure below the node.

Definition at line 52 of file INode.cpp.

53 {
54  return NodeUtils::nodeToString(this);
55 }
std::string nodeToString(const INode *node)
Returns multiline string representing tree structure starting from given node.
Definition: NodeUtils.cpp:81

References NodeUtils::nodeToString().

Here is the call graph for this function:

◆ wavelength()

◆ XComponentName()

std::string IParametricComponent::XComponentName ( const std::string &  base_name)
staticinherited

Definition at line 103 of file IParametricComponent.cpp.

104 {
105  return base_name + "X";
106 }

References ModelView::Utils::base_name().

Referenced by Lattice3D::initialize(), IParticle::registerPosition(), IParametricComponent::registerVector(), IParametricComponent::removeVector(), IParametricComponent::setVectorValue(), and VectorParameterTranslator::translate().

Here is the call graph for this function:

◆ YComponentName()

std::string IParametricComponent::YComponentName ( const std::string &  base_name)
staticinherited

Definition at line 108 of file IParametricComponent.cpp.

109 {
110  return base_name + "Y";
111 }

References ModelView::Utils::base_name().

Referenced by IParametricComponent::registerVector(), IParametricComponent::removeVector(), IParametricComponent::setVectorValue(), and VectorParameterTranslator::translate().

Here is the call graph for this function:

◆ ZComponentName()

std::string IParametricComponent::ZComponentName ( const std::string &  base_name)
staticinherited

Definition at line 113 of file IParametricComponent.cpp.

114 {
115  return base_name + "Z";
116 }

References ModelView::Utils::base_name().

Referenced by IParametricComponent::registerVector(), IParametricComponent::removeVector(), IParametricComponent::setVectorValue(), and VectorParameterTranslator::translate().

Here is the call graph for this function:

Member Data Documentation

◆ m_alpha

double Beam::m_alpha
private

Definition at line 72 of file Beam.h.

Referenced by Beam(), direction(), operator=(), setDirection(), and setInclination().

◆ m_bloch_vector

kvector_t Beam::m_bloch_vector
private

Bloch vector encoding the beam's polarization.

Definition at line 75 of file Beam.h.

Referenced by Beam(), getBlochVector(), getPolarization(), operator=(), and setPolarization().

◆ m_intensity

double Beam::m_intensity
private

beam intensity (neutrons/sec)

Definition at line 69 of file Beam.h.

Referenced by Beam(), intensity(), operator=(), and setIntensity().

◆ m_name

std::string IParametricComponent::m_name
privateinherited

◆ m_NP

const size_t INode::m_NP
protectedinherited

Definition at line 88 of file INode.h.

Referenced by INode::INode().

◆ m_P

std::vector<double> INode::m_P
protectedinherited

Definition at line 89 of file INode.h.

Referenced by INode::INode(), and IFootprintFactor::setWidthRatio().

◆ m_parent

const INode* INode::m_parent {nullptr}
privateinherited

Definition at line 83 of file INode.h.

Referenced by INode::displayName(), INode::parent(), and INode::setParent().

◆ m_phi

double Beam::m_phi
private

Definition at line 73 of file Beam.h.

Referenced by Beam(), direction(), operator=(), and setDirection().

◆ m_pool

◆ m_shape_factor

std::unique_ptr<IFootprintFactor> Beam::m_shape_factor
private

footprint correction handler

Definition at line 74 of file Beam.h.

Referenced by Beam(), footprintFactor(), getChildren(), operator=(), and setFootprintFactor().

◆ m_wavelength

double Beam::m_wavelength
private

Definition at line 70 of file Beam.h.

Referenced by Beam(), getCentralK(), operator=(), setWavelength(), and wavelength().


The documentation for this class was generated from the following files: