mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 05:20:34 +05:00
60 lines
1.2 KiB
C++
60 lines
1.2 KiB
C++
#ifndef FILE_SPBITA2D
|
|
#define FILE_SPBITA2D
|
|
|
|
/**************************************************************************/
|
|
/* File: spbita2d.hh */
|
|
/* Author: Joachim Schoeberl */
|
|
/* Date: 01. Jun. 95 */
|
|
/**************************************************************************/
|
|
|
|
/**
|
|
Implementation of sparse 2 dimensional bitarray
|
|
*/
|
|
|
|
namespace netgen
|
|
{
|
|
|
|
class SPARSE_BIT_Array_2D
|
|
{
|
|
class linestruct { public: INDEX size; INDEX maxsize; INDEX * col; };
|
|
|
|
///
|
|
linestruct * lines;
|
|
///
|
|
INDEX height, width;
|
|
|
|
public:
|
|
|
|
///
|
|
SPARSE_BIT_Array_2D (INDEX ah = 0, INDEX aw = 0);
|
|
///
|
|
~SPARSE_BIT_Array_2D ();
|
|
|
|
///
|
|
void SetSize (INDEX ah, INDEX aw = 0);
|
|
///
|
|
void DeleteElements ();
|
|
|
|
///
|
|
int Get (INDEX i, INDEX j) const;
|
|
|
|
///
|
|
INDEX Height () const { return height; }
|
|
///
|
|
INDEX Width () const { return width; }
|
|
|
|
///
|
|
void Set (INDEX i, INDEX j);
|
|
///
|
|
int Test (INDEX i, INDEX j) const;
|
|
|
|
///
|
|
INDEX BitsInLine (INDEX i) const { return lines[i-1].size; }
|
|
///
|
|
INDEX GetIndex (INDEX i, INDEX nr) const { return lines[i-1].col[nr-1]; }
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|