BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
FitParameterHelper.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/Model/FitParameterHelper.cpp
6 //! @brief Implements namespace FitModelHelper
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 
19 #include "GUI/Model/Job/JobItem.h"
21 
23  const QString& link)
24 {
25  // Link is relative to ParameterContainerItem, so first we have to find it
26  SessionItem* cur = container;
27  while (cur && cur->modelType() != JobItem::M_TYPE)
28  cur = cur->parentItem();
29  ASSERT(cur && cur->modelType() == JobItem::M_TYPE);
30  auto* jobItem = dynamic_cast<JobItem*>(cur);
31  ASSERT(jobItem);
32  return jobItem->parameterContainerItem()->findParameterItem(link);
33 }
Defines class FitParameterContainerItem.
Defines namespace FitParameterHelper.
Defines class FitParameterItem.
Defines class FitParameterLinkItem.
Defines class JobItem.
Defines classes for ParameterTreeItems.
The FitParameterContainerItem class is a collection of all defined fit parameters in JobItem.
static constexpr auto M_TYPE
Definition: JobItem.h:62
The ParameterItem class represent a tuning value in a parameter tuning tree.
Base class for a GUI data item.
Definition: SessionItem.h:204
SessionItem * parentItem() const
Returns parent of this item.
Definition: SessionItem.cpp:67
QString modelType() const
Get model type.
ParameterItem * getParameterItem(FitParameterContainerItem *container, const QString &link)
Returns ParameterItem corresponding to given link.