Skip to content

Commit

Permalink
Clang format ConvertToMD.
Browse files Browse the repository at this point in the history
Refs #11350
  • Loading branch information
martyngigg committed Mar 13, 2015
1 parent 0984ed0 commit 497b59d
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions Code/Mantid/Framework/MDAlgorithms/src/ConvertToMD.cpp
Expand Up @@ -87,8 +87,9 @@ void ConvertToMD::init() {
setPropertyGroup("MinRecursionDepth", getBoxSettingsGroupName());

declareProperty(
new PropertyWithValue<bool>("InitialSplitting", 0, Direction::Input),
"This option causes an initial split of 50 for the first four dimensions at level 0.");
new PropertyWithValue<bool>("InitialSplitting", 0, Direction::Input),
"This option causes an initial split of 50 for the first four dimensions "
"at level 0.");
}
//----------------------------------------------------------------------------------------------
/** Destructor
Expand Down Expand Up @@ -475,13 +476,10 @@ API::IMDEventWorkspace_sptr ConvertToMD::createNewMDWorkspace(
// Check if the user want sto force an initial split or not
bool initialSplittingChecked = this->getProperty("InitialSplitting");

if (!initialSplittingChecked)
{
if (!initialSplittingChecked) {
// split boxes;
spws->splitBox();
}
else
{
} else {
// Perform initial split with the forced settings
performInitialSplitting(spws, bc);
}
Expand All @@ -498,35 +496,35 @@ API::IMDEventWorkspace_sptr ConvertToMD::createNewMDWorkspace(
}

/**
* Splits the initial box at level 0 into a defined number of subboxes for the the first level.
* Splits the initial box at level 0 into a defined number of subboxes for the
* the first level.
* @param spws A pointer to the newly created event workspace.
* @param bc A pointer to the box controller.
*/
void ConvertToMD::performInitialSplitting(API::IMDEventWorkspace_sptr spws, Mantid::API::BoxController_sptr bc)
{
void ConvertToMD::performInitialSplitting(API::IMDEventWorkspace_sptr spws,
Mantid::API::BoxController_sptr bc) {
const size_t initialSplitSetting = 50;
const size_t dimCutoff = 4;

// Record the split settings of the box controller in a buffer and set the new value
// Record the split settings of the box controller in a buffer and set the new
// value
std::vector<size_t> splitBuffer;

for (size_t dim = 0; dim < bc->getNDims(); dim++)
{

for (size_t dim = 0; dim < bc->getNDims(); dim++) {
splitBuffer.push_back(bc->getSplitInto(dim));

// Replace the box controller setting only for a max of the first three dimensions
if (dim < dimCutoff)
{
bc->setSplitInto(dim, initialSplitSetting);
// Replace the box controller setting only for a max of the first three
// dimensions
if (dim < dimCutoff) {
bc->setSplitInto(dim, initialSplitSetting);
}
}

// Perform the initial splitting
spws->splitBox();

// Revert changes on the box controller
for (size_t dim = 0; dim < bc->getNDims(); ++dim)
{
for (size_t dim = 0; dim < bc->getNDims(); ++dim) {
bc->setSplitInto(dim, splitBuffer[dim]);
}
}
Expand Down

0 comments on commit 497b59d

Please sign in to comment.