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

Predefined form factors for functional tests. More...

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

Public Member Functions

 FormFactorComponents ()
 
const IFormFactorgetItem (const std::string &key) const
 
std::vector< std::string > keys () const
 
size_t size () const
 

Protected Member Functions

void add (const std::string &key, IFormFactor *item)
 

Private Attributes

std::map< std::string, std::unique_ptr< IFormFactor > > m_data
 

Detailed Description

Predefined form factors for functional tests.

Definition at line 29 of file FormFactorComponents.h.

Constructor & Destructor Documentation

◆ FormFactorComponents()

FormFactorComponents::FormFactorComponents ( )

Definition at line 19 of file FormFactorComponents.cpp.

21 {
22  add("AnisoPyramid", new FormFactorAnisoPyramid(10.0, 20.0, 5.0, Units::deg2rad(54.73)));
23 
24  add("Box", new FormFactorBox(10.0, 20.0, 5.0));
25 
26  // TODO: activate this when supported by GUI
27  // add("CantellatedCube", new FormFactorCantellatedCube(15.0, 6.0));
28 
29  add("Cone", new FormFactorCone(5.0, 6.0, Units::deg2rad(54.73)));
30 
31  add("Cone6", new FormFactorCone6(2. / sqrt(3.) * 5.0, 5.0, Units::deg2rad(54.73)));
32 
33  add("Cuboctahedron", new FormFactorCuboctahedron(10.0, 5.0, 1.0, Units::deg2rad(54.73)));
34 
35  add("Cylinder", new FormFactorCylinder(5.0, 10.0));
36 
37  add("Dodecahedron", new FormFactorDodecahedron(5.0));
38 
39  add("Dot", new FormFactorDot(5.0));
40 
41  add("EllipsoidalCylinder", new FormFactorEllipsoidalCylinder(5.0, 10.0, 15.0));
42 
43  add("FullSphere", new FormFactorFullSphere(5.0));
44 
45  add("FullSpheroid", new FormFactorFullSpheroid(5.0, 10.0));
46 
47  add("HemiEllipsoid", new FormFactorHemiEllipsoid(5.0, 10.0, 15.0));
48 
49  add("Icosahedron", new FormFactorIcosahedron(10.0));
50 
51  add("Prism3", new FormFactorPrism3(10.0, 5.0));
52 
53  add("Prism6", new FormFactorPrism6(2. / sqrt(3.) * 5.0, 5.0));
54 
55  add("Pyramid", new FormFactorPyramid(10.0, 5.0, Units::deg2rad(54.73)));
56 
57  add("CosineRippleBox", new FormFactorCosineRippleBox(100.0, 20.0, 4.0));
58 
59  add("SawtoothRippleBox", new FormFactorSawtoothRippleBox(100.0, 20.0, 4.0, 0.0));
60 
61  add("Tetrahedron", new FormFactorTetrahedron(10.0, 4.0, Units::deg2rad(54.73)));
62 
63  add("TruncatedCube", new FormFactorTruncatedCube(15.0, 6.0));
64 
65  add("TruncatedSphere", new FormFactorTruncatedSphere(5.0, 7.0, 0));
66 
67  add("TruncatedSpheroid", new FormFactorTruncatedSpheroid(5.0, 7.0, 1.0, 0));
68 }
A frustum (truncated pyramid) with rectangular base.
A rectangular prism (parallelepiped).
Definition: FormFactorBox.h:23
A frustum (truncated pyramid) with regular hexagonal base.
A conical frustum (cone truncated parallel to the base) with circular base.
The form factor for a cosine ripple, with box profile in elongation direction.
A truncated bifrustum with quadratic base.
A circular cylinder.
A regular dodecahedron.
A dot, with scattering power as a sphere of radius rscat, but with F(q)=const.
Definition: FormFactorDot.h:23
A cylinder with elliptical base.
A full spheroid (an ellipsoid with two equal axes, hence with circular cross section)
An hemi ellipsoid, obtained by truncating a full ellipsoid in the middle plane spanned by two princip...
A regular icosahedron.
A prism based on an equilateral triangle.
A prism based on a regular hexagonal.
A frustum with a quadratic base.
The form factor for a cosine ripple, with box profile in elongation direction.
A frustum with equilateral trigonal base.
A cube, with tetrahedral truncation of all corners.
void add(const std::string &key, IFormFactor *item)
Definition: IRegistry.h:54
double deg2rad(double angle)
Definition: Units.h:59

References IRegistry< IFormFactor >::add(), and Units::deg2rad().

Here is the call graph for this function:

Member Function Documentation

◆ add()

void IRegistry< IFormFactor >::add ( const std::string &  key,
IFormFactor item 
)
inlineprotectedinherited

Definition at line 54 of file IRegistry.h.

55  {
56  if (m_data.find(key) != m_data.end())
57  throw std::runtime_error("Key '" + key + "' already in registry");
58  m_data[key] = std::unique_ptr<ValueType>(item);
59  }
std::map< std::string, std::unique_ptr< IFormFactor > > m_data
Definition: IRegistry.h:62

◆ getItem()

const IFormFactor * IRegistry< IFormFactor >::getItem ( const std::string &  key) const
inlineinherited

Definition at line 35 of file IRegistry.h.

36  {
37  auto it = m_data.find(key);
38  if (it == m_data.end())
39  throw std::runtime_error("Key '" + key + "' not found in registry");
40  return it->second.get();
41  }

◆ keys()

std::vector<std::string> IRegistry< IFormFactor >::keys ( ) const
inlineinherited

Definition at line 43 of file IRegistry.h.

44  {
45  std::vector<std::string> result;
46  for (const auto& it : m_data)
47  result.push_back(it.first);
48  return result;
49  }

◆ size()

size_t IRegistry< IFormFactor >::size ( ) const
inlineinherited

Definition at line 51 of file IRegistry.h.

51 { return m_data.size(); }

Member Data Documentation

◆ m_data

std::map<std::string, std::unique_ptr<IFormFactor > > IRegistry< IFormFactor >::m_data
privateinherited

Definition at line 62 of file IRegistry.h.


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