Mantid
Loading...
Searching...
No Matches
qt
widgets
common
src
FittingGlobals.cpp
Go to the documentation of this file.
1
// Mantid Repository : https://github.com/mantidproject/mantid
2
//
3
// Copyright © 2020 ISIS Rutherford Appleton Laboratory UKRI,
4
// NScD Oak Ridge National Laboratory, European Spallation Source,
5
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6
// SPDX - License - Identifier: GPL - 3.0 +
7
#include <utility>
8
9
#include "
MantidQtWidgets/Common/FittingGlobals.h
"
10
11
namespace
MantidQt::MantidWidgets
{
12
13
GlobalParameter::GlobalParameter
(std::string parameter) : m_parameter(
std
::move(parameter)) {}
14
15
GlobalTie::GlobalTie
(std::string parameter, std::string tie)
16
: m_parameter(
std
::move(parameter)), m_tie(
std
::move(tie)) {}
17
18
std::string
GlobalTie::toCompositeParameter
(std ::string
const
&fullParameter)
const
{
19
auto
const
dotIndex = fullParameter.find(
"."
);
20
if
(dotIndex != std::string::npos) {
21
return
fullParameter.substr(0, dotIndex + 1) +
"f0."
+ fullParameter.substr(dotIndex + 1);
22
}
23
return
fullParameter;
24
}
25
26
std::string
GlobalTie::toNonCompositeParameter
(std ::string
const
&fullParameter)
const
{
27
auto
const
firstDotIndex = fullParameter.find(
"."
);
28
if
(firstDotIndex != std::string::npos) {
29
auto
const
secondDotIndex = fullParameter.find(
"."
, firstDotIndex + 1);
30
if
(secondDotIndex != std::string::npos) {
31
return
fullParameter.substr(0, firstDotIndex + 1) + fullParameter.substr(secondDotIndex + 1);
32
}
33
}
34
return
fullParameter;
35
}
36
37
std::string
GlobalTie::asString
()
const
{
return
m_parameter
+
"="
+
m_tie
; }
38
39
}
// namespace MantidQt::MantidWidgets
FittingGlobals.h
MantidQt::MantidWidgets
Definition
AddWorkspaceDialog.h:19
std
STL namespace.
MantidQt::MantidWidgets::GlobalParameter::GlobalParameter
GlobalParameter(std::string parameter)
Definition
FittingGlobals.cpp:13
MantidQt::MantidWidgets::GlobalTie::asString
std::string asString() const
Definition
FittingGlobals.cpp:37
MantidQt::MantidWidgets::GlobalTie::toNonCompositeParameter
std::string toNonCompositeParameter(std ::string const &fullParameter) const
Definition
FittingGlobals.cpp:26
MantidQt::MantidWidgets::GlobalTie::GlobalTie
GlobalTie(std::string parameter, std::string tie)
Definition
FittingGlobals.cpp:15
MantidQt::MantidWidgets::GlobalTie::m_parameter
std::string m_parameter
Definition
FittingGlobals.h:46
MantidQt::MantidWidgets::GlobalTie::toCompositeParameter
std::string toCompositeParameter(std ::string const &fullParameter) const
Definition
FittingGlobals.cpp:18
MantidQt::MantidWidgets::GlobalTie::m_tie
std::string m_tie
Definition
FittingGlobals.h:47
Generated by
1.9.8