BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
FormFactorBox.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/HardParticle/FormFactorBox.h
6 //! @brief Defines class FormFactorBox.
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 
15 #ifndef BORNAGAIN_SAMPLE_HARDPARTICLE_FORMFACTORBOX_H
16 #define BORNAGAIN_SAMPLE_HARDPARTICLE_FORMFACTORBOX_H
17 
19 
20 //! A rectangular prism (parallelepiped).
21 //! @ingroup hardParticle
22 
24 public:
25  FormFactorBox(const std::vector<double> P);
26  FormFactorBox(double length, double width, double height);
27 
28  FormFactorBox* clone() const final { return new FormFactorBox(m_length, m_width, m_height); }
29 
30  void accept(INodeVisitor* visitor) const final { visitor->visit(this); }
31 
32  double getLength() const { return m_length; }
33  double getWidth() const { return m_width; }
34 
35  double volume() const final { return m_length * m_height * m_width; }
36  double radialExtension() const final { return m_length / 2.0; }
37  complex_t evaluate_for_q(cvector_t q) const final;
38 
39 protected:
40  IFormFactor* sliceFormFactor(ZLimits limits, const IRotation& rot,
41  kvector_t translation) const final;
42 
43  void onChange() final;
44  double height() const final { return m_height; }
45 
46 private:
47  const double& m_length;
48  const double& m_width;
49  const double& m_height;
50 };
51 
52 #endif // BORNAGAIN_SAMPLE_HARDPARTICLE_FORMFACTORBOX_H
std::complex< double > complex_t
Definition: Complex.h:20
Defines interface IFormFactorPrism.
A rectangular prism (parallelepiped).
Definition: FormFactorBox.h:23
complex_t evaluate_for_q(cvector_t q) const final
Returns scattering amplitude for complex scattering wavevector q=k_i-k_f.
const double & m_width
Definition: FormFactorBox.h:48
void accept(INodeVisitor *visitor) const final
Calls the INodeVisitor's visit method.
Definition: FormFactorBox.h:30
void onChange() final
Action to be taken in inherited class when a parameter has changed.
double volume() const final
Returns the total volume of the particle of this form factor's shape.
Definition: FormFactorBox.h:35
double getWidth() const
Definition: FormFactorBox.h:33
double getLength() const
Definition: FormFactorBox.h:32
const double & m_length
Definition: FormFactorBox.h:47
IFormFactor * sliceFormFactor(ZLimits limits, const IRotation &rot, kvector_t translation) const final
Actually slices the form factor or throws an exception.
FormFactorBox * clone() const final
Returns a clone of this ISampleNode object.
Definition: FormFactorBox.h:28
FormFactorBox(const std::vector< double > P)
double radialExtension() const final
Returns the (approximate in some cases) radial size of the particle of this form factor's shape.
Definition: FormFactorBox.h:36
const double & m_height
Definition: FormFactorBox.h:49
double height() const final
Definition: FormFactorBox.h:44
A prism with a polygonal base, for form factor computation.
Abstract base class for all form factors.
Definition: IFormFactor.h:36
Visitor interface to visit ISampleNode objects.
Definition: INodeVisitor.h:146
Abstract base class for rotations.
Definition: Rotations.h:28
Class that contains upper and lower limits of the z-coordinate for the slicing of form factors.
Definition: ZLimits.h:45