Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/ElmerGUI/netgen/libsrc/general/seti.cpp
3206 views
1
#include <mystdlib.h>
2
#include <myadt.hpp>
3
4
5
namespace netgen
6
{
7
//using namespace netgen;
8
9
IndexSet :: IndexSet (int maxind)
10
{
11
SetMaxIndex (maxind);
12
}
13
14
IndexSet :: ~IndexSet ()
15
{
16
Clear();
17
}
18
19
20
void IndexSet :: SetMaxIndex (int maxind)
21
{
22
if (maxind > flags.Size())
23
{
24
flags.SetSize (2 * maxind);
25
flags.Clear();
26
}
27
}
28
29
/*
30
int IndexSet :: IsIn (int ind) const
31
{
32
return flags.Test (ind);
33
}
34
*/
35
36
/*
37
void IndexSet :: Add (int ind)
38
{
39
if (ind > flags.Size())
40
{
41
cerr << "out of range" << endl;
42
exit (1);
43
}
44
45
if (!flags.Test(ind))
46
{
47
set.Append (ind);
48
flags.Set (ind);
49
}
50
}
51
*/
52
53
void IndexSet :: Del (int ind)
54
{
55
for (int i = 1; i <= set.Size(); i++)
56
if (set.Get(i) == ind)
57
{
58
set.DeleteElement (ind);
59
break;
60
}
61
flags.Clear (ind);
62
}
63
64
void IndexSet :: Clear ()
65
{
66
for (int i = 1; i <= set.Size(); i++)
67
flags.Clear (set.Get(i));
68
set.SetSize (0);
69
}
70
}
71
72