Commit 40615397 authored by Stephen's avatar Stephen
Browse files

Clean up redundant code

Clang format
parent 8dc18645
......@@ -90,7 +90,7 @@ public:
size_t nParams() const override;
// Total number of attributes, which includes global and local function
// attributes
size_t nAttributes() const override;
size_t nAttributes() const noexcept override;
// Total number of global attributes, defined at the composite function level
size_t nGlobalAttributes() const noexcept { return IFunction::nAttributes(); }
/// Returns the index of parameter name
......@@ -175,8 +175,6 @@ public:
void checkFunction();
/// Remove all member functions
void clear();
// std::vector < std::string> getAttributeNames() const override;
/// Returns the number of attributes associated with the function
virtual size_t nLocalAttributes() const { return 0; }
/// Returns a list of attribute names
......
......@@ -588,7 +588,7 @@ protected:
/// Declare a single attribute
virtual void declareAttribute(const std::string &name,
const API::IFunction::Attribute &defaultValue);
const API::IFunction::Attribute &defaultValue);
/// Store an attribute's value
void storeAttributeValue(const std::string &name,
const API::IFunction::Attribute &value);
......
......@@ -307,9 +307,7 @@ CompositeFunction::getAttribute(const std::string &name) const {
}
/**
* Set a value to a named attribute. Can be overridden in the inheriting class,
* the default
* just stores the value
* Set a value of a named attribute.
* @param name :: The name of the attribute
* @param value :: The value of the attribute
*/
......@@ -382,20 +380,6 @@ std::string CompositeFunction::parameterDescription(size_t i) const {
ostr << m_functions[iFun]->parameterDescription(i - m_paramOffsets[iFun]);
return ostr.str();
}
///// Returns a list of attribute names, including the attributes of the child
///// functions
// std::vector<std::string> CompositeFunction::getAttributeNames() const {
// std::vector<std::string> attributeNames;
// attributeNames.reserve(nAttributes() + 1);
// // Add global numerical derivative attribute
// attributeNames.insert(attributeNames.end(), ATTNUMDERIV);
// // Add child attributes
// auto names = IFunction::getAttributeNames();
// attributeNames.insert(attributeNames.end(), names.begin(), names.end());
// return attributeNames;
//}
/**
* Get the fitting error for a parameter
* @param i :: The index of a parameter
......
......@@ -247,11 +247,7 @@ size_t TabulatedFunction::nAttributes() const {
/// Returns a list of attribute names
std::vector<std::string> TabulatedFunction::getAttributeNames() const {
std::vector<std::string> attNames = IFunction::getAttributeNames();
//attNames.emplace_back("X");
//attNames.emplace_back("Y");
return attNames;
return IFunction::getAttributeNames();
}
/// Return a value of attribute attName
......
......@@ -155,7 +155,8 @@ public:
}
};
class ConvolutionTest_LinearWithAttributes : public ParamFunction, public IFunction1D {
class ConvolutionTest_LinearWithAttributes : public ParamFunction,
public IFunction1D {
public:
ConvolutionTest_LinearWithAttributes() {
declareParameter("a");
......@@ -163,7 +164,9 @@ public:
declareAttribute("TestAttribute", Attribute(""));
}
std::string name() const override { return "ConvolutionTest_LinearWithAttributes"; }
std::string name() const override {
return "ConvolutionTest_LinearWithAttributes";
}
void function1D(double *out, const double *xValues,
const size_t nData) const override {
......@@ -182,8 +185,6 @@ public:
}
};
DECLARE_FUNCTION(ConvolutionTest_Gauss)
DECLARE_FUNCTION(ConvolutionTest_Lorentz)
DECLARE_FUNCTION(ConvolutionTest_Linear)
......@@ -387,8 +388,7 @@ public:
void testAttributesSetUpCorrectlyForConvolution() {
Convolution conv;
auto func =
std::make_shared<ConvolutionTest_LinearWithAttributes>();
auto func = std::make_shared<ConvolutionTest_LinearWithAttributes>();
conv.addFunction(func);
auto names = conv.getAttributeNames();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment