The Original CHomP Software
Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
chomp::homology::Tabulated Class Reference

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

#include <tabulate.h>

Public Member Functions

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

Static Public Member Functions

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

Private Attributes

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

Static Private Attributes

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

Detailed Description

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

Definition at line 50 of file tabulate.h.

Constructor & Destructor Documentation

◆ Tabulated()

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

The default constructor.

◆ ~Tabulated()

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

The destructor.

Member Function Documentation

◆ compute()

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

Computes tabulated configurations for a specific dimension.

◆ define()

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 100 of file tabulate.h.

101{
102 if ((dim <= 0) || (dim >= maxdim))
103 return -1;
104 if (tables [dim] && deallocate [dim])
105 {
106 delete [] (tables [dim]);
107 deallocate [dim] = false;
108 }
109 tables [dim] = buffer;
110 return 0;
111} /* Tabulated::define */
bool deallocate[maxdim]
Should the configuration tables be deallocated?
Definition: tabulate.h:91
char * tables[maxdim]
The tabulated configurations.
Definition: tabulate.h:88
static const int maxdim
The strict upper bound for the supported dimensions.
Definition: tabulate.h:85

References deallocate, maxdim, and tables.

◆ get()

int chomp::homology::Tabulated::get ( const char *  table,
int_t  bitnumber 
)
inlinestatic

Retrieve the given bit from the given table.

Definition at line 121 of file tabulate.h.

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

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

◆ operator[]()

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 113 of file tabulate.h.

114{
115 if ((dim <= 0) || (dim >= maxdim))
116 return 0;
117 else
118 return tables [dim];
119} /* Tabulated::operator [] */

References maxdim, and tables.

◆ read()

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

Reads tabulated configurations from a file.

◆ set()

void chomp::homology::Tabulated::set ( char *  table,
int_t  bitnumber 
)
inlinestatic

Sets the given bit in the given table.

Definition at line 129 of file tabulate.h.

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

◆ write()

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

Writes tabulated configurations to a file.

Member Data Documentation

◆ deallocate

bool chomp::homology::Tabulated::deallocate[maxdim]
private

Should the configuration tables be deallocated?

Definition at line 91 of file tabulate.h.

Referenced by define().

◆ maxdim

const int chomp::homology::Tabulated::maxdim = 8
staticprivate

The strict upper bound for the supported dimensions.

Definition at line 85 of file tabulate.h.

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

◆ size

int chomp::homology::Tabulated::size[maxdim]
private

The size of the table in bytes for each dimension.

Definition at line 94 of file tabulate.h.

◆ tables

char* chomp::homology::Tabulated::tables[maxdim]
private

The tabulated configurations.

Definition at line 88 of file tabulate.h.

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


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