Skip to content

Commit

Permalink
Flip input/ouput arguments around. Refs #970
Browse files Browse the repository at this point in the history
  • Loading branch information
martyngigg committed Apr 15, 2013
1 parent c20e9c6 commit 5542c77
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace Mantid
/// Base-class method
void function1D(double* out, const double* xValues, const size_t nData) const;
/// Python-type signature
void function1D(boost::python::object & out, const boost::python::object & xvals) const;
void function1D(const boost::python::object & xvals, boost::python::object & out) const;
///@}

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ void export_IFunction1D()
*/
class_<IFunction1D,bases<IFunction>,boost::shared_ptr<IFunction1DAdapter>,
boost::noncopyable>("IFunction1D", "Base class for 1D Fit functions")
.def("function1D", (void (IFunction1DAdapter::*)(object&,const object &)const)&IFunction1DAdapter::function1D,
.def("function1D", (void (IFunction1DAdapter::*)(const object &,object&)const)&IFunction1DAdapter::function1D,
"Calculate the values of the function for the given x values. The output should be stored in the out array")
;
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@ namespace Mantid
Py_intptr_t dims[1] = { static_cast<Py_intptr_t>(nData) } ;
object xvals = object(handle<>(Converters::WrapReadOnly::apply<double>::createFromArray(xValues, 1,dims)));
object outnp = object(handle<>(Converters::WrapReadWrite::apply<double>::createFromArray(out, 1,dims)));
function1D(outnp, xvals);
function1D(xvals, outnp);
}

/**
* Python-type signature version of above
* @param out A read/write numpy array of doubles to store the results
* @param xvals The input X values in read-only numpy array
* @param out A read/write numpy array of doubles to store the results
*/
void IFunction1DAdapter::function1D(boost::python::object & out, const boost::python::object & xvals) const
void IFunction1DAdapter::function1D(const boost::python::object & xvals, boost::python::object & out) const
{
CallMethod2<void,object,object>::dispatchWithException(getSelf(), "function1D", out, xvals);
CallMethod2<void,object,object>::dispatchWithException(getSelf(), "function1D", xvals, out);
}


Expand Down

0 comments on commit 5542c77

Please sign in to comment.