netgen/libsrc/general/seti.hpp

51 lines
925 B
C++
Raw Normal View History

2009-01-13 04:40:13 +05:00
#ifndef FILE_SETI
#define FILE_SETI
/**************************************************************************/
/* File: seti.hh */
/* Author: Joachim Schoeberl */
/* Date: 20. Mar. 98 */
/**************************************************************************/
2009-07-20 14:36:36 +06:00
namespace netgen
{
2009-01-13 04:40:13 +05:00
/**
Set of Integers
*/
class IndexSet
{
2019-07-09 13:39:16 +05:00
NgArray<int> set;
2009-01-13 04:40:13 +05:00
BitArray flags;
public:
IndexSet (int maxind);
~IndexSet ();
/// increase range to maxind
void SetMaxIndex (int maxind);
int IsIn (int ind) const
{
return flags.Test (ind);
}
void Add (int ind)
{
if (!flags.Test(ind))
{
set.Append (ind);
flags.Set (ind);
}
}
void Del (int ind);
void Clear ();
2019-07-09 13:39:16 +05:00
const NgArray<int> & GetArray() { return set; }
2009-01-13 04:40:13 +05:00
};
2009-07-20 14:36:36 +06:00
}
2009-01-13 04:40:13 +05:00
#endif