DOFContainer.h 2.03 KB
Newer Older
1
2
3
4
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
5
// ==  http://www.amdis-fem.org                                              ==
6
7
// ==                                                                        ==
// ============================================================================
8
9
10
11
12
13
14
15
16
17
18
19
//
// Software License for AMDiS
//
// Copyright (c) 2010 Dresden University of Technology 
// All rights reserved.
// Authors: Simon Vey, Thomas Witkowski et al.
//
// This file is part of AMDiS
//
// See also license.opensource.txt in the distribution.


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

/** \file DOFContainer.h */

#ifndef AMDIS_DOFCONTAINER_H
#define AMDIS_DOFCONTAINER_H

#include "Global.h"

namespace AMDiS {

  /** \ingroup DOFAdministration
   * \brief
   * DOFContainer is the base class for objects that stores DOF indices.
   * After a DOFContainer object is registered to a DOFAdmin, the DOF
   * indices of the container will be managed during DOF compression. The
   * DOFAdmin then calls the compress method of every registered DOFContainer.
   */
  class DOFContainer
  {
  public:
40
    virtual ~DOFContainer() {}
41
42
43
44
45
46
47

    /** \brief
     * Returns the DOF index at position i. Must be overriden by a concrete
     * DOFContainer.
     */
    virtual DegreeOfFreedom& operator[](int i) = 0;

48
    virtual void freeDofIndex(DegreeOfFreedom dof) {}
49
50
51
52
53

    /** \brief
     * Used by DOFAdmin to actualize the DOF indices in this container after
     * DOF compression.
     */
54
    virtual void compressDofContainer(int size, std::vector<DegreeOfFreedom> &newDOF)
55
    {
56
      FUNCNAME_DBG("DOFContainer::compressDofContainer()");
57

58
59
      for (int i = 0; i < size; i++) {
	int j = newDOF[operator[](i)];
60
61
62
63
64

	TEST_EXIT_DBG(j >= 0)
	  ("Invalid DOF %d in DOF container! (%d %d)\n", j, i, operator[](i));

	operator[](i) = j;
65
      }
66
    }
67

68
69
70
71
  };
}

#endif