OpenFPM_data  0.1.0
Project that contain the implementation and interfaces for basic structure like vectors, grids, graph ... .
 All Data Structures Namespaces Functions Variables Typedefs Friends
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
dimof 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...
 
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.
 

Constructor & Destructor Documentation

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

Constructor from a list of numbers.

Parameters
clist of numbers

Definition at line 305 of file comb.hpp.

Member Function Documentation

template<unsigned int dim>
comb<dim> 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 148 of file comb.hpp.

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 248 of file comb.hpp.

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 259 of file comb.hpp.

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 325 of file comb.hpp.

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

Check if the combination is a sub-element.

Parameters
cmbcombination 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.

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.

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

Linearization.

From the combination produce a number

Returns
the number

Definition at line 364 of file comb.hpp.

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

Set all the elements to -1.

Definition at line 95 of file comb.hpp.

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

Compare two combination.

check if they match

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

Definition at line 202 of file comb.hpp.

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

Bitwise operator &.

Returns
Result combination

Definition at line 108 of file comb.hpp.

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

sum the combinations and return the result

Returns
Result combination

Definition at line 182 of file comb.hpp.

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

Subtract the combinations and return the result.

Returns
Result combination

Definition at line 125 of file comb.hpp.

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

Subtract the combinations and return the result.

Returns
Result combination

Definition at line 165 of file comb.hpp.

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

Compare two combination.

check if they match

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

Definition at line 225 of file comb.hpp.

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

Get the i combination coefficient.

Parameters
icoefficent
Returns
the coefficent of the combination at position i

Definition at line 237 of file comb.hpp.

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 341 of file comb.hpp.

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
iindex
Returns
value of the i index

Definition at line 273 of file comb.hpp.

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: