This class calculate elements of the hyper-cube. More...
This class calculate elements of the hyper-cube.
This class give you a set of utility functions for the hyper-cube like getting number of faces, number of edge, number of vertex, or in general number of elements of dimension d, position of each element
dim | dimensionality of the Hyper-cube |
hyper-cube define only the features of an N-dimensional hyper-cube, does not define where is is located and its size, use Box for that purpose
Definition at line 54 of file HyperCube.hpp.
#include <HyperCube.hpp>
Static Public Member Functions | |
static size_t | getNumberOfElements_R (size_t d) |
Get the number of Elements of dimension d. More... | |
static size_t | getNumberOfElementsTo_R (size_t d_t) |
Get the sum of the number of elements from d to d_t (included) More... | |
static std::vector< comb< dim > > | getCombinations_R (size_t d) |
static void | BinPermutations (grid_key_dx_r &pos, std::vector< comb< dim >> &v) |
Binary permutations. More... | |
static void | BinPermutationsSt (std::vector< comb< dim >> &v) |
Binary permutations. More... | |
static size_t | LinPerm (comb< dim > &c) |
Linearize the Permitation given by BinPermutationSt. More... | |
static size_t | LinId (comb< dim > &c) |
Linearize the combination. More... | |
static bool | isPositive (size_t d) |
isPositive return if the combination d is a positive or a negative More... | |
static int | positiveFace (int d) |
return the combination of the positive face on direction d More... | |
static int | negativeFace (int d) |
Return the combination of the negative face on direction d. More... | |
|
inlinestatic |
Binary permutations.
Fill v with all the possible binary permutations it produce 2^(pos.getDim()) Permutations
Example
if getDim() is 2
it produce 4 configuration
(1,1) (1,-1) (-1,1) (-1,-1)
and fill the number in the position indicated by Iterator_g_const
pos | slots inside comb to fill with all permutations |
v | vector to fill with the permutations |
Definition at line 160 of file HyperCube.hpp.
|
inlinestatic |
Binary permutations.
Fill v with all the possible binary permutations it produce 2^(pos.getDim()) Permutations
Example
if getDim() is 2
it produce 4 configuration
(1,1) (1,-0) (0,1) (0,0)
from another prospective given
* * +----#----+ * | | * | | * # * # * | | * | | * +----#----+ * *
combination in the center (*) the down-left vertex (+). down and left edge (#)
pos | slots inside comb to fill with all permutations |
v | vector to fill with the permutations |
Definition at line 222 of file HyperCube.hpp.
|
inlinestatic |
brief Calculate the position (combinations) of all the elements of size d
d | dimensionality of the object returned in the combinations |
Definition at line 97 of file HyperCube.hpp.
|
inlinestatic |
Get the number of Elements of dimension d.
d | dimensionality of the element |
Definition at line 64 of file HyperCube.hpp.
|
inlinestatic |
Get the sum of the number of elements from d to d_t (included)
d_t |
Definition at line 80 of file HyperCube.hpp.
|
inlinestatic |
isPositive return if the combination d is a positive or a negative
For an hyper-cube of dimension dim we have 2*dim faces combinations half on positive direction half on negative direction, the function check if the d combination is negative or positive
d |
Definition at line 369 of file HyperCube.hpp.
Linearize the combination.
It map the combination into a linear id, in particular given the vector of combinations with get getCombinations_R, given the combination it give where is located in the vector
c | given combination |
Definition at line 294 of file HyperCube.hpp.
Linearize the Permitation given by BinPermutationSt.
Suppose BinPermutation return the following combination
(-1,-1) (-1,0) (0,-1) (0,0)
giving (0,-1) it return 2
c | combination to linearize |
Definition at line 264 of file HyperCube.hpp.
|
inlinestatic |
Return the combination of the negative face on direction d.
d | direction |
Definition at line 393 of file HyperCube.hpp.
|
inlinestatic |
return the combination of the positive face on direction d
d | direction |
Definition at line 381 of file HyperCube.hpp.