BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
InterferenceItemCatalog.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/CatSample/InterferenceItemCatalog.cpp
6 //! @brief Implements class InterferenceItemCatalog
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2021
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
17 
19 {
20  switch (type) {
21  case Type::None:
22  return nullptr;
26  return new Interference2DParaCrystalItem();
27  case Type::Lattice1D:
28  return new Interference1DLatticeItem();
29  case Type::Lattice2D:
30  return new Interference2DLatticeItem();
33  case Type::HardDisk:
34  return new InterferenceHardDiskItem();
35  default:
36  ASSERT(false);
37  }
38 }
39 
40 QVector<InterferenceItemCatalog::Type> InterferenceItemCatalog::types()
41 {
45 }
46 
48 {
49  switch (type) {
50  case Type::None:
51  return {"None", "", ""};
53  return {"Radial paracrystal", "Interference function of radial paracrystal",
54  ":/SampleDesignerToolbox/images/ParaCrystal1D.png"};
56  return {"2D paracrystal", "Interference function of two-dimensional paracrystal",
57  ":/SampleDesignerToolbox/images/ParaCrystal2D.png"};
58  case Type::Lattice1D:
59  return {"1D lattice", "Interference function of 1D lattice",
60  ":/SampleDesignerToolbox/images/Lattice1D.png"};
61  case Type::Lattice2D:
62  return {"2D lattice", "Interference function of 2D lattice",
63  ":/SampleDesignerToolbox/images/Lattice2D.png"};
65  return {"Finite 2D lattice", "Interference function of finite 2D lattice",
66  ":/SampleDesignerToolbox/images/Lattice2DFinite.png"};
67  case Type::HardDisk:
68  return {"Hard disk Percus-Yevick", "Interference function for hard disk Percus-Yevick",
69  ":/SampleDesignerToolbox/images/Lattice2D.png"};
70  default:
71  ASSERT(false);
72  }
73 }
74 
76 {
77  if (!item)
78  return Type::None;
79 
80  if (dynamic_cast<const InterferenceRadialParaCrystalItem*>(item))
82  if (dynamic_cast<const Interference2DParaCrystalItem*>(item))
83  return Type::ParaCrystal2D;
84  if (dynamic_cast<const Interference1DLatticeItem*>(item))
85  return Type::Lattice1D;
86  if (dynamic_cast<const Interference2DLatticeItem*>(item))
87  return Type::Lattice2D;
88  if (dynamic_cast<const InterferenceFinite2DLatticeItem*>(item))
89  return Type::FiniteLattice2D;
90  if (dynamic_cast<const InterferenceHardDiskItem*>(item))
91  return Type::HardDisk;
92 
93  ASSERT(false);
94 }
Defines class InterferenceItemCatalog.
Defines InterferenceItems's classes.
static InterferenceItem * create(Type type)
Creates the item of the given type.
static Type type(const InterferenceItem *item)
Returns the enum type of the given item.
static UiInfo uiInfo(Type t)
UiInfo on the given type.
static QVector< Type > types()
Available types of interference items.