File: seti.cpp

package info (click to toggle)
netgen 6.2.2601%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,076 kB
  • sloc: cpp: 166,627; tcl: 6,310; python: 2,868; sh: 528; makefile: 90
file content (70 lines) | stat: -rw-r--r-- 995 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include <mystdlib.h>
#include <myadt.hpp>


namespace netgen
{
  //using namespace netgen;

  IndexSet :: IndexSet (int maxind)
  {
    SetMaxIndex (maxind);
  }

  IndexSet :: ~IndexSet ()
  {
    Clear();
  }


  void IndexSet :: SetMaxIndex (int maxind)
  {
    if (maxind > flags.Size())
      {
	flags.SetSize (2 * maxind);
	flags.Clear();
      }
  }

  /*
    int IndexSet :: IsIn (int ind) const
    {
    return flags.Test (ind);
    }
  */

  /*
    void IndexSet :: Add (int ind)
    {
    if (ind > flags.Size())
    {
    cerr << "out of range" << endl;
    exit (1);
    }

    if (!flags.Test(ind))
    {
    set.Append (ind);
    flags.Set (ind);
    }
    }
  */

  void IndexSet :: Del (int ind)
  {
    for (int i = 1; i <= set.Size(); i++)
      if (set.Get(i) == ind)
	{
	  set.DeleteElement (ind);
	  break;
	}
    flags.Clear (ind);
  }

  void IndexSet :: Clear ()
  {
    for (int i = 1; i <= set.Size(); i++)
      flags.Clear (set.Get(i));
    set.SetSize (0);
  }
}