Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:
exclude: .md5$|^external/|^tools/|Testing/Tools/cxxtest

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.7
rev: v20.1.0
hooks:
- id: clang-format
exclude: Testing/Tools/cxxtest|tools|qt/icons/resources/
Expand Down Expand Up @@ -59,7 +59,7 @@ repos:
)$

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.10
rev: v0.11.2
# ruff must appear before black in the list of hooks
hooks:
- id: ruff
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ void GramCharlierComptonProfile::addMassProfile(double *result, const unsigned i
const double hermiteCoeff = getParameter(os.str());
const double factorial = gsl_sf_fact(npoly / 2);
// Intel compiler doesn't overload pow for unsigned types
const double denom = ((std::pow(2.0, static_cast<int>(npoly)))*factorial);
const double denom = std::pow(2.0, static_cast<int>(npoly)) * factorial;

for (int j = 0; j < NFINE_Y; ++j) {
const double y = m_yfine[j] / M_SQRT2 / wg;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
namespace Mantid {
namespace DataHandling {

class MANTID_DATAHANDLING_DLL LoadStlFactory{
class MANTID_DATAHANDLING_DLL LoadStlFactory {

// clang-format off
public :
Expand All @@ -29,7 +29,7 @@ static std::unique_ptr<LoadStl> createReader(const std::string &filename, ScaleU
}
return reader;
}
// clang-format on
// clang-format on

}; // namespace Mantid

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,11 @@ template <typename CheckDimensionPolicy> class MANTID_GEOMETRY_DLL MDGeometryBui
@date May 2011
@version 1.0
*/
struct MANTID_GEOMETRY_DLL StrictDimensionPolicy{public : StrictDimensionPolicy(){} void operator()(
// clang-format off
struct MANTID_GEOMETRY_DLL StrictDimensionPolicy {
public:
StrictDimensionPolicy() {}
void operator()(
// clang-format off
const IMDDimension &item) {
if (true == item.getIsIntegrated()) {
std::string message = "StrictDimensionPolicy bans the use of integrated IMDDimensions mapped to x, y, z "
Expand All @@ -129,9 +132,8 @@ struct MANTID_GEOMETRY_DLL StrictDimensionPolicy{public : StrictDimensionPolicy(
@date May 2011
*/
struct MANTID_GEOMETRY_DLL NoDimensionPolicy {
void
operator()(const IMDDimension &){
// Do nothing.
void operator()(const IMDDimension &) {
// Do nothing.
}
};
} // namespace Geometry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ namespace Geometry {
@author Owen Arnold, Tessella plc
@date 16/12/2010*/

class MANTID_GEOMETRY_DLL
MDGeometryXMLDefinitions{// clang-format off
class MANTID_GEOMETRY_DLL MDGeometryXMLDefinitions { // clang-format off
public :
// XML schema tag definitions for generating xml.
static const std::string workspaceNameXMLTagStart(){ return "<MDWorkspaceName>"; }
Expand Down
44 changes: 18 additions & 26 deletions Framework/Geometry/test/ParameterMapTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,53 +246,48 @@ class ParameterMapTest : public CxxTest::TestSuite {
boost::function<void(ParameterMap *, const IComponent *, const std::string &, double, const std::string *const,
const std::string &)>
faddDouble;
faddDouble = (void(ParameterMap::*)(const IComponent *, const std::string &, double, const std::string *const,
const std::string &)) &
ParameterMap::addDouble;
faddDouble = (void (ParameterMap::*)(const IComponent *, const std::string &, double, const std::string *const,
const std::string &))&ParameterMap::addDouble;
doCopyAndUpdateTestUsingAddHelpers(faddDouble, "name", 5.0, 4.0);

// int
boost::function<void(ParameterMap *, const IComponent *, const std::string &, int, const std::string *const,
const std::string &)>
faddInt;
faddInt = (void(ParameterMap::*)(const IComponent *, const std::string &, int, const std::string *const,
const std::string &)) &
ParameterMap::addInt;
faddInt = (void (ParameterMap::*)(const IComponent *, const std::string &, int, const std::string *const,
const std::string &))&ParameterMap::addInt;
doCopyAndUpdateTestUsingAddHelpers(faddInt, "name", 3, 5);

// bool
boost::function<void(ParameterMap *, const IComponent *, const std::string &, bool, const std::string *const,
const std::string &)>
faddBool;
faddBool = (void(ParameterMap::*)(const IComponent *, const std::string &, bool, const std::string *const,
const std::string &)) &
ParameterMap::addBool;
faddBool = (void (ParameterMap::*)(const IComponent *, const std::string &, bool, const std::string *const,
const std::string &))&ParameterMap::addBool;
doCopyAndUpdateTestUsingAddHelpers(faddBool, "name", true, false);

// string
boost::function<void(ParameterMap *, const IComponent *, const std::string &, const std::string &,
const std::string *const, const std::string &)>
faddStr;
faddStr = (void(ParameterMap::*)(const IComponent *, const std::string &, const std::string &,
const std::string *const, const std::string &)) &
ParameterMap::addString;
faddStr = (void (ParameterMap::*)(const IComponent *, const std::string &, const std::string &,
const std::string *const, const std::string &))&ParameterMap::addString;
doCopyAndUpdateTestUsingAddHelpers(faddStr, "name", std::string("first"), std::string("second"));

// V3D
boost::function<void(ParameterMap *, const IComponent *, const std::string &, const V3D &,
const std::string *const)>
faddV3D;
faddV3D = (void(ParameterMap::*)(const IComponent *, const std::string &, const V3D &, const std::string *const)) &
ParameterMap::addV3D;
faddV3D = (void (ParameterMap::*)(const IComponent *, const std::string &, const V3D &,
const std::string *const))&ParameterMap::addV3D;
doCopyAndUpdateTestUsingAddHelpersPositions(faddV3D, "V3D", V3D(1, 2, 3), V3D(4, 5, 6));

// Quat
boost::function<void(ParameterMap *, const IComponent *, const std::string &, const Quat &,
const std::string *const)>
faddQuat;
faddQuat =
(void(ParameterMap::*)(const IComponent *, const std::string &, const Quat &, const std::string *const)) &
ParameterMap::addQuat;
faddQuat = (void (ParameterMap::*)(const IComponent *, const std::string &, const Quat &,
const std::string *const))&ParameterMap::addQuat;
doCopyAndUpdateTestUsingAddHelpersPositions(faddQuat, "Quat", Quat(), Quat(45.0, V3D(0, 0, 1)));
}

Expand All @@ -304,23 +299,20 @@ class ParameterMapTest : public CxxTest::TestSuite {

// double
AddFuncHelper faddDouble;
faddDouble = (void(ParameterMap::*)(const IComponent *, const std::string &, const std::string &,
const std::string *const, const std::string &)) &
ParameterMap::addDouble;
faddDouble = (void (ParameterMap::*)(const IComponent *, const std::string &, const std::string &,
const std::string *const, const std::string &))&ParameterMap::addDouble;
doCopyAndUpdateTestUsingAddHelpersAsStrings<AddFuncHelper, double>(faddDouble, "name", 5.0, 4.0);

// int
AddFuncHelper faddInt;
faddInt = (void(ParameterMap::*)(const IComponent *, const std::string &, const std::string &,
const std::string *const, const std::string &)) &
ParameterMap::addInt;
faddInt = (void (ParameterMap::*)(const IComponent *, const std::string &, const std::string &,
const std::string *const, const std::string &))&ParameterMap::addInt;
doCopyAndUpdateTestUsingAddHelpersAsStrings<AddFuncHelper, int>(faddInt, "name", 3, 5);

// bool
AddFuncHelper faddBool;
faddBool = (void(ParameterMap::*)(const IComponent *, const std::string &, const std::string &,
const std::string *const, const std::string &)) &
ParameterMap::addBool;
faddBool = (void (ParameterMap::*)(const IComponent *, const std::string &, const std::string &,
const std::string *const, const std::string &))&ParameterMap::addBool;
doCopyAndUpdateTestUsingAddHelpersAsStrings<AddFuncHelper, bool>(faddBool, "name", true, false);
}

Expand Down
2 changes: 1 addition & 1 deletion Framework/HistogramData/src/Interpolate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void interpolateYCSplineInplace(const Mantid::HistogramData::Histogram &input,
}
}
}
double xsMaxEpsilon = *(std::max_element(xs.begin(), xs.end()))*std::numeric_limits<double>::epsilon();
double xsMaxEpsilon = *(std::max_element(xs.begin(), xs.end())) * std::numeric_limits<double>::epsilon();
// elements with i=j will have the largest value
double hMaxEpsilon = xsMaxEpsilon * 2 / 3;

Expand Down
2 changes: 1 addition & 1 deletion Framework/Kernel/inc/MantidKernel/RegistrationHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace Kernel {
*
* The MANTID_KERNEL_DLL needs to be available where this helper is imported and used.
*/
class MANTID_KERNEL_DLL RegistrationHelper{// clang-format off
class MANTID_KERNEL_DLL RegistrationHelper { // clang-format off
public:
/** Constructor. Does nothing.
* @param i :: Takes an int and does nothing with it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ template <typename ElementType> struct std_set_exporter {
.def("append", insert_element, (arg("self"), arg("element")))
.def("insert", insert_set, (arg("self"), arg("set")))
.def("extend", insert_set, (arg("self"), arg("set")))
.def("erase", (std::size_t(w_t::*)(e_t const &))&w_t::erase, (arg("self"), arg("index")))
.def("erase", (std::size_t (w_t::*)(e_t const &))&w_t::erase, (arg("self"), arg("index")))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we happy with the spaces it's putting for these casts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems odd

.def("clear", &w_t::clear, arg("self"))
.enable_pickling()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void export_ExperimentInfo() {
.def("mutableRun", &ExperimentInfo::mutableRun, return_value_policy<reference_existing_object>(), args("self"),
"Return a modifiable :class:`~mantid.api.Run` object.")
.def("getRunNumber", &ExperimentInfo::getRunNumber, args("self"), "Returns the run identifier for this run.")
.def("getEFixed", (double(ExperimentInfo::*)(const Mantid::detid_t) const) & ExperimentInfo::getEFixed,
.def("getEFixed", (double (ExperimentInfo::*)(const Mantid::detid_t) const) & ExperimentInfo::getEFixed,
args("self", "detId"))
.def("setEFixed", &ExperimentInfo::setEFixed, args("self", "detId", "value"))
.def("getEMode", &ExperimentInfo::getEMode, args("self"), "Returns the energy mode.")
Expand Down
12 changes: 6 additions & 6 deletions Framework/PythonInterface/mantid/api/src/Exports/IEventList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void export_IEventList() {
.def("getMemorySize", &IEventList::getMemorySize, args("self"), "Returns the memory size in bytes")
.def("integrate", &IEventList::integrate, args("self", "minX", "maxX", "entireRange"),
"Integrate the events between a range of X values, or all events.")
.def("convertTof", (void(IEventList::*)(const double, const double)) & IEventList::convertTof,
.def("convertTof", (void (IEventList::*)(const double, const double))&IEventList::convertTof,
args("self", "factor", "offset"), "Convert the time of flight by tof'=tof*factor+offset")
.def("scaleTof", &IEventList::scaleTof, args("self", "factor"),
"Convert the tof units by scaling by a multiplier.")
Expand All @@ -72,11 +72,11 @@ void export_IEventList() {
"Mask out events that have a tof between tofMin and tofMax "
"(inclusively)")
.def("maskCondition", &maskCondition, args("self", "mask"), "Mask out events by the condition vector")
.def("getTofs", (std::vector<double>(IEventList::*)() const) & IEventList::getTofs, args("self"),
.def("getTofs", (std::vector<double> (IEventList::*)() const) & IEventList::getTofs, args("self"),
return_clone_numpy(), "Get a vector of the TOFs of the events")
.def("getWeights", (std::vector<double>(IEventList::*)() const) & IEventList::getWeights, args("self"),
.def("getWeights", (std::vector<double> (IEventList::*)() const) & IEventList::getWeights, args("self"),
return_clone_numpy(), "Get a vector of the weights of the events")
.def("getWeightErrors", (std::vector<double>(IEventList::*)() const) & IEventList::getWeightErrors, args("self"),
.def("getWeightErrors", (std::vector<double> (IEventList::*)() const) & IEventList::getWeightErrors, args("self"),
return_clone_numpy(), "Get a vector of the weights of the events")
.def("getPulseTimes", &IEventList::getPulseTimes, args("self"), "Get a vector of the pulse times of the events")
.def("getPulseTimesAsNumpy",
Expand All @@ -88,12 +88,12 @@ void export_IEventList() {
"The minimum pulse time for the list of the events.")
.def("getTofMin", &IEventList::getTofMin, args("self"), "The minimum tof value for the list of the events.")
.def("getTofMax", &IEventList::getTofMax, args("self"), "The maximum tof value for the list of the events.")
.def("multiply", (void(IEventList::*)(const double, const double)) & IEventList::multiply,
.def("multiply", (void (IEventList::*)(const double, const double))&IEventList::multiply,
args("self", "value", "error"),
"Multiply the weights in this event "
"list by a scalar variable with an "
"error; though the error can be 0.0")
.def("divide", (void(IEventList::*)(const double, const double)) & IEventList::divide,
.def("divide", (void (IEventList::*)(const double, const double))&IEventList::divide,
args("self", "value", "error"),
"Divide the weights in this event "
"list by a scalar with an "
Expand Down
14 changes: 7 additions & 7 deletions Framework/PythonInterface/mantid/api/src/Exports/IFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,13 @@ void export_IFunction() {
.def("isExplicitlySet", &IFunction::isExplicitlySet, (arg("self"), arg("i")),
"Return whether the ith parameter needs to be explicitely set")

.def("getParameterValue", (double(IFunction::*)(size_t) const) & IFunction::getParameter, (arg("self"), arg("i")),
"Get the value of the ith parameter")
.def("getParameterValue", (double (IFunction::*)(size_t) const) & IFunction::getParameter,
(arg("self"), arg("i")), "Get the value of the ith parameter")

.def("getParameterValue", (double(IFunction::*)(const std::string &) const) & IFunction::getParameter,
.def("getParameterValue", (double (IFunction::*)(const std::string &) const) & IFunction::getParameter,
(arg("self"), arg("name")), "Get the value of the named parameter")

.def("__getitem__", (double(IFunction::*)(const std::string &) const) & IFunction::getParameter,
.def("__getitem__", (double (IFunction::*)(const std::string &) const) & IFunction::getParameter,
(arg("self"), arg("name")), "Get the value of the named parameter")

.def("setParameter", (setParameterType1)&IFunction::setParameter,
Expand Down Expand Up @@ -297,10 +297,10 @@ void export_IFunction() {
.def("addTies", &IFunction::addTies,
addTies_Overloads((arg("self"), arg("ties"), arg("isDefault")), "Add several ties to an IFunction."))

.def("removeTie", (bool(IFunction::*)(size_t)) & IFunction::removeTie, (arg("self"), arg("i")),
.def("removeTie", (bool (IFunction::*)(size_t))&IFunction::removeTie, (arg("self"), arg("i")),
"Remove the tie of the ith parameter")

.def("removeTie", (void(IFunction::*)(const std::string &)) & IFunction::removeTie, (arg("self"), arg("name")),
.def("removeTie", (void (IFunction::*)(const std::string &))&IFunction::removeTie, (arg("self"), arg("name")),
"Remove the tie of the named parameter")

.def("getTies", &IFunction::writeTies, arg("self"), "Returns the list of current ties as a string")
Expand Down Expand Up @@ -344,7 +344,7 @@ void export_IFunction() {
"Return a description of the ith parameter")
.def("getParamExplicit", &IFunction::isExplicitlySet, (arg("self"), arg("i")),
"Return whether the ith parameter needs to be explicitely set")
.def("getParamValue", (double(IFunction::*)(std::size_t) const) & IFunction::getParameter,
.def("getParamValue", (double (IFunction::*)(std::size_t) const) & IFunction::getParameter,
(arg("self"), arg("i")), "Get the value of the ith parameter")
.def("getParameterIndex", &IFunction::parameterIndex, (arg("self"), arg("name")),
"Returns the index of the provided parameter.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void export_IMDEventWorkspace() {
"Returns the number of dimensions in this "
":class:`~mantid.api.Workspace`")

.def("getBoxController", (BoxController_sptr(IMDEventWorkspace::*)())&IMDEventWorkspace::getBoxController,
.def("getBoxController", (BoxController_sptr (IMDEventWorkspace::*)())&IMDEventWorkspace::getBoxController,
arg("self"),
"Returns the :class:`~mantid.api.BoxController` used in this "
":class:`~mantid.api.Workspace`")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,17 +226,17 @@ void export_IMDHistoWorkspace() {
.def("getInverseVolume", &IMDHistoWorkspace::getInverseVolume, arg("self"),
return_value_policy<return_by_value>(), "Return the inverse of volume of EACH cell in the workspace.")

.def("getLinearIndex", (size_t(IMDHistoWorkspace::*)(size_t, size_t) const)&IMDHistoWorkspace::getLinearIndex,
.def("getLinearIndex", (size_t (IMDHistoWorkspace::*)(size_t, size_t) const) & IMDHistoWorkspace::getLinearIndex,
(arg("self"), arg("index1"), arg("index2")), return_value_policy<return_by_value>(),
"Get the 1D linear index from the 2D array")

.def("getLinearIndex",
(size_t(IMDHistoWorkspace::*)(size_t, size_t, size_t) const)&IMDHistoWorkspace::getLinearIndex,
(size_t (IMDHistoWorkspace::*)(size_t, size_t, size_t) const) & IMDHistoWorkspace::getLinearIndex,
(arg("self"), arg("index1"), arg("index2"), arg("index3")), return_value_policy<return_by_value>(),
"Get the 1D linear index from the 3D array")

.def("getLinearIndex",
(size_t(IMDHistoWorkspace::*)(size_t, size_t, size_t, size_t) const)&IMDHistoWorkspace::getLinearIndex,
(size_t (IMDHistoWorkspace::*)(size_t, size_t, size_t, size_t) const) & IMDHistoWorkspace::getLinearIndex,
(arg("self"), arg("index1"), arg("index2"), arg("index3"), arg("index4")),
return_value_policy<return_by_value>(), "Get the 1D linear index from the 4D array")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void export_IMaskWorkspace() {
class_<IMaskWorkspace, boost::noncopyable>("IMaskWorkspace", no_init)
.def("getNumberMasked", &IMaskWorkspace::getNumberMasked, arg("self"),
"Returns the number of masked pixels in the workspace")
.def("isMasked", (bool(IMaskWorkspace::*)(const Mantid::detid_t) const) & IMaskWorkspace::isMasked,
.def("isMasked", (bool (IMaskWorkspace::*)(const Mantid::detid_t) const) & IMaskWorkspace::isMasked,
(arg("self"), arg("detector_id")), "Returns whether the given detector ID is masked")
.def("isMasked", isMaskedFromList, (arg("self"), arg("detector_id_list")),
"Returns whether all of the given detector ID list are masked");
Expand Down
Loading