VertexVector.h 1.12 KB
Newer Older
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
#ifndef AMDIS_VERTEXVECTOR_H
#define AMDIS_VERTEXVECTOR_H

#include "DOFVector.h"

namespace AMDiS {

  class VertexVector : public DOFVectorDOF
  {
  public:
    MEMORY_MANAGED(VertexVector);

    class Iterator : public DOFIterator<DegreeOfFreedom> {
    public:
      Iterator(VertexVector *c, DOFIteratorType type)
	: DOFIterator<DegreeOfFreedom>(const_cast<DOFAdmin*>(c->getAdmin()), 
				       dynamic_cast<DOFIndexed<DegreeOfFreedom>*>(c), 
				       type)
      {};   
    };

    VertexVector(const DOFAdmin *admin_, ::std::string name_);

    ~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;
      }
    };

    void set(DegreeOfFreedom val);

    void compressDOFContainer(int size, ::std::vector<DegreeOfFreedom> &newDOF) {
      DOFContainer::compressDOFContainer(size, newDOF);
      int totalSize = getAdmin()->getSize();
      for(int i = size; i < totalSize; i++) {
	vec[i] = i;
      }
    };

  protected:
    const DOFAdmin *admin;
  };

}

#endif