/** Remove a constraint * @param parName :: The name of a parameter which constarint to remove. */ void CompositeFunction::removeConstraint(const std::string &parName) { auto i = parameterIndex(parName); auto constraint = IFunction::getConstraint(i); if (constraint != nullptr) { IFunction::removeConstraint(parName); } else { size_t iPar = parameterIndex(parName); size_t iFun = functionIndex(iPar); getFunction(iFun)->removeConstraint(parameterLocalName(iPar)); } }
/** Returns the name of parameter i as it declared in its function * @param i :: The parameter index * @param recursive :: If true call parameterLocalName recusively until * a non-composite function is reached. * @return The pure parameter name (without the function identifier f#.) */ std::string CompositeFunction::parameterLocalName(size_t i, bool recursive) const { size_t iFun = functionIndex(i); auto localIndex = i - m_paramOffsets[iFun]; auto localFunction = m_functions[iFun].get(); if (recursive) { auto cf = dynamic_cast<const CompositeFunction *>(localFunction); if (cf) { return cf->parameterLocalName(localIndex, recursive); } } return localFunction->parameterName(localIndex); }
/** Remove a constraint * @param parName :: The name of a parameter which constarint to remove. */ void CompositeFunction::removeConstraint(const std::string &parName) { size_t iPar = parameterIndex(parName); size_t iFun = functionIndex(iPar); getFunction(iFun)->removeConstraint(parameterLocalName(iPar)); }