/** * @param fun :: The function * @param expr :: The tie expression: either parName = TieString or a list * of name = string pairs */ void FunctionFactoryImpl::addTies(IFunction_sptr fun, const Expression &expr) const { if (expr.name() == "=") { addTie(fun, expr); } else if (expr.name() == ",") { for (const auto &constraint : expr) { addTie(fun, constraint); } } }
/** * @param fun :: The function * @param expr :: The tie expression: either parName = TieString or a list * of name = string pairs */ void FunctionFactoryImpl::addTies(IFitFunction* fun,const Expression& expr)const { if (expr.name() == "=") { addTie(fun,expr); } else if (expr.name() == ",") { for(size_t i=0;i<expr.size();i++) { addTie(fun,expr[i]); } } }
/** * Ties a parameter to other parameters * @param parName :: The name of the parameter to tie. * @param expr :: A math expression * @param isDefault :: Flag to mark as default the value of an object associated with this reference: a tie or a constraint. * @return newly ties parameters */ ParameterTie* IFunction::tie(const std::string& parName,const std::string& expr, bool isDefault) { ParameterTie* ti = new ParameterTie(this,parName,expr,isDefault); addTie(ti); this->fix(getParameterIndex(*ti)); return ti; }
/** * Create and connect actions */ void FunctionBrowser::createActions() { m_actionAddFunction = new QAction("Add function",this); connect(m_actionAddFunction,SIGNAL(triggered()),this,SLOT(addFunction())); m_actionRemoveFunction = new QAction("Remove function",this); connect(m_actionRemoveFunction,SIGNAL(triggered()),this,SLOT(removeFunction())); m_actionFixParameter = new QAction("Fix",this); connect(m_actionFixParameter,SIGNAL(triggered()),this,SLOT(fixParameter())); m_actionRemoveTie = new QAction("Remove tie",this); connect(m_actionRemoveTie,SIGNAL(triggered()),this,SLOT(removeTie())); m_actionAddTie = new QAction("Add tie",this); connect(m_actionAddTie,SIGNAL(triggered()),this,SLOT(addTie())); m_actionFromClipboard = new QAction("Copy from clipboard",this); connect(m_actionFromClipboard,SIGNAL(triggered()),this,SLOT(copyFromClipboard())); m_actionToClipboard = new QAction("Copy to clipboard",this); connect(m_actionToClipboard,SIGNAL(triggered()),this,SLOT(copyToClipboard())); m_actionConstraints = new QAction("Custom",this); connect(m_actionConstraints,SIGNAL(triggered()),this,SLOT(addConstraints())); m_actionConstraints10 = new QAction("10%",this); connect(m_actionConstraints10,SIGNAL(triggered()),this,SLOT(addConstraints10())); m_actionConstraints50 = new QAction("50%",this); connect(m_actionConstraints50,SIGNAL(triggered()),this,SLOT(addConstraints50())); m_actionRemoveConstraints = new QAction("Remove constraints",this); connect(m_actionRemoveConstraints,SIGNAL(triggered()),this,SLOT(removeConstraints())); m_actionRemoveConstraint = new QAction("Remove",this); connect(m_actionRemoveConstraint,SIGNAL(triggered()),this,SLOT(removeConstraint())); }