26 QStringList
const &workspaceNames,
double startX,
double endX)
27 : m_warnings(), m_view(view), m_model(model) {
36 [[maybe_unused]] std::string
const &arg2) {
38 case ViewEvent::ADSDeleteEvent:
41 case ViewEvent::ADSClearEvent:
44 case ViewEvent::ADSRenameEvent:
47 case ViewEvent::RemoveDomainClicked:
50 case ViewEvent::AddDomainClicked:
53 case ViewEvent::AddDomainAccepted:
56 case ViewEvent::StartXChanged:
59 case ViewEvent::EndXChanged:
62 case ViewEvent::SelectionChanged:
65 case ViewEvent::FunctionRemoved:
68 case ViewEvent::FunctionAdded:
71 case ViewEvent::FunctionReplaced:
74 case ViewEvent::ParameterChanged:
77 case ViewEvent::AttributeChanged:
80 case ViewEvent::ParameterTieChanged:
83 case ViewEvent::ParameterConstraintRemoved:
86 case ViewEvent::ParameterConstraintChanged:
89 case ViewEvent::EditLocalParameterClicked:
92 case ViewEvent::EditLocalParameterFinished:
95 case ViewEvent::OutputBaseNameChanged:
98 case ViewEvent::GenerateScriptToFileClicked:
101 case ViewEvent::GenerateScriptToClipboardClicked:
105 throw std::runtime_error(
"Failed to notify the FitScriptGeneratorPresenter.");
111 case ViewEvent::GlobalParametersChanged:
115 throw std::runtime_error(
"Failed to notify the FitScriptGeneratorPresenter.");
121 case ViewEvent::FittingModeChanged:
125 throw std::runtime_error(
"Failed to notify the FitScriptGeneratorPresenter.");
135 workspaceRows.erase(std::remove_if(workspaceRows.begin(), workspaceRows.end(), differentWsName), workspaceRows.end());
155 if (!workspaces.empty() && !workspaceIndices.empty())
214 std::string
const &constraint) {
222 }
catch (std::invalid_argument
const &ex) {
229 std::vector<std::string> workspaceNames, domainNames, ties, constraints;
230 std::vector<double> values;
231 std::vector<bool> fixes;
235 values, fixes, ties, constraints);
242 for (
auto i = 0u; i < values.size(); ++i) {
275 for (
auto const &workspaceName : workspaceNames)
276 addWorkspace(workspaceName.toStdString(), startX, endX);
281 std::vector<WorkspaceIndex>
const &workspaceIndices) {
282 for (
auto const &
workspace : workspaces) {
283 for (
auto const &workspaceIndex : workspaceIndices) {
284 auto const xData =
workspace->x(workspaceIndex.value);
293 if (ads.doesExist(workspaceName))
309 double startX,
double endX) {
313 }
catch (std::invalid_argument
const &ex) {
319 for (
auto const &
index : domainIndices) {
332 "its workspace, and less than the EndX.");
341 "its workspace, and greater than the StartX.");
346 std::string
const ¶meter,
double newValue) {
347 auto const equivalentParameter =
353 std::string
const &fullAttribute,
359 std::string
const ¶meter, std::string
const &tie) {
361 auto const [equivalentParameter, equivalentTie] =
364 }
catch (std::invalid_argument
const &ex) {
371 std::string
const ¶meter) {
377 std::string
const &functionIndex,
378 std::string
const &constraint) {
379 auto const equivalentFunctionIndex =
385 std::string
const &function) {
390 std::string
const &function) {
395 std::string
const &function) {
406template <
typename GetX,
typename UpdateX>
410 auto const newValue = std::invoke(std::forward<GetX>(getX),
m_view, domainIndex);
415template <
typename UpdateFunction>
417 std::string
const &function) {
426template <
typename UpdateFunction,
typename... Args>
433template <
typename Function,
typename... Args>
439 std::invoke(std::forward<Function>(func),
this, workspaceName, workspaceIndex, arguments...);
447 std::vector<std::string> &workspaceNames,
448 std::vector<std::string> &domainNames,
449 std::vector<double> &values, std::vector<bool> &fixes,
450 std::vector<std::string> &ties,
451 std::vector<std::string> &constraints)
const {
453 std::reverse(domainIndices.begin(), domainIndices.end());
454 for (
auto const domainIndex : domainIndices) {
461 FitDomainIndex domainIndex, std::string
const ¶meter, std::vector<std::string> &workspaceNames,
462 std::vector<std::string> &domainNames, std::vector<double> &values, std::vector<bool> &fixes,
463 std::vector<std::string> &ties, std::vector<std::string> &constraints)
const {
475 std::string
const ¶meter,
double value,
bool fix,
476 std::string
const &tie,
477 std::string
const &constraint) {
490std::vector<FitDomainIndex>
492 auto const doesNotHaveParameter = [&](
FitDomainIndex domainIndex) {
497 domainIndices.erase(std::remove_if(domainIndices.begin(), domainIndices.end(), doesNotHaveParameter),
498 domainIndices.end());
499 std::reverse(domainIndices.begin(), domainIndices.end());
500 return domainIndices;
504 std::string
const &workspaceName,
WorkspaceIndex workspaceIndex, std::string
const ¶meter,
505 std::string
const &tie)
const {
506 auto const equivalentParameter =
509 return {equivalentParameter, equivalentTie};
514 std::stringstream ss;
515 std::copy(
m_warnings.cbegin(),
m_warnings.cend(), std::ostream_iterator<std::string>(ss,
"\n"));
524 if (!message.empty())
528 std::invoke(std::forward<Generator>(func),
this);
533 if (!filepath.empty()) {
541 if (!scriptText.empty()) {
double value
The value of the point.
IPeaksWorkspace_sptr workspace
std::map< DeltaEMode::Type, std::string > index
Attribute is a non-fitting parameter.
Base MatrixWorkspace Abstract Class.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)