4 #include "Grid/comb.hpp"
5 #include "Grid/grid_key_expression.hpp"
6 #include "Space/Shape/Point.hpp"
17 template<
unsigned int dim>
29 for (
size_t i = 0 ; i < dim ; i++)
30 this->
k[i] = exp.value(i);
71 for (
size_t i = 0 ; i < dim ; i++)
82 for (
size_t i = 0 ; i < dim ; i++)
93 for (
size_t i = 0 ; i < dim ; i++)
103 template<
typename ...T>
inline grid_key_dx(
const size_t v,
const T...t)
106 if (
sizeof...(t) != dim -1)
107 {std::cerr <<
"Error grid_key: " << __FILE__ <<
" " << __LINE__ <<
" creating a key of dimension " << dim <<
" require " << dim <<
" numbers " <<
sizeof...(t) + 1 <<
" provided" <<
"\n";}
118 for (
size_t i = 0 ; i < dim ; i++)
127 for (
size_t i = 0 ; i < dim ; i++)
136 for (
size_t i = 0 ; i < dim ; i++)
147 for (
size_t i = 0 ; i < dim ; i++)
165 for (
size_t i = 0 ; i < dim ; i++)
180 for (
size_t i = 0 ; i < dim ; i++)
272 for (
size_t i = 0 ; i < dim ; i++)
274 if (
k[i] != key_t.
k[i])
304 template<
typename a,
typename ...T>
305 inline void set(a v, T...t)
308 if (
sizeof...(t) != dim -1)
309 std::cerr <<
"Error grid_key: " << __FILE__ <<
" " << __LINE__ <<
"setting a key of dimension " << dim <<
" require " << dim <<
" numbers " <<
sizeof...(t) + 1 <<
" provided" << std::endl;
320 const long int(&
get_k()
const)[dim]
336 for (
size_t i = 0; i < dim ; i++)
365 for (
size_t i = 0; i < dim ; i++)
394 inline mem_id
get(
size_t i)
const
407 inline void set_d(
size_t i, mem_id
id)
412 std::cerr <<
"grid_key_dx error: " << __FILE__ <<
" " << __LINE__ <<
" try to access dimension " << i <<
" on a grid_key_dx of size " << dim <<
"\n";
464 template<
unsigned int dim,
unsigned int p>
470 template<
typename a,
typename ...T>
grid_key_d(a v,T...t)
476 template<
typename a,
typename ...T>
void invert_assign(a v,T...t)
482 template<
typename a,
typename ...T>
void invert_assign(a v)
Main class that encapsulate a sub expression.
bool operator==(const grid_key_dx< dim_t > &key_t) const
Check if two key are the same.
mem_id value(size_t i) const
Get the i index.
grid_key_dx(const size_t(&k)[dim])
Constructor from buffer reference.
grid_key_dx(const grid_key_dx< dim > &key)
Constructor from an other key.
grid_key_dx(const size_t v, const T...t)
Construct a grid key from a list of numbers.
grid_key_dx is the key to access any element in the grid
Position of the element of dimension d in the hyper-cube of dimension dim.
std::string toString() const
Return the string with the point coordinate.
grid_key_dx_sub< dim, grid_key_dx< dim >, grid_key_dx< dim > > operator-(const grid_key_dx< dim > &cmb) const
sum an a combination to the grid_key
void invalid()
Set to invalid the key.
grid_key_dx(const long int(&k)[dim])
Constructor from buffer reference.
grid_key_dx_sum< dim, grid_key_dx< dim >, Point< dim, long int > > operator+(const Point< dim, long int > &p) const
sum a point to the grid_key
grid_key_dx(std::initializer_list< long int > p1)
Constructor from initializer list.
std::string to_string()
convert the information into a string
Point< dim, size_t > toPoint() const
Convert to a point the grid_key_dx.
grid_key_dx()
Constructor.
void invert_assign(a v)
assignment
const long int(& get_k() const)[dim]
Return the internal k structure.
grid_key_dx(const grid_key_dx_expression< dim, exp1 > &exp)
Constructor from expression.
grid_key_dx_sum< dim, grid_key_dx< dim >, comb< dim > > operator+(const comb< dim > &cmb) const
sum an a combination to the grid_key
Point< dim, long int > toPointS() const
Convert to a point the grid_key_dx.
Expression template for grid_key_dx.
grid_key_dx< dim > & operator-=(const grid_key_dx< dim > &p)
sum a grid_key
void zero()
Set to zero the key.
grid_key_dx(const comb< dim > &cmb)
Construct a grid key from a list of numbers.
const T & get(size_t i) const
Get coordinate.
grid_key_dx< dim > & operator+=(const grid_key_dx< dim > &p)
sum a grid_key
grid_key_dx_sum< dim, grid_key_dx< dim >, grid_key_dx< dim > > operator+(const grid_key_dx< dim > &p) const
sum a grid_key to the grid_key
bool operator!=(const grid_key_dx< dim_t > &key_t)
Check if two key are the same.
This class is a trick to indicate the compiler a specific specialization pattern. ...
void invert_assign(a v, T...t)
Recursively invert the assignment.
void set(a v, T...t)
set the Key from a list of numbers
bool isValid()
Check if the key is invalid (all components set to -1)
grid_key_d is the key to access any element in the grid
void invert_assign()
Constructor.
void set_d(size_t i, mem_id id)
Set the i index.
grid_key_dx_sub< dim, grid_key_dx< dim >, grid_key_dx_expression< dim, T > > operator-(const grid_key_dx_expression< dim, T > &cmb) const
sum this key to another grid expression
Main class that encapsulate a sum expression.
void one()
Set to one the key.
mem_id k[dim]
structure that store all the index