Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/ElmerGUI/netgen/libsrc/general/spbita2d.hpp
3206 views
1
#ifndef FILE_SPBITA2D
2
#define FILE_SPBITA2D
3
4
/**************************************************************************/
5
/* File: spbita2d.hh */
6
/* Author: Joachim Schoeberl */
7
/* Date: 01. Jun. 95 */
8
/**************************************************************************/
9
10
/**
11
Implementation of sparse 2 dimensional bitarray
12
*/
13
14
15
class SPARSE_BIT_ARRAY_2D
16
{
17
class linestruct { public: INDEX size; INDEX maxsize; INDEX * col; };
18
19
///
20
linestruct * lines;
21
///
22
INDEX height, width;
23
24
public:
25
26
///
27
SPARSE_BIT_ARRAY_2D (INDEX ah = 0, INDEX aw = 0);
28
///
29
~SPARSE_BIT_ARRAY_2D ();
30
31
///
32
void SetSize (INDEX ah, INDEX aw = 0);
33
///
34
void DeleteElements ();
35
36
///
37
int Get (INDEX i, INDEX j) const;
38
39
///
40
INDEX Height () const { return height; }
41
///
42
INDEX Width () const { return width; }
43
44
///
45
void Set (INDEX i, INDEX j);
46
///
47
int Test (INDEX i, INDEX j) const;
48
49
///
50
INDEX BitsInLine (INDEX i) const { return lines[i-1].size; }
51
///
52
INDEX GetIndex (INDEX i, INDEX nr) const { return lines[i-1].col[nr-1]; }
53
};
54
55
56
#endif
57
58