OpenFPM_pdata  4.1.0 Project that contain the implementation of distributed structures
comb< dim > Struct Template Reference

Position of the element of dimension d in the hyper-cube of dimension dim. More...

Detailed Description

template<unsigned int dim> struct comb< dim >

Position of the element of dimension d in the hyper-cube of dimension dim.

These objects are returned by the Hyper-cube static functions The number of non-zero d define the dimensionality of the object ( +1 or -1 its position in the hypercube)

Example

                         (0,1)
(-1,1)  +---------+ (1,1)
|         |
|         |
(-1,0)|  (0,0)  | (1,0)
|         |
|         |
(-1,-1) +---------+ (1,-1)
(0,-1)

Template Parameters
 dim of the hyper-cube

Definition at line 34 of file comb.hpp.

#include <comb.hpp>

Public Member Functions

bool isValid ()
check if it is a valid combination More...

bool isSub (comb< dim > cmb)
Check if the combination is a sub-element. More...

void zero ()
Set all the elements to zero. More...

void mone ()
Set all the elements to -1. More...

comb< dim > operator & (char c_)
Bitwise operator &. More...

void sign_flip ()
Flip the sign of the combination. More...

comb< dim > operator- (const comb< dim > &t)
Subtract the combinations and return the result. More...

comb< dim > flip ()
flip the coefficent of the combination to be < 0 More...

comb< dim > operator- ()
Subtract the combinations and return the result. More...

comb< dim > operator+ (const comb< dim > &t)
sum the combinations and return the result More...

bool operator!= (const comb< dim > &t) const
Compare two combination. More...

bool operator== (const comb< dim > &t) const
Compare two combination. More...

char operator[] (int i) const
Get the i combination coefficient. More...

char * getComb ()
get the combination array pointer More...

const char * getComb () const
get the combination array pointer More...

char value (int i) const
get the index i of the combination More...

int n_zero () const

comb ()
Default constructor.

comb (std::initializer_list< char > c)
Constructor from a list of numbers. More...

bool isNegative ()
Check if any alement in the combination is <= 0. More...

std::string to_string () const
Convert a combination into string. More...

size_t lin () const
Linearization. More...

Data Fields

char c [dim]
Array that store the combination.

◆ comb()

template<unsigned int dim>
 comb< dim >::comb ( std::initializer_list< char > c )
inline

Constructor from a list of numbers.

Parameters
 c list of numbers

Definition at line 317 of file comb.hpp.

◆ flip()

template<unsigned int dim>
 comb comb< dim >::flip ( )
inline

flip the coefficent of the combination to be < 0

• 0 --> 0
• 1 --> -1
• 2 --> -2
• -1 --> -1
Returns
flipped combination

Definition at line 160 of file comb.hpp.

◆ getComb() [1/2]

template<unsigned int dim>
 char* comb< dim >::getComb ( )
inline

get the combination array pointer

Returns
an array of char representing the combination

Definition at line 260 of file comb.hpp.

◆ getComb() [2/2]

template<unsigned int dim>
 const char* comb< dim >::getComb ( ) const
inline

get the combination array pointer

Returns
an array of char representing the combination

Definition at line 271 of file comb.hpp.

◆ isNegative()

template<unsigned int dim>
 bool comb< dim >::isNegative ( )
inline

Check if any alement in the combination is <= 0.

+-—#-—+ | | | |

*

| | | | +-—#-—+

Is negative return true when the combination indicate * the down-left vertex + and down and left edge #

Definition at line 337 of file comb.hpp.

◆ isSub()

template<unsigned int dim>
 bool comb< dim >::isSub ( comb< dim > cmb )
inline

Check if the combination is a sub-element.

Parameters
 cmb combination to check if it is sub-element
Returns
true if cmb is a sub-element of this combination

Definition at line 66 of file comb.hpp.

◆ isValid()

template<unsigned int dim>
 bool comb< dim >::isValid ( )
inline

check if it is a valid combination

Returns
true if it is valid

Definition at line 45 of file comb.hpp.

◆ lin()

template<unsigned int dim>
 size_t comb< dim >::lin ( ) const
inline

Linearization.

From the combination produce a number

Returns
the number

Definition at line 376 of file comb.hpp.

◆ mone()

template<unsigned int dim>
 void comb< dim >::mone ( )
inline

Set all the elements to -1.

Definition at line 95 of file comb.hpp.

◆ operator &()

template<unsigned int dim>
 comb comb< dim >::operator & ( char c_ )
inline

Bitwise operator &.

Returns
Result combination

Definition at line 108 of file comb.hpp.

◆ operator!=()

template<unsigned int dim>
 bool comb< dim >::operator!= ( const comb< dim > & t ) const
inline

Compare two combination.

check if they match

Parameters
 t combination to check
Returns
true if the two combination match, false otherwise

Definition at line 214 of file comb.hpp.

◆ operator+()

template<unsigned int dim>
 comb comb< dim >::operator+ ( const comb< dim > & t )
inline

sum the combinations and return the result

Returns
Result combination

Definition at line 194 of file comb.hpp.

◆ operator-() [1/2]

template<unsigned int dim>
 comb comb< dim >::operator- ( const comb< dim > & t )
inline

Subtract the combinations and return the result.

Returns
Result combination

Definition at line 137 of file comb.hpp.

◆ operator-() [2/2]

template<unsigned int dim>
 comb comb< dim >::operator- ( )
inline

Subtract the combinations and return the result.

Returns
Result combination

Definition at line 177 of file comb.hpp.

◆ operator==()

template<unsigned int dim>
 bool comb< dim >::operator== ( const comb< dim > & t ) const
inline

Compare two combination.

check if they match

Parameters
 t combination to check
Returns
true if the two combination match, false otherwise

Definition at line 237 of file comb.hpp.

◆ operator[]()

template<unsigned int dim>
 char comb< dim >::operator[] ( int i ) const
inline

Get the i combination coefficient.

Parameters
 i coefficent
Returns
the coefficent of the combination at position i

Definition at line 249 of file comb.hpp.

◆ sign_flip()

template<unsigned int dim>
 void comb< dim >::sign_flip ( )
inline

Flip the sign of the combination.

Definition at line 124 of file comb.hpp.

◆ to_string()

template<unsigned int dim>
 std::string comb< dim >::to_string ( ) const
inline

Convert a combination into string.

Returns
a string reppresentation of the combination

Definition at line 353 of file comb.hpp.

◆ value()

template<unsigned int dim>
 char comb< dim >::value ( int i ) const
inline

get the index i of the combination

NOTE: used on expression template

Parameters
 i index
Returns
value of the i index

Definition at line 285 of file comb.hpp.

◆ zero()

template<unsigned int dim>
 void comb< dim >::zero ( )
inline

Set all the elements to zero.

Definition at line 83 of file comb.hpp.

The documentation for this struct was generated from the following file: