BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
GUIDomainSampleVisitor.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Models/GUIDomainSampleVisitor.cpp
6 //! @brief Implements class GUIDomainSampleVisitor
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 
16 #include "Base/Const/Units.h"
35 #include "Param/Node/NodeUtils.h"
48 
49 namespace {
50 SessionItem* AddFormFactorItem(SessionItem* parent, const QString& model_type)
51 {
52  auto parent_type = parent->modelType();
53  QString property_name;
54  if (parent_type == "Particle")
55  property_name = ParticleItem::P_FORM_FACTOR;
56  else if (parent_type == "MesoCrystal")
57  property_name = MesoCrystalItem::P_OUTER_SHAPE;
58  if (property_name.isEmpty())
59  throw GUIHelpers::Error("AddFormFactorItem: parent is neither ParticleItem or "
60  "MesoCrystalItem");
61  return parent->setGroupProperty(property_name, model_type);
62 }
63 } // namespace
64 
65 GUIDomainSampleVisitor::GUIDomainSampleVisitor() : m_sampleModel(nullptr), m_materialModel(nullptr)
66 {
67 }
68 
70 
72  MaterialModel* materialModel,
73  const MultiLayer& sample,
74  const QString& sample_name)
75 {
76  m_sampleModel = sampleModel;
77  m_materialModel = materialModel;
78  m_levelToParentItem.clear();
79 
80  m_topSampleName = sample_name;
81  if (m_topSampleName.isEmpty())
82  m_topSampleName = sample.getName().c_str();
83 
84  for (const auto& [child, depth, parent] : NodeUtils::progenyPlus(&sample)) {
85  setDepth(depth + 1);
86  child->accept(this);
87  }
88  SessionItem* result = m_levelToParentItem[1];
89 
91  return result;
92 }
93 
95 {
96  SessionItem* parent = m_levelToParentItem[depth() - 1];
97  auto layout_item = m_sampleModel->insertItem<ParticleLayoutItem>(parent);
99  sample->totalParticleSurfaceDensity());
100  layout_item->setItemValue(ParticleLayoutItem::P_WEIGHT, sample->weight());
101  m_levelToParentItem[depth()] = layout_item;
102 }
103 
105 {
106  SessionItem* parent = m_levelToParentItem[depth() - 1];
107  ASSERT(parent);
108 
109  const auto* multilayer = dynamic_cast<const MultiLayer*>(m_itemToSample[parent]);
110  ASSERT(multilayer);
111  size_t layer_index = MultiLayerUtils::IndexOfLayer(*multilayer, sample);
112  const LayerInterface* top_interface =
113  layer_index == 0 ? nullptr : multilayer->layerInterface(layer_index - 1);
114 
115  SessionItem* layer_item = m_sampleModel->insertItem<LayerItem>(parent);
118 
119  TransformFromDomain::setLayerItem(layer_item, sample, top_interface);
120 
121  m_levelToParentItem[depth()] = layer_item;
122 }
123 
125 {
126  auto multilayer_item = m_sampleModel->insertItem<MultiLayerItem>();
127  multilayer_item->setItemName(sample->getName().c_str());
128  multilayer_item->setItemValue(MultiLayerItem::P_CROSS_CORR_LENGTH, sample->crossCorrLength());
129  multilayer_item->item<VectorItem>(MultiLayerItem::P_EXTERNAL_FIELD)
130  ->setVector(sample->externalField());
131  m_levelToParentItem[depth()] = multilayer_item;
132  m_itemToSample[multilayer_item] = sample;
133 }
134 
136 {
137  auto particle_item = InsertIParticle(sample, "Particle");
138  particle_item->setItemValue(ParticleItem::P_MATERIAL,
140 }
141 
143 {
144  SessionItem* layout_item = m_levelToParentItem[depth() - 1];
145  ASSERT(layout_item);
146  auto particle_distribution_item =
148 
149  TransformFromDomain::setParticleDistributionItem(particle_distribution_item, *sample);
150 
151  m_levelToParentItem[depth()] = particle_distribution_item;
152  m_itemToSample[particle_distribution_item] = sample;
153 }
154 
156 {
157  InsertIParticle(sample, "ParticleCoreShell");
158 }
159 
161 {
162  InsertIParticle(sample, "ParticleComposition");
163 }
164 
166 {
167  InsertIParticle(sample, "MesoCrystal");
168 }
169 
171 {
172  SessionItem* mesocrystal_item = m_levelToParentItem[depth() - 1];
173  ASSERT(mesocrystal_item);
174  if (mesocrystal_item->modelType() != "MesoCrystal") {
175  throw GUIHelpers::Error("GUIObjectBuilder::visit(const Crystal*) "
176  "-> Error. Parent is not a MesoCrystal");
177  }
178  auto lattice = sample->transformedLattice();
179  auto vector_a = lattice.getBasisVectorA();
180  auto vector_b = lattice.getBasisVectorB();
181  auto vector_c = lattice.getBasisVectorC();
182 
183  mesocrystal_item->item<VectorItem>(MesoCrystalItem::P_VECTOR_A)->setVector(vector_a);
184  mesocrystal_item->item<VectorItem>(MesoCrystalItem::P_VECTOR_B)->setVector(vector_b);
185  mesocrystal_item->item<VectorItem>(MesoCrystalItem::P_VECTOR_C)->setVector(vector_c);
186 
187  // Since there is no CrystalItem, set the parent map to the MesoCrystalItem
188  m_levelToParentItem[depth()] = mesocrystal_item;
189 }
190 
192 {
193  SessionItem* particle_item = m_levelToParentItem[depth() - 1];
194  SessionItem* ff_item = AddFormFactorItem(particle_item, "AnisoPyramid");
196  ff_item->setItemValue(AnisoPyramidItem::P_WIDTH, sample->getWidth());
199  m_levelToParentItem[depth()] = particle_item;
200 }
201 
203 {
204  SessionItem* particle_item = m_levelToParentItem[depth() - 1];
205  SessionItem* ff_item = AddFormFactorItem(particle_item, "BarGauss");
206  ff_item->setItemValue(BarGaussItem::P_LENGTH, sample->getLength());
207  ff_item->setItemValue(BarGaussItem::P_WIDTH, sample->getWidth());
208  ff_item->setItemValue(BarGaussItem::P_HEIGHT, sample->getHeight());
209  m_levelToParentItem[depth()] = particle_item;
210 }
211 
213 {
214  SessionItem* particle_item = m_levelToParentItem[depth() - 1];
215  SessionItem* ff_item = AddFormFactorItem(particle_item, "BarLorentz");
216  ff_item->setItemValue(BarLorentzItem::P_LENGTH, sample->getLength());
217  ff_item->setItemValue(BarLorentzItem::P_WIDTH, sample->getWidth());
218  ff_item->setItemValue(BarLorentzItem::P_HEIGHT, sample->getHeight());
219  m_levelToParentItem[depth()] = particle_item;
220 }
221 
223 {
224  SessionItem* particle_item = m_levelToParentItem[depth() - 1];
225  SessionItem* ff_item = AddFormFactorItem(particle_item, "Box");
226  ff_item->setItemValue(BoxItem::P_LENGTH, sample->getLength());
227  ff_item->setItemValue(BoxItem::P_WIDTH, sample->getWidth());
228  ff_item->setItemValue(BoxItem::P_HEIGHT, sample->getHeight());
229  m_levelToParentItem[depth()] = particle_item;
230 }
231 
233 {
234  SessionItem* particle_item = m_levelToParentItem[depth() - 1];
235  SessionItem* ff_item = AddFormFactorItem(particle_item, "Cone");
236  ff_item->setItemValue(ConeItem::P_RADIUS, sample->getRadius());
237  ff_item->setItemValue(ConeItem::P_HEIGHT, sample->getHeight());
239  m_levelToParentItem[depth()] = particle_item;
240 }
241 
243 {
244  SessionItem* particle_item = m_levelToParentItem[depth() - 1];
245  SessionItem* ff_item = AddFormFactorItem(particle_item, "Cone6");
246  ff_item->setItemValue(Cone6Item::P_BASEEDGE, sample->getBaseEdge());
247  ff_item->setItemValue(Cone6Item::P_HEIGHT, sample->getHeight());
249  m_levelToParentItem[depth()] = particle_item;
250 }
251 
253 {
254  SessionItem* particle_item = m_levelToParentItem[depth() - 1];
255  SessionItem* ff_item = AddFormFactorItem(particle_item, "Cuboctahedron");
260  m_levelToParentItem[depth()] = particle_item;
261 }
262 
264 {
265  SessionItem* particle_item = m_levelToParentItem[depth() - 1];
266  SessionItem* ff_item = AddFormFactorItem(particle_item, "Cylinder");
267  ff_item->setItemValue(CylinderItem::P_RADIUS, sample->getRadius());
268  ff_item->setItemValue(CylinderItem::P_HEIGHT, sample->getHeight());
269  m_levelToParentItem[depth()] = particle_item;
270 }
271 
273 {
274  SessionItem* particle_item = m_levelToParentItem[depth() - 1];
275  SessionItem* ff_item = AddFormFactorItem(particle_item, "Dodecahedron");
276  ff_item->setItemValue(DodecahedronItem::P_EDGE, sample->getEdge());
277  m_levelToParentItem[depth()] = particle_item;
278 }
279 
281 {
282  SessionItem* particle_item = m_levelToParentItem[depth() - 1];
283  SessionItem* ff_item = AddFormFactorItem(particle_item, "Dot");
284  ff_item->setItemValue(FullSphereItem::P_RADIUS, sample->getRadius());
285  m_levelToParentItem[depth()] = particle_item;
286 }
287 
289 {
290  SessionItem* particle_item = m_levelToParentItem[depth() - 1];
291  SessionItem* ff_item = AddFormFactorItem(particle_item, "EllipsoidalCylinder");
295  m_levelToParentItem[depth()] = particle_item;
296 }
297 
299 {
300  SessionItem* particle_item = m_levelToParentItem[depth() - 1];
301  SessionItem* ff_item = AddFormFactorItem(particle_item, "FullSphere");
302  ff_item->setItemValue(FullSphereItem::P_RADIUS, sample->getRadius());
303  m_levelToParentItem[depth()] = particle_item;
304 }
305 
307 {
308  SessionItem* particle_item = m_levelToParentItem[depth() - 1];
309  SessionItem* ff_item = AddFormFactorItem(particle_item, "FullSpheroid");
312  m_levelToParentItem[depth()] = particle_item;
313 }
314 
316 {
317  SessionItem* particle_item = m_levelToParentItem[depth() - 1];
318  SessionItem* ff_item = AddFormFactorItem(particle_item, "Icosahedron");
319  ff_item->setItemValue(IcosahedronItem::P_EDGE, sample->getEdge());
320  m_levelToParentItem[depth()] = particle_item;
321 }
322 
324 {
325  SessionItem* particle_item = m_levelToParentItem[depth() - 1];
326  SessionItem* ff_item = AddFormFactorItem(particle_item, "HemiEllipsoid");
330  m_levelToParentItem[depth()] = particle_item;
331 }
332 
334 {
335  SessionItem* particle_item = m_levelToParentItem[depth() - 1];
336  SessionItem* ff_item = AddFormFactorItem(particle_item, "Prism3");
337  ff_item->setItemValue(Prism3Item::P_BASEEDGE, sample->getBaseEdge());
338  ff_item->setItemValue(Prism3Item::P_HEIGHT, sample->getHeight());
339  m_levelToParentItem[depth()] = particle_item;
340 }
341 
343 {
344  SessionItem* particle_item = m_levelToParentItem[depth() - 1];
345  SessionItem* ff_item = AddFormFactorItem(particle_item, "Prism6");
346  ff_item->setItemValue(Prism6Item::P_BASEEDGE, sample->getBaseEdge());
347  ff_item->setItemValue(Prism6Item::P_HEIGHT, sample->getHeight());
348  m_levelToParentItem[depth()] = particle_item;
349 }
350 
352 {
353  SessionItem* particle_item = m_levelToParentItem[depth() - 1];
354  SessionItem* ff_item = AddFormFactorItem(particle_item, "Pyramid");
355  ff_item->setItemValue(PyramidItem::P_BASEEDGE, sample->getBaseEdge());
356  ff_item->setItemValue(PyramidItem::P_HEIGHT, sample->getHeight());
358  m_levelToParentItem[depth()] = particle_item;
359 }
360 
362 {
363  SessionItem* particle_item = m_levelToParentItem[depth() - 1];
364  SessionItem* ff_item = AddFormFactorItem(particle_item, "CosineRippleBox");
368  m_levelToParentItem[depth()] = particle_item;
369 }
370 
372 {
373  SessionItem* particle_item = m_levelToParentItem[depth() - 1];
374  SessionItem* ff_item = AddFormFactorItem(particle_item, "CosineRippleGauss");
378  m_levelToParentItem[depth()] = particle_item;
379 }
380 
382 {
383  SessionItem* particle_item = m_levelToParentItem[depth() - 1];
384  SessionItem* ff_item = AddFormFactorItem(particle_item, "CosineRippleLorentz");
388  m_levelToParentItem[depth()] = particle_item;
389 }
390 
392 {
393  SessionItem* particle_item = m_levelToParentItem[depth() - 1];
394  SessionItem* ff_item = AddFormFactorItem(particle_item, "SawtoothRippleBox");
399  m_levelToParentItem[depth()] = particle_item;
400 }
401 
403 {
404  SessionItem* particle_item = m_levelToParentItem[depth() - 1];
405  SessionItem* ff_item = AddFormFactorItem(particle_item, "SawtoothRippleGauss");
410  m_levelToParentItem[depth()] = particle_item;
411 }
412 
414 {
415  SessionItem* particle_item = m_levelToParentItem[depth() - 1];
416  SessionItem* ff_item = AddFormFactorItem(particle_item, "SawtoothRippleLorentz");
421  m_levelToParentItem[depth()] = particle_item;
422 }
423 
425 {
426  SessionItem* particle_item = m_levelToParentItem[depth() - 1];
427  SessionItem* ff_item = AddFormFactorItem(particle_item, "Tetrahedron");
429  ff_item->setItemValue(TetrahedronItem::P_HEIGHT, sample->getHeight());
431  m_levelToParentItem[depth()] = particle_item;
432 }
433 
435 {
436  SessionItem* particle_item = m_levelToParentItem[depth() - 1];
437  SessionItem* ff_item = AddFormFactorItem(particle_item, "TruncatedCube");
440  m_levelToParentItem[depth()] = particle_item;
441 }
442 
444 {
445  SessionItem* particle_item = m_levelToParentItem[depth() - 1];
446  SessionItem* ff_item = AddFormFactorItem(particle_item, "TruncatedSphere");
450  m_levelToParentItem[depth()] = particle_item;
451 }
452 
454 {
455  SessionItem* particle_item = m_levelToParentItem[depth() - 1];
456  SessionItem* ff_item = AddFormFactorItem(particle_item, "TruncatedSpheroid");
461  m_levelToParentItem[depth()] = particle_item;
462 }
463 
465 {
466  SessionItem* parent = m_levelToParentItem[depth() - 1];
467  ASSERT(parent);
471  m_levelToParentItem[depth()] = item;
472 }
473 
475 {
476  SessionItem* parent = m_levelToParentItem[depth() - 1];
477  ASSERT(parent);
481  m_levelToParentItem[depth()] = item;
482 }
483 
485 {
486  SessionItem* parent = m_levelToParentItem[depth() - 1];
487  ASSERT(parent);
491  m_levelToParentItem[depth()] = item;
492 }
493 
495 {
496  SessionItem* parent = m_levelToParentItem[depth() - 1];
497  ASSERT(parent);
501  m_levelToParentItem[depth()] = item;
502 }
503 
505 {
506  SessionItem* parent = m_levelToParentItem[depth() - 1];
507  ASSERT(parent);
511  m_levelToParentItem[depth()] = item;
512 }
513 
515 {
516  SessionItem* parent = m_levelToParentItem[depth() - 1];
517  ASSERT(parent);
521  m_levelToParentItem[depth()] = item;
522 }
523 
525 {
526  SessionItem* parent = m_levelToParentItem[depth() - 1];
527  ASSERT(parent);
528 
529  auto transformation_item =
531  SessionItem* rotationItem =
532  transformation_item->setGroupProperty(TransformationItem::P_ROT, "XRotation");
533  rotationItem->setItemValue(XRotationItem::P_ANGLE, Units::rad2deg(sample->getAngle()));
534  m_levelToParentItem[depth()] = transformation_item;
535 }
536 
538 {
539  SessionItem* parent = m_levelToParentItem[depth() - 1];
540  ASSERT(parent);
541 
542  auto transformation_item =
544  SessionItem* rotationItem =
545  transformation_item->setGroupProperty(TransformationItem::P_ROT, "YRotation");
546  rotationItem->setItemValue(YRotationItem::P_ANGLE, Units::rad2deg(sample->getAngle()));
547  m_levelToParentItem[depth()] = transformation_item;
548 }
549 
551 {
552  SessionItem* parent = m_levelToParentItem[depth() - 1];
553  ASSERT(parent);
554 
555  auto transformation_item =
557  SessionItem* rotationItem =
558  transformation_item->setGroupProperty(TransformationItem::P_ROT, "ZRotation");
559  rotationItem->setItemValue(ZRotationItem::P_ANGLE, Units::rad2deg(sample->getAngle()));
560  m_levelToParentItem[depth()] = transformation_item;
561 }
562 
564 {
565  SessionItem* parent = m_levelToParentItem[depth() - 1];
566  ASSERT(parent);
567 
568  auto transformation_item =
570  SessionItem* rotationItem =
571  transformation_item->setGroupProperty(TransformationItem::P_ROT, "EulerRotation");
573  rotationItem->setItemValue(EulerRotationItem::P_BETA, Units::rad2deg(sample->getBeta()));
574  rotationItem->setItemValue(EulerRotationItem::P_GAMMA, Units::rad2deg(sample->getGamma()));
575  m_levelToParentItem[depth()] = transformation_item;
576 }
577 
579 {
580  particle_item->item<VectorItem>(ParticleItem::P_POSITION)->setVector(sample->position());
581 }
582 
584 {
585  QString materialName = m_topSampleName + QString("_") + QString(material->getName().c_str());
586 
587  if (auto material = m_materialModel->materialFromName(materialName))
588  return MaterialItemUtils::materialProperty(*material);
589 
590  complex_t material_data = material->materialData();
591  MaterialItem* materialItem(nullptr);
592  if (material->typeID() == MATERIAL_TYPES::RefractiveMaterial) {
593  materialItem = m_materialModel->addRefractiveMaterial(materialName, material_data.real(),
594  material_data.imag());
595  } else if (material->typeID() == MATERIAL_TYPES::MaterialBySLD) {
596  materialItem = m_materialModel->addSLDMaterial(materialName, material_data.real(),
597  material_data.imag());
598  } else {
599  throw GUIHelpers::Error("GUIObjectBuilder::createMaterialFromDomain() -> Error. "
600  "Unsupported material");
601  }
602 
604  ->setVector(material->magnetization());
605  return MaterialItemUtils::materialProperty(*materialItem);
606 }
607 
609 {
610  auto parent = m_levelToParentItem[depth() - 1];
611  ASSERT(parent);
612 
613  QString tag;
614  auto parent_type = parent->modelType();
615  if (model_type == "Particle") {
616  if (parent_type == "ParticleCoreShell") {
617  const ParticleCoreShell* coreshell =
618  dynamic_cast<const ParticleCoreShell*>(m_itemToSample[parent]);
619  ASSERT(coreshell);
620  if (particle == coreshell->coreParticle()) {
622  } else if (particle == coreshell->shellParticle()) {
624  } else {
625  throw GUIHelpers::Error("GUIObjectBuilder::InsertIParticle:"
626  "Particle not found in parent ParticleCoreShell");
627  }
628  }
629  }
630  SessionItem* particle_item = m_sampleModel->insertNewItem(model_type, parent, -1, tag);
631 
632  ASSERT(particle_item);
633  particle_item->setItemValue(ParticleItem::P_ABUNDANCE, particle->abundance());
634  buildPositionInfo(particle_item, particle);
635 
636  m_levelToParentItem[depth()] = particle_item;
637  m_itemToSample[particle_item] = particle;
638 
639  return particle_item;
640 }
#define ASSERT(condition)
Definition: Assert.h:31
Defines class ComboProperty.
std::complex< double > complex_t
Definition: Complex.h:20
Defines class Crystal.
Defines FormFactorItems classes.
Defines class GUIDomainSampleVisitor.
Defines class GUIHelpers functions.
Includes all particle-shape form-factor definitions.
Defines InterferenceFunctionItems's classes.
Defines class LayerItem.
Defines class Layer.
Defines class MaterialItemUtils.
Defines class MaterialModel.
Defines class MesoCrystalItem.
Defines class MesoCrystal.
Defines class MultiLayerItem.
Defines helper functions for MultiLayer objects.
Defines class MultiLayer.
Defines collection of utility functions for INode.
Defines class ParticleComposition.
Defines class ParticleCoreShellItem.
Defines ParticleCoreShell.
Defines class ParticleDistributionItem.
Defines class ParticleDistribution.
Defines class ParticleItem.
Defines class ParticleLayoutItem.
Defines class ParticleLayout.
Defines class Particle.
Defines class RotationItems.
Defines class SampleModel.
Includes all soft-particle form-factor definitions.
Defines namespace TransformFromDomain.
Defines class TransformationItem.
Defines some unit conversion factors and other constants in namespace Units.
Defines class VectorItem.
static const QString P_ALPHA
static const QString P_WIDTH
static const QString P_LENGTH
static const QString P_HEIGHT
static const QString P_LENGTH
static const QString P_HEIGHT
static const QString P_WIDTH
static const QString P_LENGTH
static const QString P_WIDTH
static const QString P_HEIGHT
static const QString P_LENGTH
static const QString P_HEIGHT
static const QString P_WIDTH
static const QString P_HEIGHT
static const QString P_BASEEDGE
static const QString P_ALPHA
static const QString P_ALPHA
static const QString P_HEIGHT
static const QString P_RADIUS
static const QString P_WIDTH
static const QString P_HEIGHT
static const QString P_LENGTH
static const QString P_LENGTH
static const QString P_WIDTH
static const QString P_HEIGHT
static const QString P_LENGTH
static const QString P_WIDTH
static const QString P_HEIGHT
A crystal structure, defined by a Bravais lattice, a basis, and a position variance.
Definition: Crystal.h:35
Lattice3D transformedLattice(const IRotation *p_rotation=nullptr) const
Definition: Crystal.cpp:81
static const QString P_HEIGHT
static const QString P_LENGTH
static const QString P_HEIGHT_RATIO
static const QString P_ALPHA
static const QString P_RADIUS
static const QString P_HEIGHT
static const QString P_EDGE
static const QString P_RADIUS_X
static const QString P_HEIGHT
static const QString P_RADIUS_Y
static const QString P_BETA
Definition: RotationItems.h:52
static const QString P_ALPHA
Definition: RotationItems.h:51
static const QString P_GAMMA
Definition: RotationItems.h:53
The ExternalProperty class defines custom QVariant property to carry the text, color and an identifie...
QVariant variant() const
A frustum (truncated pyramid) with rectangular base.
The form factor of an elongated bar, with Gaussian profile in elongation direction.
Definition: FormFactorBar.h:27
The form factor of an elongated, with Lorentz form factor in elongation direction.
Definition: FormFactorBar.h:40
A rectangular prism (parallelepiped).
Definition: FormFactorBox.h:23
double getWidth() const
Definition: FormFactorBox.h:33
double getLength() const
Definition: FormFactorBox.h:32
A frustum (truncated pyramid) with regular hexagonal base.
double getBaseEdge() const
double getAlpha() const
double getHeight() const
A conical frustum (cone truncated parallel to the base) with circular base.
double getHeight() const
double getRadius() const
double getAlpha() const
The form factor for a cosine ripple, with box profile in elongation direction.
The form factor for a cosine ripple, with Gaussian profile in elongation direction.
The form factor for a cosine ripple, with Lorentz form factor in elongation direction.
A truncated bifrustum with quadratic base.
A circular cylinder.
double getHeight() const
double getRadius() const
A regular dodecahedron.
A dot, with scattering power as a sphere of radius rscat, but with F(q)=const.
Definition: FormFactorDot.h:23
double getRadius() const
Definition: FormFactorDot.h:31
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.
double getBaseEdge() const
A prism based on a regular hexagonal.
double getBaseEdge() const
A frustum with a quadratic base.
double getHeight() const
double getBaseEdge() const
double getAlpha() const
The form factor for a cosine ripple, with box profile in elongation direction.
The form factor for a cosine ripple, with Gaussian profile in elongation direction.
The form factor for a cosine ripple, with Lorentz form factor in elongation direction.
A frustum with equilateral trigonal base.
A cube, with tetrahedral truncation of all corners.
static const QString P_RADIUS
static const QString P_HEIGHT
static const QString P_RADIUS
SessionItem * populateSampleModel(SampleModel *sampleModel, MaterialModel *materialModel, const MultiLayer &sample, const QString &sample_name="")
virtual void visit(const BasicLattice2D *)
Definition: INodeVisitor.h:151
ExternalProperty createMaterialFromDomain(const Material *)
SessionItem * InsertIParticle(const IParticle *p_particle, QString model_type)
QMap< SessionItem *, const ISampleNode * > m_itemToSample
void buildPositionInfo(SessionItem *particleItem, const IParticle *sample)
QMap< int, SessionItem * > m_levelToParentItem
static const QString P_RADIUS_Y
static const QString P_RADIUS_X
static const QString P_HEIGHT
double abundance() const
double getHeight() const
void setDepth(int depth)
Sets depth of the visitor in the composite hierarchy.
Definition: INodeVisitor.h:277
int depth() const
Returns depth of the visitor in the composite hierarchy.
Definition: INodeVisitor.h:274
const std::string & getName() const
Abstract base class for Particle, ParticleComposition, ParticleCoreShell, MesoCrystal.
Definition: IParticle.h:33
kvector_t position() const
Returns particle position.
Definition: IParticle.h:45
double getHeight() const
double getLength() const
double getWidth() const
double getAsymmetry() const
static const QString P_EDGE
Interference function of a 1D lattice.
Interference function of a 2D lattice.
Interference function of a 2D paracrystal.
Interference function of a finite 2D lattice.
Percus-Yevick hard disk interference function.
Interference function of radial paracrystal.
kvector_t getBasisVectorA() const
Returns basis vector a.
Definition: Lattice3D.h:46
Interface between two layers, possibly with roughness.
static const QString P_MATERIAL
Definition: LayerItem.h:24
A layer in a MultiLayer sample.
Definition: Layer.h:27
const Material * material() const final
Returns nullptr, unless overwritten to return a specific material.
Definition: Layer.h:40
static const QString P_MAGNETIZATION
Definition: MaterialItem.h:26
MaterialItem * addSLDMaterial(const QString &name, double sld, double abs_term)
MaterialItem * materialFromName(const QString &name)
MaterialItem * addRefractiveMaterial(const QString &name, double delta, double beta)
A wrapper for underlying material implementation.
Definition: Material.h:29
kvector_t magnetization() const
Get the magnetization (in A/m)
Definition: Material.cpp:76
std::string getName() const
Returns the name of material.
Definition: Material.cpp:66
MATERIAL_TYPES typeID() const
Returns the type of underlying material implementation.
Definition: Material.cpp:71
complex_t materialData() const
Returns underlying material data.
Definition: Material.cpp:81
static const QString P_VECTOR_C
static const QString P_VECTOR_B
static const QString P_VECTOR_A
static const QString P_OUTER_SHAPE
A particle with an internal structure of smaller particles.
Definition: MesoCrystal.h:25
static const QString P_CROSS_CORR_LENGTH
static const QString P_EXTERNAL_FIELD
Our sample model: a stack of layers one below the other.
Definition: MultiLayer.h:41
kvector_t externalField() const
Returns the external field applied to the multilayer (units: A/m)
Definition: MultiLayer.h:70
double crossCorrLength() const
Returns cross correlation length of roughnesses between interfaces.
Definition: MultiLayer.h:68
A composition of particles at fixed positions.
static const QString T_CORE
static const QString T_SHELL
A particle with a core/shell geometry.
const Particle * shellParticle() const
const Particle * coreParticle() const
A particle type that is a parametric distribution of IParticle's.
static const QString P_MATERIAL
Definition: ParticleItem.h:27
static const QString P_ABUNDANCE
Definition: ParticleItem.h:26
static const QString T_TRANSFORMATION
Definition: ParticleItem.h:29
static const QString P_POSITION
Definition: ParticleItem.h:28
static const QString P_FORM_FACTOR
Definition: ParticleItem.h:25
static const QString T_INTERFERENCE
static const QString P_TOTAL_DENSITY
static const QString P_WEIGHT
Decorator class that adds particles to ISampleNode objects.
double weight() const
Returns the relative weight of this layout.
double totalParticleSurfaceDensity() const
A particle with a form factor and refractive index.
Definition: Particle.h:24
const Material * material() const final
Returns nullptr, unless overwritten to return a specific material.
Definition: Particle.h:39
static const QString P_HEIGHT
static const QString P_BASEEDGE
static const QString P_HEIGHT
static const QString P_BASEEDGE
static const QString P_HEIGHT
static const QString P_ALPHA
static const QString P_BASEEDGE
A sequence of rotations about the z-x'-z'' axes.
Definition: Rotations.h:133
double getGamma() const
Definition: Rotations.h:145
double getBeta() const
Definition: Rotations.h:144
double getAlpha() const
Definition: Rotations.h:143
A rotation about the x axis.
Definition: Rotations.h:73
double getAngle() const
Definition: Rotations.h:83
A rotation about the y axis.
Definition: Rotations.h:93
double getAngle() const
Definition: Rotations.h:103
A rotation about the z axis.
Definition: Rotations.h:113
double getAngle() const
Definition: Rotations.h:123
Main model to hold sample items.
Definition: SampleModel.h:24
static const QString P_HEIGHT
static const QString P_WIDTH
static const QString P_ASYMMETRY
static const QString P_LENGTH
static const QString P_WIDTH
static const QString P_ASYMMETRY
static const QString P_LENGTH
static const QString P_HEIGHT
static const QString P_HEIGHT
static const QString P_LENGTH
static const QString P_WIDTH
static const QString P_ASYMMETRY
void setItemName(const QString &name)
Set item name, add property if necessary.
T * item(const QString &tag) const
Definition: SessionItem.h:151
void setItemValue(const QString &tag, const QVariant &variant)
Directly set value of item under given tag.
SessionItem * setGroupProperty(const QString &groupTag, const QString &modelType) const
Set the current type of group item.
QString modelType() const
Get model type.
T * insertItem(SessionItem *parent=nullptr, int row=-1, QString tag="")
Definition: SessionModel.h:125
SessionItem * insertNewItem(QString model_type, SessionItem *parent_item=nullptr, int row=-1, QString tag="")
static const QString P_ALPHA
static const QString P_BASEEDGE
static const QString P_HEIGHT
static const QString P_ROT
static const QString P_REMOVED_LENGTH
static const QString P_LENGTH
static const QString P_REMOVED_TOP
static const QString P_RADIUS
static const QString P_HEIGHT
static const QString P_HEIGHT
static const QString P_HFC
static const QString P_RADIUS
static const QString P_REMOVED_TOP
static const QString P_ANGLE
Definition: RotationItems.h:30
static const QString P_ANGLE
Definition: RotationItems.h:37
static const QString P_ANGLE
Definition: RotationItems.h:44
ExternalProperty materialProperty(const SessionItem &materialItem)
Constructs material property corresponding to given material.
std::string model_type
Definition: types.h:23
size_t IndexOfLayer(const MultiLayer &multilayer, const Layer *p_layer)
Returns the index of the given layer.
std::vector< std::tuple< const INode *, int, const INode * > > progenyPlus(const INode *node, int level=0)
Returns a vector of triples (descendant, depth, parent)
Definition: NodeUtils.cpp:69
void setFinite2DLatticeItem(SessionItem *item, const InterferenceFunctionFinite2DLattice &sample)
void setRadialParaCrystalItem(SessionItem *item, const InterferenceFunctionRadialParaCrystal &sample)
void setHardDiskItem(SessionItem *item, const InterferenceFunctionHardDisk &sample)
void set2DParaCrystalItem(SessionItem *item, const InterferenceFunction2DParaCrystal &sample)
void setLayerItem(SessionItem *layer_item, const Layer *layer, const LayerInterface *top_interface)
void set2DLatticeItem(SessionItem *item, const InterferenceFunction2DLattice &sample)
void set1DLatticeItem(SessionItem *item, const InterferenceFunction1DLattice &sample)
void setParticleDistributionItem(SessionItem *item, const ParticleDistribution &sample)
Initialization of ParticleDistributionItem.
double rad2deg(double angle)
Definition: Units.h:55