Skip to content

Commit

Permalink
Re #5564 Applied clang-format patch
Browse files Browse the repository at this point in the history
  • Loading branch information
josephframsay committed Jul 19, 2017
1 parent aced5b9 commit e4333dc
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 51 deletions.
3 changes: 1 addition & 2 deletions Framework/Algorithms/inc/MantidAlgorithms/WorkspaceJoiners.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ class DLLExport WorkspaceJoiners : public API::Algorithm {

using Mantid::API::Algorithm::validateInputs;
void validateInputs(const API::MatrixWorkspace &ws1,
const API::MatrixWorkspace &ws2,
const bool checkBinning);
const API::MatrixWorkspace &ws2, const bool checkBinning);
void validateInputs(const API::MatrixWorkspace &ws1,
const API::MatrixWorkspace &ws2);
void getMinMax(const API::MatrixWorkspace &ws, specnum_t &min,
Expand Down
101 changes: 52 additions & 49 deletions Framework/Algorithms/src/WorkspaceJoiners.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,59 +163,62 @@ MatrixWorkspace_sptr WorkspaceJoiners::execEvent() {
return std::move(output);
}

/** Checks that the two input workspace have common binning & size, the same
* instrument & unit.
/** Checks that the two input workspace have common size and the same
* instrument & unit. There is an option to check whether their binning is compatible
* Also calls the checkForOverlap method.
* @param ws1 :: The first input workspace
* @param ws2 :: The second input workspace
* @param checkBinning :: A flag for whether to check that the workspaces have compatible binning
* @param checkBinning :: A flag for whether to check that the workspaces have
* compatible binning
* @throw std::invalid_argument If the workspaces are not compatible
*/
void Mantid::Algorithms::WorkspaceJoiners::validateInputs(const API::MatrixWorkspace & ws1, const API::MatrixWorkspace & ws2, const bool checkBinning){
// Workspaces with point data are allowed to have different binning
if (checkBinning) {
// This is the full check for common binning
if (!WorkspaceHelpers::commonBoundaries(ws1) ||
!WorkspaceHelpers::commonBoundaries(ws2)) {
g_log.error("Both input workspaces must have common binning for all "
"their spectra");
throw std::invalid_argument("Both input workspaces must have common "
"binning for all their spectra");
}
}

if (ws1.getInstrument()->getName() != ws2.getInstrument()->getName()) {
const std::string message("The input workspaces are not compatible because "
"they come from different instruments");
g_log.error(message);
throw std::invalid_argument(message);
}

Unit_const_sptr ws1_unit = ws1.getAxis(0)->unit();
Unit_const_sptr ws2_unit = ws2.getAxis(0)->unit();
const std::string ws1_unitID = (ws1_unit ? ws1_unit->unitID() : "");
const std::string ws2_unitID = (ws2_unit ? ws2_unit->unitID() : "");

if (ws1_unitID != ws2_unitID) {
const std::string message("The input workspaces are not compatible because "
"they have different units on the X axis");
g_log.error(message);
throw std::invalid_argument(message);
}

if (ws1.isDistribution() != ws2.isDistribution()) {
const std::string message(
"The input workspaces have inconsistent distribution flags");
g_log.error(message);
throw std::invalid_argument(message);
}

if (!WorkspaceHelpers::matchingBins(ws1, ws2, true)) {
const std::string message("The input workspaces are not compatible because "
"they have different binning");
g_log.error(message);
throw std::invalid_argument(message);
}
void Mantid::Algorithms::WorkspaceJoiners::validateInputs(
const API::MatrixWorkspace &ws1, const API::MatrixWorkspace &ws2,
const bool checkBinning) {
// Workspaces with point data are allowed to have different binning
if (checkBinning) {
// This is the full check for common binning
if (!WorkspaceHelpers::commonBoundaries(ws1) ||
!WorkspaceHelpers::commonBoundaries(ws2)) {
g_log.error("Both input workspaces must have common binning for all "
"their spectra");
throw std::invalid_argument("Both input workspaces must have common "
"binning for all their spectra");
}
}

if (ws1.getInstrument()->getName() != ws2.getInstrument()->getName()) {
const std::string message("The input workspaces are not compatible because "
"they come from different instruments");
g_log.error(message);
throw std::invalid_argument(message);
}

Unit_const_sptr ws1_unit = ws1.getAxis(0)->unit();
Unit_const_sptr ws2_unit = ws2.getAxis(0)->unit();
const std::string ws1_unitID = (ws1_unit ? ws1_unit->unitID() : "");
const std::string ws2_unitID = (ws2_unit ? ws2_unit->unitID() : "");

if (ws1_unitID != ws2_unitID) {
const std::string message("The input workspaces are not compatible because "
"they have different units on the X axis");
g_log.error(message);
throw std::invalid_argument(message);
}

if (ws1.isDistribution() != ws2.isDistribution()) {
const std::string message(
"The input workspaces have inconsistent distribution flags");
g_log.error(message);
throw std::invalid_argument(message);
}

if (!WorkspaceHelpers::matchingBins(ws1, ws2, true)) {
const std::string message("The input workspaces are not compatible because "
"they have different binning");
g_log.error(message);
throw std::invalid_argument(message);
}
}

/** Checks that the two input workspace have common binning & size, the same
Expand All @@ -227,7 +230,7 @@ void Mantid::Algorithms::WorkspaceJoiners::validateInputs(const API::MatrixWorks
*/
void WorkspaceJoiners::validateInputs(const MatrixWorkspace &ws1,
const MatrixWorkspace &ws2) {
validateInputs(ws1, ws2, true);
validateInputs(ws1, ws2, true);
}

/**
Expand Down

0 comments on commit e4333dc

Please sign in to comment.