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

This class defines a simple table of bit fields with very limited functionality that is used for storing the information on the verified combinations of cubes' neighbors. More...

#include <known.h>

Public Member Functions

 BitFields ()
 The default constructor. More...
 
 ~BitFields ()
 The destructor. More...
 
void setkblimit (int limit=-1, int dim=-1)
 Sets the limit for the number of kilobytes used for BitFields. More...
 
int getkblimit (int dim=0) const
 Returns the current limit for the given dimension. More...
 
SetOfBitFieldsoperator[] (int dim)
 Returns the corresponding bit field set and allocates it if not used so far. More...
 
void forget (int dim=-1)
 Forgets the given bit field set or all the sets. More...
 

Private Member Functions

void extend (int n)
 Extends the table to the given length if necessary. More...
 
void allocate (int dim)
 Allocates the specific bit field set. More...
 

Private Attributes

SetOfBitFields ** tab
 The table of bit field sets for each dimension. More...
 
int len
 The length of the currently allocated table. More...
 
int * maxkb
 The memory limit for each table (in kilobytes), -1 for none. More...
 

Detailed Description

This class defines a simple table of bit fields with very limited functionality that is used for storing the information on the verified combinations of cubes' neighbors.

Definition at line 53 of file known.h.

Constructor & Destructor Documentation

◆ BitFields()

chomp::homology::BitFields::BitFields ( )
inline

The default constructor.

Definition at line 98 of file known.h.

99{
100 tab = NULL;
101 len = 0;
102 maxkb = NULL;
103 return;
104} /* BitFields::BitFields */
int * maxkb
The memory limit for each table (in kilobytes), -1 for none.
Definition: known.h:86
int len
The length of the currently allocated table.
Definition: known.h:83
SetOfBitFields ** tab
The table of bit field sets for each dimension.
Definition: known.h:80

References len, maxkb, and tab.

◆ ~BitFields()

chomp::homology::BitFields::~BitFields ( )

The destructor.

Member Function Documentation

◆ allocate()

void chomp::homology::BitFields::allocate ( int  dim)
private

Allocates the specific bit field set.

Referenced by operator[]().

◆ extend()

void chomp::homology::BitFields::extend ( int  n)
private

Extends the table to the given length if necessary.

Referenced by operator[]().

◆ forget()

void chomp::homology::BitFields::forget ( int  dim = -1)

Forgets the given bit field set or all the sets.

◆ getkblimit()

int chomp::homology::BitFields::getkblimit ( int  dim = 0) const

Returns the current limit for the given dimension.

◆ operator[]()

SetOfBitFields * chomp::homology::BitFields::operator[] ( int  dim)
inline

Returns the corresponding bit field set and allocates it if not used so far.

If no bit field set is in use, returns 0.

Definition at line 106 of file known.h.

107{
108 // make sure the dimension is positive
109 if (dim <= 0)
110 throw "Trying to get a bit field set of non-positive dim.";
111
112 // extend the tables if necessary
113 if (dim >= len)
114 extend (dim + 1);
115
116 // allocate the bit field set if necessary
117 if (!tab [dim] && maxkb [dim])
118 allocate (dim);
119
120 // return the pointer to the requested bit field set
121 return tab [dim];
122} /* BitFields::operator [] */
void allocate(int dim)
Allocates the specific bit field set.
void extend(int n)
Extends the table to the given length if necessary.

References allocate(), extend(), len, maxkb, and tab.

◆ setkblimit()

void chomp::homology::BitFields::setkblimit ( int  limit = -1,
int  dim = -1 
)

Sets the limit for the number of kilobytes used for BitFields.

The limit applied to dimension < 0 is copied to all the others and can be retrieved as the limit for dimension 0. The limit for dim. 0 is the default if not defined otherwise.

Member Data Documentation

◆ len

int chomp::homology::BitFields::len
private

The length of the currently allocated table.

Definition at line 83 of file known.h.

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

◆ maxkb

int* chomp::homology::BitFields::maxkb
private

The memory limit for each table (in kilobytes), -1 for none.

Definition at line 86 of file known.h.

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

◆ tab

SetOfBitFields** chomp::homology::BitFields::tab
private

The table of bit field sets for each dimension.

Definition at line 80 of file known.h.

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


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