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 57 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. | |
static size_t | getNumberOfElementsTo_R (size_t d_t) |
Get the sum of the number of elements from d to d_t (included) | |
static std::vector< comb< dim > > | getCombinations_R (size_t d) |
static std::vector< comb< dim > > | getCombinations_R_bc (size_t d, const size_t(&bc)[dim]) |
static void | BinPermutations (grid_key_dx_r &pos, std::vector< comb< dim > > &v) |
Binary permutations. | |
static void | BinPermutationsSt (std::vector< comb< dim > > &v) |
Binary permutations. | |
static size_t | LinPerm (comb< dim > &c) |
Linearize the permutation given by BinPermutationSt. | |
static size_t | LinId (comb< dim > &c) |
Linearize the combination. | |
static bool | isPositive (size_t d) |
isPositive return if the combination d is a positive or a negative | |
static int | positiveFace (int d) |
return the combination of the positive face on direction d | |
static int | negativeFace (int d) |
Return the combination of the negative face on direction d. | |
|
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 232 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 (#)
v | vector to fill with the permutations |
Definition at line 293 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 100 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 151 of file HyperCube.hpp.
|
inlinestatic |
Get the number of Elements of dimension d.
d | dimensionality of the element |
Definition at line 67 of file HyperCube.hpp.
|
inlinestatic |
Get the sum of the number of elements from d to d_t (included)
d_t |
Definition at line 83 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 451 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 367 of file HyperCube.hpp.
Linearize the permutation 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 337 of file HyperCube.hpp.
|
inlinestatic |
Return the combination of the negative face on direction d.
d | direction |
Definition at line 475 of file HyperCube.hpp.
|
inlinestatic |
return the combination of the positive face on direction d
d | direction |
Definition at line 463 of file HyperCube.hpp.