BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
Sphere.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/HardParticle/Sphere.h
6 //! @brief Defines class Sphere.
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_SPHERE_H
16 #define BORNAGAIN_SAMPLE_HARDPARTICLE_SPHERE_H
17 
19 
20 //! A full sphere.
21 //! @ingroup hardParticle
22 
23 class Sphere : public IFormFactor {
24 public:
25  Sphere(double radius, bool position_at_center = false);
26 #ifndef USER_API
27  Sphere(std::vector<double> P, bool position_at_center = false);
28 
29  Sphere* clone() const override { return new Sphere(m_radius, m_position_at_center); }
30  std::string className() const final { return "Sphere"; }
31  // const auto tooltip = "sphere";
32  std::vector<ParaMeta> parDefs() const final { return {{"Radius", "nm", "radius", 0, +INF, 0}}; }
33 
34  double radius() const { return m_radius; }
35 
36  double radialExtension() const override { return m_radius; }
37 
38  double bottomZ(const IRotation* rotation) const override;
39 
40  double topZ(const IRotation* rotation) const override;
41 
42  complex_t formfactor_at_bottom(C3 q) const override;
43 
44 protected:
45  bool canSliceAnalytically(const IRotation*) const override { return true; }
46 
47 private:
48  const double& m_radius;
50 #endif // USER_API
51 };
52 
53 #endif // BORNAGAIN_SAMPLE_HARDPARTICLE_SPHERE_H
Defines interface IDecoratableBorn.
const double INF
Definition: INode.h:26
Abstract base class for Born form factors.
Definition: IFormFactor.h:36
Abstract base class for rotations.
Definition: Rotations.h:29
A full sphere.
Definition: Sphere.h:23
std::vector< ParaMeta > parDefs() const final
Returns the parameter definitions, to be hard-coded in each leaf class.
Definition: Sphere.h:32
const double & m_radius
Definition: Sphere.h:48
double topZ(const IRotation *rotation) const override
Definition: Sphere.cpp:45
Sphere * clone() const override
Returns a clone of this ISampleNode object.
Definition: Sphere.h:29
std::string className() const final
Returns the class name, to be hard-coded in each leaf class that inherits from INode.
Definition: Sphere.h:30
bool canSliceAnalytically(const IRotation *) const override
Default implementation only allows rotations along z-axis.
Definition: Sphere.h:45
double radius() const
Definition: Sphere.h:34
bool m_position_at_center
Definition: Sphere.h:49
Sphere(double radius, bool position_at_center=false)
Definition: Sphere.cpp:29
double bottomZ(const IRotation *rotation) const override
Definition: Sphere.cpp:34
double radialExtension() const override
Returns the (approximate in some cases) radial size of the particle of this form factor's shape....
Definition: Sphere.h:36
complex_t formfactor_at_bottom(C3 q) const override
Definition: Sphere.cpp:56