BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
FormFactorDWBAPol Class Referencefinal
Inheritance diagram for FormFactorDWBAPol:
Collaboration diagram for FormFactorDWBAPol:

Public Member Functions

 FormFactorDWBAPol (const IFormFactor &form_factor)
 
 ~FormFactorDWBAPol () override
 
FormFactorDWBAPolclone () const override
 
void accept (INodeVisitor *visitor) const override
 
void setAmbientMaterial (const Material &material) override
 
complex_t evaluate (const WavevectorInfo &wavevectors) const override
 
Eigen::Matrix2cd evaluatePol (const WavevectorInfo &wavevectors) const override
 
double volume () const override
 
double radialExtension () const override
 
double bottomZ (const IRotation &rotation) const override
 
double topZ (const IRotation &rotation) const override
 
void setSpecularInfo (std::unique_ptr< const ILayerRTCoefficients > p_in_coeffs, std::unique_ptr< const ILayerRTCoefficients > p_out_coeffs) override
 
IFormFactorcreateSlicedFormFactor (ZLimits limits, const IRotation &rot, kvector_t translation) const
 
virtual const Materialmaterial () const
 
std::vector< const Material * > containedMaterials () const
 
virtual void transferToCPP ()
 
virtual std::string treeToString () const
 
void registerChild (INode *node)
 
virtual std::vector< const INode * > getChildren () const
 
virtual void setParent (const INode *newParent)
 
const INodeparent () const
 
INodeparent ()
 
int copyNumber (const INode *node) const
 
std::string displayName () const
 
ParameterPoolcreateParameterTree () const
 
ParameterPoolparameterPool () const
 
std::string parametersToString () const
 
RealParameterregisterParameter (const std::string &name, double *parpointer)
 
void registerVector (const std::string &base_name, kvector_t *p_vec, const std::string &units="nm")
 
void setParameterValue (const std::string &name, double value)
 
void setVectorValue (const std::string &base_name, kvector_t value)
 
RealParameterparameter (const std::string &name) const
 
virtual void onChange ()
 
void removeParameter (const std::string &name)
 
void removeVector (const std::string &base_name)
 
void setName (const std::string &name)
 
const std::string & getName () const
 

Static Public Member Functions

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 Member Functions

virtual bool canSliceAnalytically (const IRotation &rot) const
 
virtual IFormFactorsliceFormFactor (ZLimits limits, const IRotation &rot, kvector_t translation) const
 

Protected Attributes

const size_t m_NP
 
std::vector< double > m_P
 

Private Attributes

std::unique_ptr< IFormFactormP_form_factor
 
std::unique_ptr< const ILayerRTCoefficientsmp_in_coeffs
 
std::unique_ptr< const ILayerRTCoefficientsmp_out_coeffs
 
const INodem_parent {nullptr}
 
std::string m_name
 
std::unique_ptr< ParameterPoolm_pool
 

Friends

class TestPolarizedDWBATerms
 

Detailed Description

Evaluates the coherent sum of the 16 matrix DWBA terms in a polarized IFormFactor.

Definition at line 27 of file FormFactorDWBAPol.h.

Constructor & Destructor Documentation

◆ FormFactorDWBAPol()

FormFactorDWBAPol::FormFactorDWBAPol ( const IFormFactor form_factor)

Definition at line 28 of file FormFactorDWBAPol.cpp.

29  : mP_form_factor(form_factor.clone())
30 {
31  setName("FormFactorDWBAPol");
32 }
std::unique_ptr< IFormFactor > mP_form_factor
The form factor for BA.
IFormFactor * clone() const override=0
Returns a clone of this ISample object.
void setName(const std::string &name)

References IParameterized::setName().

Referenced by clone().

Here is the call graph for this function:

◆ ~FormFactorDWBAPol()

FormFactorDWBAPol::~FormFactorDWBAPol ( )
overridedefault

Member Function Documentation

◆ clone()

FormFactorDWBAPol * FormFactorDWBAPol::clone ( ) const
overridevirtual

Returns a clone of this ISample object.

Implements IFormFactor.

Definition at line 36 of file FormFactorDWBAPol.cpp.

37 {
39  std::unique_ptr<const ILayerRTCoefficients> p_in_coefs =
40  mp_in_coeffs ? std::unique_ptr<const ILayerRTCoefficients>(mp_in_coeffs->clone()) : nullptr;
41  std::unique_ptr<const ILayerRTCoefficients> p_out_coefs =
42  mp_out_coeffs ? std::unique_ptr<const ILayerRTCoefficients>(mp_out_coeffs->clone())
43  : nullptr;
44  p_result->setSpecularInfo(std::move(p_in_coefs), std::move(p_out_coefs));
45  return p_result;
46 }
Evaluates the coherent sum of the 16 matrix DWBA terms in a polarized IFormFactor.
std::unique_ptr< const ILayerRTCoefficients > mp_in_coeffs
std::unique_ptr< const ILayerRTCoefficients > mp_out_coeffs
FormFactorDWBAPol(const IFormFactor &form_factor)
void setSpecularInfo(std::unique_ptr< const ILayerRTCoefficients > p_in_coeffs, std::unique_ptr< const ILayerRTCoefficients > p_out_coeffs) override
Sets reflection/transmission info.

References FormFactorDWBAPol(), mP_form_factor, mp_in_coeffs, mp_out_coeffs, and setSpecularInfo().

Here is the call graph for this function:

◆ accept()

void FormFactorDWBAPol::accept ( INodeVisitor visitor) const
inlineoverridevirtual

Calls the INodeVisitor's visit method.

Implements INode.

Definition at line 35 of file FormFactorDWBAPol.h.

35 { visitor->visit(this); }
virtual void visit(const BasicLattice *)
Definition: INodeVisitor.h:154

References INodeVisitor::visit().

Here is the call graph for this function:

◆ setAmbientMaterial()

void FormFactorDWBAPol::setAmbientMaterial ( const Material )
inlineoverridevirtual

Passes the material in which this particle is embedded.

Implements IFormFactor.

Definition at line 37 of file FormFactorDWBAPol.h.

38  {
39  mP_form_factor->setAmbientMaterial(material);
40  }
virtual const Material * material() const
Returns nullptr, unless overwritten to return a specific material.
Definition: ISample.h:37

References ISample::material(), and mP_form_factor.

Here is the call graph for this function:

◆ evaluate()

complex_t FormFactorDWBAPol::evaluate ( const WavevectorInfo wavevectors) const
overridevirtual

Throws not-implemented exception.

Implements IFormFactor.

Definition at line 48 of file FormFactorDWBAPol.cpp.

49 {
51  "FormFactorDWBAPol::evaluate: should never be called for matrix interactions");
52 }

◆ evaluatePol()

Eigen::Matrix2cd FormFactorDWBAPol::evaluatePol ( const WavevectorInfo wavevectors) const
overridevirtual

Calculates and returns a polarized form factor calculation in DWBA.

Reimplemented from IFormFactor.

Definition at line 54 of file FormFactorDWBAPol.cpp.

55 {
56  // the required wavevectors inside the layer for
57  // different eigenmodes and in- and outgoing wavevector;
58  complex_t kix = wavevectors.getKi().x();
59  complex_t kiy = wavevectors.getKi().y();
60  cvector_t ki_1R(kix, kiy, mp_in_coeffs->getKz()(0));
61  cvector_t ki_1T(kix, kiy, -mp_in_coeffs->getKz()(0));
62  cvector_t ki_2R(kix, kiy, mp_in_coeffs->getKz()(1));
63  cvector_t ki_2T(kix, kiy, -mp_in_coeffs->getKz()(1));
64 
65  cvector_t kf_1R = wavevectors.getKf();
66  kf_1R.setZ(-(complex_t)mp_out_coeffs->getKz()(0));
67  cvector_t kf_1T = kf_1R;
68  kf_1T.setZ((complex_t)mp_out_coeffs->getKz()(0));
69  cvector_t kf_2R = kf_1R;
70  kf_2R.setZ(-(complex_t)mp_out_coeffs->getKz()(1));
71  cvector_t kf_2T = kf_1R;
72  kf_2T.setZ((complex_t)mp_out_coeffs->getKz()(1));
73  // now each of the 16 matrix terms of the polarized DWBA is calculated:
74  // NOTE: when the underlying reflection/transmission coefficients are
75  // scalar, the eigenmodes have identical eigenvalues and spin polarization
76  // is used as a basis; in this case however the matrices get mixed:
77  // real m_M11 = calculated m_M12
78  // real m_M12 = calculated m_M11
79  // real m_M21 = calculated m_M22
80  // real m_M22 = calculated m_M21
81  // since both eigenvalues are identical, this does not influence the result.
82  Eigen::Matrix2cd ff_BA;
83 
84  double wavelength = wavevectors.getWavelength();
85 
86  // The following matrices each contain the four polarization conditions
87  // (p->p, p->m, m->p, m->m)
88  // The first two indices indicate a scattering from the 1/2 eigenstate into
89  // the 1/2 eigenstate, while the capital indices indicate a reflection
90  // before and/or after the scattering event (first index is in-state,
91  // second is out-state; this also applies to the internal matrix indices)
92  Eigen::Matrix2cd M11_S, M11_RS, M11_SR, M11_RSR, M12_S, M12_RS, M12_SR, M12_RSR, M21_S, M21_RS,
93  M21_SR, M21_RSR, M22_S, M22_RS, M22_SR, M22_RSR;
94 
95  // eigenmode 1 -> eigenmode 1: direct scattering
96  ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_1T, kf_1T, wavelength));
97  M11_S(0, 0) = -VecMatVecProduct(mp_out_coeffs->T1min(), ff_BA, mp_in_coeffs->T1plus());
98  M11_S(0, 1) = VecMatVecProduct(mp_out_coeffs->T1plus(), ff_BA, mp_in_coeffs->T1plus());
99  M11_S(1, 0) = -VecMatVecProduct(mp_out_coeffs->T1min(), ff_BA, mp_in_coeffs->T1min());
100  M11_S(1, 1) = VecMatVecProduct(mp_out_coeffs->T1plus(), ff_BA, mp_in_coeffs->T1min());
101  // eigenmode 1 -> eigenmode 1: reflection and then scattering
102  ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_1R, kf_1T, wavelength));
103  M11_RS(0, 0) = -VecMatVecProduct(mp_out_coeffs->T1min(), ff_BA, mp_in_coeffs->R1plus());
104  M11_RS(0, 1) = VecMatVecProduct(mp_out_coeffs->T1plus(), ff_BA, mp_in_coeffs->R1plus());
105  M11_RS(1, 0) = -VecMatVecProduct(mp_out_coeffs->T1min(), ff_BA, mp_in_coeffs->R1min());
106  M11_RS(1, 1) = VecMatVecProduct(mp_out_coeffs->T1plus(), ff_BA, mp_in_coeffs->R1min());
107  // eigenmode 1 -> eigenmode 1: scattering and then reflection
108  ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_1T, kf_1R, wavelength));
109  M11_SR(0, 0) = -VecMatVecProduct(mp_out_coeffs->R1min(), ff_BA, mp_in_coeffs->T1plus());
110  M11_SR(0, 1) = VecMatVecProduct(mp_out_coeffs->R1plus(), ff_BA, mp_in_coeffs->T1plus());
111  M11_SR(1, 0) = -VecMatVecProduct(mp_out_coeffs->R1min(), ff_BA, mp_in_coeffs->T1min());
112  M11_SR(1, 1) = VecMatVecProduct(mp_out_coeffs->R1plus(), ff_BA, mp_in_coeffs->T1min());
113  // eigenmode 1 -> eigenmode 1: reflection, scattering and again reflection
114  ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_1R, kf_1R, wavelength));
115  M11_RSR(0, 0) = -VecMatVecProduct(mp_out_coeffs->R1min(), ff_BA, mp_in_coeffs->R1plus());
116  M11_RSR(0, 1) = VecMatVecProduct(mp_out_coeffs->R1plus(), ff_BA, mp_in_coeffs->R1plus());
117  M11_RSR(1, 0) = -VecMatVecProduct(mp_out_coeffs->R1min(), ff_BA, mp_in_coeffs->R1min());
118  M11_RSR(1, 1) = VecMatVecProduct(mp_out_coeffs->R1plus(), ff_BA, mp_in_coeffs->R1min());
119 
120  // eigenmode 1 -> eigenmode 2: direct scattering
121  ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_1T, kf_2T, wavelength));
122  M12_S(0, 0) = -VecMatVecProduct(mp_out_coeffs->T2min(), ff_BA, mp_in_coeffs->T1plus());
123  M12_S(0, 1) = VecMatVecProduct(mp_out_coeffs->T2plus(), ff_BA, mp_in_coeffs->T1plus());
124  M12_S(1, 0) = -VecMatVecProduct(mp_out_coeffs->T2min(), ff_BA, mp_in_coeffs->T1min());
125  M12_S(1, 1) = VecMatVecProduct(mp_out_coeffs->T2plus(), ff_BA, mp_in_coeffs->T1min());
126  // eigenmode 1 -> eigenmode 2: reflection and then scattering
127  ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_1R, kf_2T, wavelength));
128  M12_RS(0, 0) = -VecMatVecProduct(mp_out_coeffs->T2min(), ff_BA, mp_in_coeffs->R1plus());
129  M12_RS(0, 1) = VecMatVecProduct(mp_out_coeffs->T2plus(), ff_BA, mp_in_coeffs->R1plus());
130  M12_RS(1, 0) = -VecMatVecProduct(mp_out_coeffs->T2min(), ff_BA, mp_in_coeffs->R1min());
131  M12_RS(1, 1) = VecMatVecProduct(mp_out_coeffs->T2plus(), ff_BA, mp_in_coeffs->R1min());
132  // eigenmode 1 -> eigenmode 2: scattering and then reflection
133  ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_1T, kf_2R, wavelength));
134  M12_SR(0, 0) = -VecMatVecProduct(mp_out_coeffs->R2min(), ff_BA, mp_in_coeffs->T1plus());
135  M12_SR(0, 1) = VecMatVecProduct(mp_out_coeffs->R2plus(), ff_BA, mp_in_coeffs->T1plus());
136  M12_SR(1, 0) = -VecMatVecProduct(mp_out_coeffs->R2min(), ff_BA, mp_in_coeffs->T1min());
137  M12_SR(1, 1) = VecMatVecProduct(mp_out_coeffs->R2plus(), ff_BA, mp_in_coeffs->T1min());
138  // eigenmode 1 -> eigenmode 2: reflection, scattering and again reflection
139  ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_1R, kf_2R, wavelength));
140  M12_RSR(0, 0) = -VecMatVecProduct(mp_out_coeffs->R2min(), ff_BA, mp_in_coeffs->R1plus());
141  M12_RSR(0, 1) = VecMatVecProduct(mp_out_coeffs->R2plus(), ff_BA, mp_in_coeffs->R1plus());
142  M12_RSR(1, 0) = -VecMatVecProduct(mp_out_coeffs->R2min(), ff_BA, mp_in_coeffs->R1min());
143  M12_RSR(1, 1) = VecMatVecProduct(mp_out_coeffs->R2plus(), ff_BA, mp_in_coeffs->R1min());
144 
145  // eigenmode 2 -> eigenmode 1: direct scattering
146  ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_2T, kf_1T, wavelength));
147  M21_S(0, 0) = -VecMatVecProduct(mp_out_coeffs->T1min(), ff_BA, mp_in_coeffs->T2plus());
148  M21_S(0, 1) = VecMatVecProduct(mp_out_coeffs->T1plus(), ff_BA, mp_in_coeffs->T2plus());
149  M21_S(1, 0) = -VecMatVecProduct(mp_out_coeffs->T1min(), ff_BA, mp_in_coeffs->T2min());
150  M21_S(1, 1) = VecMatVecProduct(mp_out_coeffs->T1plus(), ff_BA, mp_in_coeffs->T2min());
151  // eigenmode 2 -> eigenmode 1: reflection and then scattering
152  ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_2R, kf_1T, wavelength));
153  M21_RS(0, 0) = -VecMatVecProduct(mp_out_coeffs->T1min(), ff_BA, mp_in_coeffs->R2plus());
154  M21_RS(0, 1) = VecMatVecProduct(mp_out_coeffs->T1plus(), ff_BA, mp_in_coeffs->R2plus());
155  M21_RS(1, 0) = -VecMatVecProduct(mp_out_coeffs->T1min(), ff_BA, mp_in_coeffs->R2min());
156  M21_RS(1, 1) = VecMatVecProduct(mp_out_coeffs->T1plus(), ff_BA, mp_in_coeffs->R2min());
157  // eigenmode 2 -> eigenmode 1: scattering and then reflection
158  ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_2T, kf_1R, wavelength));
159  M21_SR(0, 0) = -VecMatVecProduct(mp_out_coeffs->R1min(), ff_BA, mp_in_coeffs->T2plus());
160  M21_SR(0, 1) = VecMatVecProduct(mp_out_coeffs->R1plus(), ff_BA, mp_in_coeffs->T2plus());
161  M21_SR(1, 0) = -VecMatVecProduct(mp_out_coeffs->R1min(), ff_BA, mp_in_coeffs->T2min());
162  M21_SR(1, 1) = VecMatVecProduct(mp_out_coeffs->R1plus(), ff_BA, mp_in_coeffs->T2min());
163  // eigenmode 2 -> eigenmode 1: reflection, scattering and again reflection
164  ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_2R, kf_1R, wavelength));
165  M21_RSR(0, 0) = -VecMatVecProduct(mp_out_coeffs->R1min(), ff_BA, mp_in_coeffs->R2plus());
166  M21_RSR(0, 1) = VecMatVecProduct(mp_out_coeffs->R1plus(), ff_BA, mp_in_coeffs->R2plus());
167  M21_RSR(1, 0) = -VecMatVecProduct(mp_out_coeffs->R1min(), ff_BA, mp_in_coeffs->R2min());
168  M21_RSR(1, 1) = VecMatVecProduct(mp_out_coeffs->R1plus(), ff_BA, mp_in_coeffs->R2min());
169 
170  // eigenmode 2 -> eigenmode 2: direct scattering
171  ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_2T, kf_2T, wavelength));
172  M22_S(0, 0) = -VecMatVecProduct(mp_out_coeffs->T2min(), ff_BA, mp_in_coeffs->T2plus());
173  M22_S(0, 1) = VecMatVecProduct(mp_out_coeffs->T2plus(), ff_BA, mp_in_coeffs->T2plus());
174  M22_S(1, 0) = -VecMatVecProduct(mp_out_coeffs->T2min(), ff_BA, mp_in_coeffs->T2min());
175  M22_S(1, 1) = VecMatVecProduct(mp_out_coeffs->T2plus(), ff_BA, mp_in_coeffs->T2min());
176  // eigenmode 2 -> eigenmode 2: reflection and then scattering
177  ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_2R, kf_2T, wavelength));
178  M22_RS(0, 0) = -VecMatVecProduct(mp_out_coeffs->T2min(), ff_BA, mp_in_coeffs->R2plus());
179  M22_RS(0, 1) = VecMatVecProduct(mp_out_coeffs->T2plus(), ff_BA, mp_in_coeffs->R2plus());
180  M22_RS(1, 0) = -VecMatVecProduct(mp_out_coeffs->T2min(), ff_BA, mp_in_coeffs->R2min());
181  M22_RS(1, 1) = VecMatVecProduct(mp_out_coeffs->T2plus(), ff_BA, mp_in_coeffs->R2min());
182  // eigenmode 2 -> eigenmode 2: scattering and then reflection
183  ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_2T, kf_2R, wavelength));
184  M22_SR(0, 0) = -VecMatVecProduct(mp_out_coeffs->R2min(), ff_BA, mp_in_coeffs->T2plus());
185  M22_SR(0, 1) = VecMatVecProduct(mp_out_coeffs->R2plus(), ff_BA, mp_in_coeffs->T2plus());
186  M22_SR(1, 0) = -VecMatVecProduct(mp_out_coeffs->R2min(), ff_BA, mp_in_coeffs->T2min());
187  M22_SR(1, 1) = VecMatVecProduct(mp_out_coeffs->R2plus(), ff_BA, mp_in_coeffs->T2min());
188  // eigenmode 2 -> eigenmode 2: reflection, scattering and again reflection
189  ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_2R, kf_2R, wavelength));
190  M22_RSR(0, 0) = -VecMatVecProduct(mp_out_coeffs->R2min(), ff_BA, mp_in_coeffs->R2plus());
191  M22_RSR(0, 1) = VecMatVecProduct(mp_out_coeffs->R2plus(), ff_BA, mp_in_coeffs->R2plus());
192  M22_RSR(1, 0) = -VecMatVecProduct(mp_out_coeffs->R2min(), ff_BA, mp_in_coeffs->R2min());
193  M22_RSR(1, 1) = VecMatVecProduct(mp_out_coeffs->R2plus(), ff_BA, mp_in_coeffs->R2min());
194 
195  return M11_S + M11_RS + M11_SR + M11_RSR + M12_S + M12_RS + M12_SR + M12_RSR + M21_S + M21_RS
196  + M21_SR + M21_RSR + M22_S + M22_RS + M22_SR + M22_RSR;
197 }
std::complex< double > complex_t
Definition: Complex.h:20
T y() const
Returns y-component in cartesian coordinate system.
Definition: BasicVector3D.h:66
T x() const
Returns x-component in cartesian coordinate system.
Definition: BasicVector3D.h:64
void setZ(const T &a)
Sets z-component in cartesian coordinate system.
Definition: BasicVector3D.h:75
Holds all wavevector information relevant for calculating form factors.
cvector_t getKf() const
cvector_t getKi() const
double getWavelength() const
std::complex< double > VecMatVecProduct(const Eigen::Vector2cd &vec1, const Eigen::Matrix2cd &ff, const Eigen::Vector2cd &vec2)

References WavevectorInfo::getKf(), WavevectorInfo::getKi(), WavevectorInfo::getWavelength(), mP_form_factor, mp_in_coeffs, mp_out_coeffs, BasicVector3D< T >::setZ(), anonymous_namespace{FormFactorDWBAPol.cpp}::VecMatVecProduct(), anonymous_namespace{SlicedCylindersBuilder.cpp}::wavelength(), BasicVector3D< T >::x(), and BasicVector3D< T >::y().

Here is the call graph for this function:

◆ volume()

double FormFactorDWBAPol::volume ( ) const
inlineoverridevirtual

Returns the total volume of the particle of this form factor's shape.

Reimplemented from IFormFactor.

Definition at line 48 of file FormFactorDWBAPol.h.

48 { return mP_form_factor->volume(); }

References mP_form_factor.

◆ radialExtension()

double FormFactorDWBAPol::radialExtension ( ) const
inlineoverridevirtual

Returns the (approximate in some cases) radial size of the particle of this form factor's shape.

This is used for SSCA calculations

Implements IFormFactor.

Definition at line 50 of file FormFactorDWBAPol.h.

50 { return mP_form_factor->radialExtension(); }

References mP_form_factor.

◆ bottomZ()

double FormFactorDWBAPol::bottomZ ( const IRotation rotation) const
overridevirtual

Returns the z-coordinate of the lowest point in this shape after a given rotation.

Implements IFormFactor.

Definition at line 199 of file FormFactorDWBAPol.cpp.

200 {
201  return mP_form_factor->bottomZ(rotation);
202 }

References mP_form_factor.

◆ topZ()

double FormFactorDWBAPol::topZ ( const IRotation rotation) const
overridevirtual

Returns the z-coordinate of the lowest point in this shape after a given rotation.

Implements IFormFactor.

Definition at line 204 of file FormFactorDWBAPol.cpp.

205 {
206  return mP_form_factor->topZ(rotation);
207 }

References mP_form_factor.

◆ setSpecularInfo()

void FormFactorDWBAPol::setSpecularInfo ( std::unique_ptr< const ILayerRTCoefficients ,
std::unique_ptr< const ILayerRTCoefficients  
)
overridevirtual

Sets reflection/transmission info.

Reimplemented from IFormFactor.

Definition at line 209 of file FormFactorDWBAPol.cpp.

211 {
212  mp_in_coeffs = std::move(p_in_coeffs);
213  mp_out_coeffs = std::move(p_out_coeffs);
214 }

References mp_in_coeffs, and mp_out_coeffs.

Referenced by clone().

◆ createSlicedFormFactor()

IFormFactor * IFormFactor::createSlicedFormFactor ( ZLimits  limits,
const IRotation rot,
kvector_t  translation 
) const
inherited

Creates a (possibly sliced) form factor with the given rotation and translation.

Definition at line 35 of file IFormFactor.cpp.

37 {
38  if (ShapeIsContainedInLimits(*this, limits, rot, translation))
39  return createTransformedFormFactor(*this, rot, translation);
40  if (ShapeOutsideLimits(*this, limits, rot, translation))
41  return nullptr;
42  if (canSliceAnalytically(rot))
43  return sliceFormFactor(limits, rot, translation);
44  throw std::runtime_error(getName()
45  + "::createSlicedFormFactor error: not supported for "
46  "the given rotation!");
47 }
IFormFactor * createTransformedFormFactor(const IFormFactor &formfactor, const IRotation &rot, kvector_t translation)
Definition: IFormFactor.cpp:77
virtual IFormFactor * sliceFormFactor(ZLimits limits, const IRotation &rot, kvector_t translation) const
Actually slices the form factor or throws an exception.
Definition: IFormFactor.cpp:72
virtual bool canSliceAnalytically(const IRotation &rot) const
Checks if slicing has a fast analytical solution.
Definition: IFormFactor.cpp:67
const std::string & getName() const
bool ShapeIsContainedInLimits(const IFormFactor &formfactor, ZLimits limits, const IRotation &rot, kvector_t translation)
Definition: IFormFactor.cpp:94
bool ShapeOutsideLimits(const IFormFactor &formfactor, ZLimits limits, const IRotation &rot, kvector_t translation)

References IFormFactor::canSliceAnalytically(), createTransformedFormFactor(), IParameterized::getName(), anonymous_namespace{IFormFactor.cpp}::ShapeIsContainedInLimits(), anonymous_namespace{IFormFactor.cpp}::ShapeOutsideLimits(), and IFormFactor::sliceFormFactor().

Here is the call graph for this function:

◆ canSliceAnalytically()

bool IFormFactor::canSliceAnalytically ( const IRotation rot) const
protectedvirtualinherited

Checks if slicing has a fast analytical solution.

Reimplemented in IFormFactorBorn, FormFactorFullSphere, and FormFactorDot.

Definition at line 67 of file IFormFactor.cpp.

68 {
69  return false;
70 }

Referenced by IFormFactor::createSlicedFormFactor().

◆ sliceFormFactor()

IFormFactor * IFormFactor::sliceFormFactor ( ZLimits  limits,
const IRotation rot,
kvector_t  translation 
) const
protectedvirtualinherited

Actually slices the form factor or throws an exception.

Reimplemented in FormFactorTruncatedSpheroid, FormFactorTruncatedSphere, FormFactorTetrahedron, FormFactorPyramid, FormFactorPrism6, FormFactorPrism3, FormFactorLongBoxLorentz, FormFactorLongBoxGauss, FormFactorFullSpheroid, FormFactorFullSphere, FormFactorEllipsoidalCylinder, FormFactorCylinder, FormFactorCuboctahedron, FormFactorCone6, FormFactorCone, FormFactorBox, and FormFactorAnisoPyramid.

Definition at line 72 of file IFormFactor.cpp.

73 {
74  throw std::runtime_error(getName() + "::sliceFormFactor error: not implemented!");
75 }

References IParameterized::getName().

Referenced by IFormFactor::createSlicedFormFactor().

Here is the call graph for this function:

◆ material()

◆ containedMaterials()

std::vector< const Material * > ISample::containedMaterials ( ) const
inherited

Returns set of unique materials contained in this ISample.

Definition at line 23 of file ISample.cpp.

24 {
25  std::vector<const Material*> result;
26  if (const Material* p_material = material())
27  result.push_back(p_material);
28  for (auto child : getChildren()) {
29  if (const ISample* sample = dynamic_cast<const ISample*>(child)) {
30  for (const Material* p_material : sample->containedMaterials())
31  result.push_back(p_material);
32  }
33  }
34  return result;
35 }
virtual std::vector< const INode * > getChildren() const
Returns a vector of children (const).
Definition: INode.cpp:64
Pure virtual base class for sample components and properties related to scattering.
Definition: ISample.h:28
A wrapper for underlying material implementation.
Definition: Material.h:29

References INode::getChildren(), and ISample::material().

Referenced by MultiLayerUtils::ContainsCompatibleMaterials(), anonymous_namespace{ProcessedSample.cpp}::ContainsMagneticMaterial(), and SampleToPython::initLabels().

Here is the call graph for this function:

◆ transferToCPP()

virtual void ICloneable::transferToCPP ( )
inlinevirtualinherited

Used for Python overriding of clone (see swig/tweaks.py)

Definition at line 34 of file ICloneable.h.

◆ treeToString()

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

Returns multiline string representing tree structure below the node.

Definition at line 53 of file INode.cpp.

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

References NodeUtils::nodeToString().

Here is the call graph for this function:

◆ registerChild()

void INode::registerChild ( INode node)
inherited

Definition at line 58 of file INode.cpp.

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

References ASSERT, and INode::setParent().

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

Here is the call graph for this function:

◆ getChildren()

◆ setParent()

void INode::setParent ( const INode newParent)
virtualinherited

Reimplemented in SampleProvider.

Definition at line 69 of file INode.cpp.

70 {
71  m_parent = newParent;
72 }
const INode * m_parent
Definition: INode.h:81

References INode::m_parent.

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

◆ parent() [1/2]

const INode * INode::parent ( ) const
inherited

◆ parent() [2/2]

INode * INode::parent ( )
inherited

Definition at line 79 of file INode.cpp.

80 {
81  return const_cast<INode*>(m_parent);
82 }
Base class for tree-like structures containing parameterized objects.
Definition: INode.h:49

References INode::m_parent.

◆ 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 84 of file INode.cpp.

85 {
86  if (node->parent() != this)
87  return -1;
88 
89  int result(-1), count(0);
90  for (auto child : getChildren()) {
91 
92  if (child == nullptr)
93  throw std::runtime_error("INode::copyNumber() -> Error. Nullptr as child.");
94 
95  if (child == node)
96  result = count;
97 
98  if (child->getName() == node->getName())
99  ++count;
100  }
101 
102  return count > 1 ? result : -1;
103 }
const INode * parent() const
Definition: INode.cpp:74

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

Referenced by INode::displayName().

Here is the call graph for this function:

◆ displayName()

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

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

Definition at line 105 of file INode.cpp.

106 {
107  std::string result = getName();
108  if (m_parent) {
109  int index = m_parent->copyNumber(this);
110  if (index >= 0)
111  result = result + std::to_string(index);
112  }
113  return result;
114 }
int copyNumber(const INode *node) const
Returns copyNumber of child, which takes into account existence of children with same name.
Definition: INode.cpp:84

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

Referenced by NodeUtils::nodePath(), and anonymous_namespace{NodeUtils.cpp}::nodeString().

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 IParameterized.

Definition at line 116 of file INode.cpp.

117 {
118  std::unique_ptr<ParameterPool> result(new ParameterPool);
119 
121  it.first();
122  while (!it.isDone()) {
123  const INode* child = it.getCurrent();
124  const std::string path = NodeUtils::nodePath(*child, this->parent()) + "/";
125  child->parameterPool()->copyToExternalPool(path, result.get());
126  it.next();
127  }
128 
129  return result.release();
130 }
ParameterPool * parameterPool() const
Returns pointer to the parameter pool.
Iterator through INode tree of objects.
Definition: NodeIterator.h:90
Container with parameters for IParameterized object.
Definition: ParameterPool.h:30
void copyToExternalPool(const std::string &prefix, ParameterPool *other_pool) const
Copies parameters of given pool to other pool, prepeding prefix to the parameter names.
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:82

References ParameterPool::copyToExternalPool(), NodeIterator< Strategy >::first(), NodeIterator< Strategy >::getCurrent(), NodeIterator< Strategy >::isDone(), NodeIterator< Strategy >::next(), NodeUtils::nodePath(), IParameterized::parameterPool(), and INode::parent().

Referenced by ParticleDistribution::generateParticles(), Simulation::runSimulation(), DepthProbeSimulation::validateParametrization(), OffSpecSimulation::validateParametrization(), and SpecularSimulation::validateParametrization().

Here is the call graph for this function:

◆ parameterPool()

ParameterPool* IParameterized::parameterPool ( ) const
inlineinherited

Returns pointer to the parameter pool.

Definition at line 38 of file IParameterized.h.

38 { return m_pool.get(); } // has non-const usages!
std::unique_ptr< ParameterPool > m_pool
parameter pool (kind of pointer-to-implementation)

References IParameterized::m_pool.

Referenced by pyfmt2::argumentList(), SampleBuilderNode::borrow_builder_parameters(), INode::createParameterTree(), INode::INode(), IParameterized::IParameterized(), anonymous_namespace{NodeUtils.cpp}::poolToString(), SampleBuilderNode::reset(), and IDistribution1D::setUnits().

◆ parametersToString()

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

Returns multiline string representing available parameters.

Definition at line 40 of file IParameterized.cpp.

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

References IParameterized::createParameterTree().

Here is the call graph for this function:

◆ registerParameter()

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

Definition at line 48 of file IParameterized.cpp.

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

References IParameterized::getName(), IParameterized::m_pool, and IParameterized::onChange().

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

Here is the call graph for this function:

◆ registerVector()

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

Definition at line 54 of file IParameterized.cpp.

56 {
57  registerParameter(XComponentName(base_name), &((*p_vec)[0])).setUnit(units);
58  registerParameter(YComponentName(base_name), &((*p_vec)[1])).setUnit(units);
59  registerParameter(ZComponentName(base_name), &((*p_vec)[2])).setUnit(units);
60 }
RealParameter & registerParameter(const std::string &name, double *parpointer)
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)
RealParameter & setUnit(const std::string &name)

References IParameterized::registerParameter(), RealParameter::setUnit(), IParameterized::XComponentName(), IParameterized::YComponentName(), and IParameterized::ZComponentName().

Referenced by Beam::Beam(), DetectionProperties::DetectionProperties(), InterferenceFunctionTwin::InterferenceFunctionTwin(), MultiLayer::MultiLayer(), Lattice::registerBasisVectors(), and IParticle::registerPosition().

Here is the call graph for this function:

◆ setParameterValue()

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

Definition at line 62 of file IParameterized.cpp.

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

References IParameterized::createParameterTree(), IParameterized::m_pool, and ParameterPool::setMatchedParametersValue().

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

Here is the call graph for this function:

◆ setVectorValue()

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

Definition at line 75 of file IParameterized.cpp.

76 {
77  setParameterValue(XComponentName(base_name), value.x());
78  setParameterValue(YComponentName(base_name), value.y());
79  setParameterValue(ZComponentName(base_name), value.z());
80 }
T z() const
Returns z-component in cartesian coordinate system.
Definition: BasicVector3D.h:68
void setParameterValue(const std::string &name, double value)

References IParameterized::setParameterValue(), BasicVector3D< T >::x(), IParameterized::XComponentName(), BasicVector3D< T >::y(), IParameterized::YComponentName(), BasicVector3D< T >::z(), and IParameterized::ZComponentName().

Here is the call graph for this function:

◆ parameter()

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

◆ onChange()

◆ removeParameter()

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

◆ removeVector()

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

Definition at line 93 of file IParameterized.cpp.

94 {
95  removeParameter(XComponentName(base_name));
96  removeParameter(YComponentName(base_name));
97  removeParameter(ZComponentName(base_name));
98 }
void removeParameter(const std::string &name)

References IParameterized::removeParameter(), IParameterized::XComponentName(), IParameterized::YComponentName(), and IParameterized::ZComponentName().

Referenced by IParticle::registerPosition().

Here is the call graph for this function:

◆ XComponentName()

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

◆ YComponentName()

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

Definition at line 105 of file IParameterized.cpp.

106 {
107  return base_name + "Y";
108 }

Referenced by IParameterized::registerVector(), IParameterized::removeVector(), and IParameterized::setVectorValue().

◆ ZComponentName()

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

Definition at line 110 of file IParameterized.cpp.

111 {
112  return base_name + "Z";
113 }

Referenced by IParameterized::registerVector(), IParameterized::removeVector(), and IParameterized::setVectorValue().

◆ setName()

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

Definition at line 68 of file IParameterized.h.

68 { m_name = name; }
std::string m_name

References IParameterized::m_name.

Referenced by BasicLattice::BasicLattice(), Beam::Beam(), Layer::clone(), ConvolutionDetectorResolution::ConvolutionDetectorResolution(), LayersWithAbsorptionBuilder::createSampleByIndex(), Basic2DParaCrystalBuilder::createSampleByIndex(), ParticleInVacuumBuilder::createSampleByIndex(), SimpleMagneticRotationBuilder::createSampleByIndex(), Crystal::Crystal(), DetectionProperties::DetectionProperties(), DistributionHandler::DistributionHandler(), FormFactorBAPol::FormFactorBAPol(), FormFactorCoreShell::FormFactorCoreShell(), FormFactorCrystal::FormFactorCrystal(), FormFactorDecoratorMaterial::FormFactorDecoratorMaterial(), FormFactorDecoratorPositionFactor::FormFactorDecoratorPositionFactor(), FormFactorDecoratorRotation::FormFactorDecoratorRotation(), FormFactorDWBA::FormFactorDWBA(), FormFactorDWBAPol(), FormFactorWeighted::FormFactorWeighted(), HexagonalLattice::HexagonalLattice(), IDetector::IDetector(), DepthProbeSimulation::initialize(), GISASSimulation::initialize(), OffSpecSimulation::initialize(), SpecularSimulation::initialize(), SpecularDetector1D::initialize(), MesoCrystal::initialize(), Particle::initialize(), ParticleComposition::initialize(), 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(), Lattice::Lattice(), Layer::Layer(), LayerInterface::LayerInterface(), LayerRoughness::LayerRoughness(), MultiLayer::MultiLayer(), Beam::operator=(), SampleBuilderNode::operator=(), ParticleCoreShell::ParticleCoreShell(), ParticleDistribution::ParticleDistribution(), ParticleLayout::ParticleLayout(), RectangularDetector::RectangularDetector(), SampleBuilderNode::reset(), ResolutionFunction2DGaussian::ResolutionFunction2DGaussian(), SampleBuilderNode::SampleBuilderNode(), SampleBuilderNode::setSBN(), SphericalDetector::SphericalDetector(), and SquareLattice::SquareLattice().

◆ getName()

Friends And Related Function Documentation

◆ TestPolarizedDWBATerms

friend class TestPolarizedDWBATerms
friend

Definition at line 59 of file FormFactorDWBAPol.h.

Member Data Documentation

◆ mP_form_factor

std::unique_ptr<IFormFactor> FormFactorDWBAPol::mP_form_factor
private

The form factor for BA.

Definition at line 63 of file FormFactorDWBAPol.h.

Referenced by bottomZ(), clone(), evaluatePol(), radialExtension(), setAmbientMaterial(), topZ(), and volume().

◆ mp_in_coeffs

std::unique_ptr<const ILayerRTCoefficients> FormFactorDWBAPol::mp_in_coeffs
private

Definition at line 65 of file FormFactorDWBAPol.h.

Referenced by clone(), evaluatePol(), and setSpecularInfo().

◆ mp_out_coeffs

std::unique_ptr<const ILayerRTCoefficients> FormFactorDWBAPol::mp_out_coeffs
private

Definition at line 66 of file FormFactorDWBAPol.h.

Referenced by clone(), evaluatePol(), and setSpecularInfo().

◆ m_parent

const INode* INode::m_parent {nullptr}
privateinherited

Definition at line 81 of file INode.h.

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

◆ m_NP

const size_t INode::m_NP
protectedinherited

Definition at line 86 of file INode.h.

Referenced by INode::INode().

◆ m_P

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

Definition at line 87 of file INode.h.

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

◆ m_name

std::string IParameterized::m_name
privateinherited

Definition at line 72 of file IParameterized.h.

Referenced by IParameterized::getName(), and IParameterized::setName().

◆ m_pool

std::unique_ptr<ParameterPool> IParameterized::m_pool
privateinherited

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