The Original CHomP Software
chomp
homology
known.h
Go to the documentation of this file.
1
3
15
16
// Copyright (C) 1997-2020 by Pawel Pilarczyk.
17
//
18
// This file is part of my research software package. This is free software:
19
// you can redistribute it and/or modify it under the terms of the GNU
20
// General Public License as published by the Free Software Foundation,
21
// either version 3 of the License, or (at your option) any later version.
22
//
23
// This software is distributed in the hope that it will be useful,
24
// but WITHOUT ANY WARRANTY; without even the implied warranty of
25
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26
// GNU General Public License for more details.
27
//
28
// You should have received a copy of the GNU General Public License
29
// along with this software; see the file "license.txt". If not,
30
// please, see <https://www.gnu.org/licenses/>.
31
32
// Started in January 2002. Last revision: June 2, 2007.
33
34
35
#ifndef _CHOMP_HOMOLOGY_KNOWN_H_
36
#define _CHOMP_HOMOLOGY_KNOWN_H_
37
38
#include "
chomp/system/config.h
"
39
#include "
chomp/system/textfile.h
"
40
#include "
chomp/struct/bitfield.h
"
41
42
namespace
chomp
{
43
namespace
homology {
44
45
46
// --------------------------------------------------
47
// ------------------- BitFields --------------------
48
// --------------------------------------------------
49
53
class
BitFields
54
{
55
public
:
57
BitFields
();
58
60
~BitFields
();
61
66
void
setkblimit
(
int
limit = -1,
int
dim = -1);
67
69
int
getkblimit
(
int
dim = 0)
const
;
70
73
SetOfBitFields
*
operator []
(
int
dim);
74
76
void
forget
(
int
dim = -1);
77
78
private
:
80
SetOfBitFields
**
tab
;
81
83
int
len
;
84
86
int
*
maxkb
;
87
89
void
extend
(
int
n);
90
92
void
allocate
(
int
dim);
93
94
};
/* class BitFields */
95
96
// --------------------------------------------------
97
98
inline
BitFields::BitFields
()
99
{
100
tab
= NULL;
101
len
= 0;
102
maxkb
= NULL;
103
return
;
104
}
/* BitFields::BitFields */
105
106
inline
SetOfBitFields
*
BitFields::operator []
(
int
dim)
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 [] */
123
124
// --------------------------------------------------
125
128
extern
BitFields
knownbits
;
129
130
131
}
// namespace homology
132
}
// namespace chomp
133
134
#endif
// _CHOMP_HOMOLOGY_KNOWN_H_
135
137
bitfield.h
This file contains the definition of a bitfield class which works an array of bits.
chomp::homology::BitFields
This class defines a simple table of bit fields with very limited functionality that is used for stor...
Definition:
known.h:54
chomp::homology::BitFields::~BitFields
~BitFields()
The destructor.
chomp::homology::BitFields::maxkb
int * maxkb
The memory limit for each table (in kilobytes), -1 for none.
Definition:
known.h:86
chomp::homology::BitFields::allocate
void allocate(int dim)
Allocates the specific bit field set.
chomp::homology::BitFields::getkblimit
int getkblimit(int dim=0) const
Returns the current limit for the given dimension.
chomp::homology::BitFields::len
int len
The length of the currently allocated table.
Definition:
known.h:83
chomp::homology::BitFields::operator[]
SetOfBitFields * operator[](int dim)
Returns the corresponding bit field set and allocates it if not used so far.
Definition:
known.h:106
chomp::homology::BitFields::BitFields
BitFields()
The default constructor.
Definition:
known.h:98
chomp::homology::BitFields::setkblimit
void setkblimit(int limit=-1, int dim=-1)
Sets the limit for the number of kilobytes used for BitFields.
chomp::homology::BitFields::forget
void forget(int dim=-1)
Forgets the given bit field set or all the sets.
chomp::homology::BitFields::tab
SetOfBitFields ** tab
The table of bit field sets for each dimension.
Definition:
known.h:80
chomp::homology::BitFields::extend
void extend(int n)
Extends the table to the given length if necessary.
chomp::homology::SetOfBitFields
This class defines a set of bit fields of the same length which are to be stored in a contiguous piec...
Definition:
bitfield.h:245
config.h
This file contains some precompiler definitions which indicate the operating system and/or compiler u...
chomp::homology::knownbits
BitFields knownbits
The global table of BitFields which store the acyclicity information for reducing full cubical sets.
chomp
This namespace contains the entire CHomP library interface.
Definition:
bitmaps.h:51
textfile.h
This file contains some useful functions related to the text input/output procedures.
Generated by
1.9.4