VertexVector.h 1.17 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#ifndef AMDIS_VERTEXVECTOR_H
#define AMDIS_VERTEXVECTOR_H

#include "DOFVector.h"

namespace AMDiS {

  class VertexVector : public DOFVectorDOF
  {
  public:
    class Iterator : public DOFIterator<DegreeOfFreedom> {
    public:
      Iterator(VertexVector *c, DOFIteratorType type)
	: DOFIterator<DegreeOfFreedom>(const_cast<DOFAdmin*>(c->getAdmin()), 
				       dynamic_cast<DOFIndexed<DegreeOfFreedom>*>(c), 
				       type)
Thomas Witkowski's avatar
Thomas Witkowski committed
17
      {}   
18
19
    };

20
    VertexVector(const DOFAdmin *admin, std::string name);
21
22
23

    ~VertexVector();

Thomas Witkowski's avatar
Thomas Witkowski committed
24
25
26
27
    const DOFAdmin *getAdmin() 
    { 
      return admin; 
    }
28

Thomas Witkowski's avatar
Thomas Witkowski committed
29
30
31
    void resize(int size) 
    {
      int oldSize = static_cast<int>(vec.size());
32
      vec.resize(size);
Thomas Witkowski's avatar
Thomas Witkowski committed
33
      for (int i = oldSize; i < size; i++)
34
	vec[i] = i;
Thomas Witkowski's avatar
Thomas Witkowski committed
35
    }
36
37
38

    void set(DegreeOfFreedom val);

39
    void compressDofContainer(int size, std::vector<DegreeOfFreedom> &newDOF) 
Thomas Witkowski's avatar
Thomas Witkowski committed
40
    {
41
      DOFContainer::compressDofContainer(size, newDOF);
42
      int totalSize = getAdmin()->getSize();
43
      for (int i = size; i < totalSize; i++)
44
	vec[i] = i;
Thomas Witkowski's avatar
Thomas Witkowski committed
45
    }
46

47
48
49
50
    void changeDofIndices(std::map<int, int>& dofIndexMap);

    void print();

51
52
53
54
55
56
57
  protected:
    const DOFAdmin *admin;
  };

}

#endif