Mantid
|
Functions | |
void | GetIndicesFromLinearIndex (const size_t numDims, const size_t linear_index, const size_t *index_maker, const size_t *index_max, size_t *out_indices) |
Set up a nested for loop by creating an array of counters. More... | |
size_t | GetLinearIndex (const size_t numDims, size_t *index, size_t *index_maker) |
Return a linear index from dimensional indices of a nested for loop. More... | |
bool | Increment (const size_t numDims, size_t *index, size_t *index_max) |
Utility function for performing arbitrarily nested for loops in a serial way. More... | |
bool | Increment (const size_t numDims, size_t *index, size_t *index_max, size_t *index_min) |
Utility function for performing arbitrarily nested for loops in a serial way. More... | |
void | SetUp (const size_t numDims, size_t *out, const size_t value=0) |
Set up a nested for loop by setting an array of counters. More... | |
void | SetUpIndexMaker (const size_t numDims, size_t *out, const size_t *index_max) |
Set up an "index maker" for a nested for loop. More... | |
|
inline |
Set up a nested for loop by creating an array of counters.
numDims | :: how many levels of nesting do the for loops have? | |
linear_index | :: linear index into the nested for loop. | |
index_maker | :: an array[numDims], result of SetUpIndexMaker() | |
index_max | :: an array[numDims] of the maximum value (exclusive) of the index in each dimension. The minimum must be 0 in each dimension for the algorithm to work | |
[out] | out_indices | :: an array, sized numDims, which will be filled with the index for each dimension, given the linear index |
Definition at line 144 of file Utils.h.
References Mantid::Geometry::d.
Referenced by Mantid::DataObjects::MDHistoWorkspaceIterator::findNeighbourIndexesByWidth(), Mantid::DataObjects::MDHistoWorkspaceIterator::findNeighbourIndexesByWidth1D(), Mantid::DataObjects::MDHistoWorkspaceIterator::findNeighbourIndexesFaceTouching(), Mantid::DataObjects::MDHistoWorkspaceIterator::getBoxExtents(), Mantid::DataObjects::MDHistoWorkspaceIterator::getCenter(), Mantid::DataObjects::MDHistoWorkspace::getCenter(), Mantid::DataObjects::MDHistoWorkspace::getVertexesArray(), and Mantid::DataObjects::MDHistoWorkspaceIterator::init().
|
inline |
Return a linear index from dimensional indices of a nested for loop.
linear_index = index_maker[0] * index[0] + index_maker[1] * index[1] + ...
The lowest dimension index (0) will vary the slowest.
numDims | :: how many levels of nesting do the for loops have? |
index | :: an array[numDims] of the counter index in each dimension. |
index_maker | :: result of SetUpIndexMaker() |
Definition at line 125 of file Utils.h.
References Mantid::Geometry::d, and index.
Referenced by Mantid::DataObjects::MDHistoWorkspaceIterator::jumpToNearest().
|
inline |
Utility function for performing arbitrarily nested for loops in a serial way.
This version assumes that the minimum in each dimension is 0.
numDims | :: the number of dimensions (levels of nesting) to loop over |
index | :: an array[numDims] of the counter index in each dimension. |
index_max | :: an array[numDims] of the maximum value (exclusive) of the index in each dimension |
Definition at line 195 of file Utils.h.
References Mantid::Geometry::d, and index.
|
inline |
Utility function for performing arbitrarily nested for loops in a serial way.
numDims | :: the number of dimensions (levels of nesting) to loop over |
index | :: an array[numDims] of the current counter index in each dimension. The index at the lowest dimension will be incremented, carrying over to higher dimensions. |
index_max | :: an array[numDims] of the maximum value (exclusive) of the index in each dimension |
index_min | :: an array[numDims] of the minimum value of the index in each dimension. |
Definition at line 165 of file Utils.h.
References Mantid::Geometry::d, and index.
Referenced by Mantid::DataObjects::MDEventsTestHelper::feedMDBox(), and Mantid::DataObjects::MDHistoWorkspaceIterator::next().
|
inline |
Set up a nested for loop by setting an array of counters.
numDims | :: how many levels of nesting do the for loops have? |
out | :: a size-numDims array that will be modified |
value | :: fill the array to this. |
Definition at line 82 of file Utils.h.
References Mantid::Geometry::d, and value.
Referenced by Mantid::DataObjects::MDEventsTestHelper::feedMDBox(), and Mantid::DataObjects::MDHistoWorkspaceIterator::init().
|
inline |
Set up an "index maker" for a nested for loop.
Makes an array of size [numDims] that is used to make a linearized index out of dimensional indices. If the output is "out" and the array of indices is "index": linear_index = out[0] * index[0] + out[1] * index[1] + ...
The lowest dimension index (0) will vary the slowest.
numDims | :: how many levels of nesting do the for loops have? |
out | :: a size-numDims array that will be modified |
index_max | :: an array[numDims] of the maximum value (exclusive) of the index in each dimension. The minimum must be 0 in each dimension for the algorithm to work |
Definition at line 104 of file Utils.h.
References Mantid::Geometry::d.
Referenced by Mantid::MDAlgorithms::ReplicateMD::exec(), Mantid::DataObjects::MDHistoWorkspaceIterator::init(), and Mantid::DataObjects::MDHistoWorkspace::initVertexesArray().