BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
Box.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/HardParticle/Box.h
6 //! @brief Defines class Box.
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_BOX_H
16 #define BORNAGAIN_SAMPLE_HARDPARTICLE_BOX_H
17 
19 
20 //! A rectangular prism (parallelepiped).
21 //! @ingroup hardParticle
22 
23 class Box : public IFormFactorPrism {
24 public:
25  Box(double length, double width, double height);
26 #ifndef USER_API
27  Box(std::vector<double> P);
28 
29  Box* clone() const override { return new Box(m_length, m_width, m_height); }
30  std::string className() const final { return "Box"; }
31  // const auto tooltip = "rectangular cuboid";
32  std::vector<ParaMeta> parDefs() const final
33  {
34  return {{"Length", "nm", "side length in x direction", 0, +INF, 0},
35  {"Width", "nm", "side length in y direction", 0, +INF, 0},
36  {"Height", "nm", "side length in z direction", 0, +INF, 0}};
37  }
38 
39  double length() const { return m_length; }
40  double width() const { return m_width; }
41  double height() const override { return m_height; }
42 
43  double volume() const override { return m_length * m_height * m_width; }
44  double radialExtension() const override { return m_length / 2.0; }
45  complex_t formfactor_at_bottom(C3 q) const override;
46 
47 private:
48  const double& m_length;
49  const double& m_width;
50  const double& m_height;
51 #endif // USER_API
52 };
53 
54 #endif // BORNAGAIN_SAMPLE_HARDPARTICLE_BOX_H
Defines interface IFormFactorPrism.
const double INF
Definition: INode.h:26
A rectangular prism (parallelepiped).
Definition: Box.h:23
double width() const
Definition: Box.h:40
double radialExtension() const override
Returns the (approximate in some cases) radial size of the particle of this form factor's shape....
Definition: Box.h:44
std::string className() const final
Returns the class name, to be hard-coded in each leaf class that inherits from INode.
Definition: Box.h:30
Box * clone() const override
Returns a clone of this ISampleNode object.
Definition: Box.h:29
Box(double length, double width, double height)
Definition: Box.cpp:31
std::vector< ParaMeta > parDefs() const final
Returns the parameter definitions, to be hard-coded in each leaf class.
Definition: Box.h:32
const double & m_length
Definition: Box.h:48
const double & m_height
Definition: Box.h:50
double length() const
Definition: Box.h:39
const double & m_width
Definition: Box.h:49
double height() const override
Definition: Box.h:41
complex_t formfactor_at_bottom(C3 q) const override
Definition: Box.cpp:36
double volume() const override
Definition: Box.h:43
A prism with a polygonal base, for form factor computation.