VertexVector.h 1.08 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 24 25 26 27 28 29 30 31

    ~VertexVector();

    const DOFAdmin *getAdmin() { return admin; };

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

    void set(DegreeOfFreedom val);

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

  protected:
    const DOFAdmin *admin;
  };

}

#endif