Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes

chomp::homology::Tabulated Class Reference

A class for storing tabulated configurations of neighbors for various dimensions. More...

#include <tabulate.h>

List of all members.

Public Member Functions

 Tabulated ()
 The default constructor.
 ~Tabulated ()
 The destructor.
int read (int dim, const char *filename)
 Reads tabulated configurations from a file.
int write (int dim, const char *filename) const
 Writes tabulated configurations to a file.
int compute (int dim)
 Computes tabulated configurations for a specific dimension.
int define (int dim, char *buffer)
 Sets tabulated configuration bits to a given table.
const char * operator[] (int dim) const
 Retrieves the buffer allocated for the specific dimension or returns the null pointer if none.

Static Public Member Functions

static int get (const char *table, int_t bitnumber)
 Retrieve the given bit from the given table.
static void set (char *table, int_t bitnumber)
 Sets the given bit in the given table.

Private Attributes

char * tables [maxdim]
 The tabulated configurations.
bool deallocate [maxdim]
 Should the configuration tables be deallocated?
int size [maxdim]
 The size of the table in bytes for each dimension.

Static Private Attributes

static const int maxdim = 8
 The strict upper bound for the supported dimensions.

Detailed Description

A class for storing tabulated configurations of neighbors for various dimensions.

Definition at line 51 of file tabulate.h.


Constructor & Destructor Documentation

chomp::homology::Tabulated::Tabulated (  ) 

The default constructor.

chomp::homology::Tabulated::~Tabulated (  ) 

The destructor.


Member Function Documentation

int chomp::homology::Tabulated::compute ( int  dim  ) 

Computes tabulated configurations for a specific dimension.

int chomp::homology::Tabulated::define ( int  dim,
char *  buffer 
) [inline]

Sets tabulated configuration bits to a given table.

Note: This buffer will not be deallocated automatically. Call this function with the null pointer to disable the table.

Definition at line 101 of file tabulate.h.

References deallocate, maxdim, and tables.

{
        if ((dim <= 0) || (dim >= maxdim))
                return -1;
        if (tables [dim] && deallocate [dim])
        {
                delete [] (tables [dim]);
                deallocate [dim] = false;
        }
        tables [dim] = buffer;
        return 0;
} /* Tabulated::define */

int chomp::homology::Tabulated::get ( const char *  table,
int_t  bitnumber 
) [inline, static]

Retrieve the given bit from the given table.

Definition at line 122 of file tabulate.h.

Referenced by chomp::homology::acyclic().

{
        if (table [bitnumber >> 3] & (1 << (bitnumber & 0x07)))
                return 1;
        else
                return 0;
} /* Tabulated::get */

const char * chomp::homology::Tabulated::operator[] ( int  dim  )  const [inline]

Retrieves the buffer allocated for the specific dimension or returns the null pointer if none.

Definition at line 114 of file tabulate.h.

References maxdim, and tables.

{
        if ((dim <= 0) || (dim >= maxdim))
                return 0;
        else
                return tables [dim];
} /* Tabulated::operator [] */

int chomp::homology::Tabulated::read ( int  dim,
const char *  filename 
)

Reads tabulated configurations from a file.

void chomp::homology::Tabulated::set ( char *  table,
int_t  bitnumber 
) [inline, static]

Sets the given bit in the given table.

Definition at line 130 of file tabulate.h.

{
        table [bitnumber >> 3] |=
                static_cast<char> (1 << (bitnumber & 0x07));
        return;
} /* Tabulated::set */

int chomp::homology::Tabulated::write ( int  dim,
const char *  filename 
) const

Writes tabulated configurations to a file.


Member Data Documentation

Should the configuration tables be deallocated?

Definition at line 92 of file tabulate.h.

Referenced by define().

const int chomp::homology::Tabulated::maxdim = 8 [static, private]

The strict upper bound for the supported dimensions.

Definition at line 86 of file tabulate.h.

Referenced by define(), and operator[]().

The size of the table in bytes for each dimension.

Definition at line 95 of file tabulate.h.

The tabulated configurations.

Definition at line 89 of file tabulate.h.

Referenced by define(), and operator[]().


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