ElementRegion_ED.h 3.3 KB
Newer Older
1
2
3
4
5
6
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
7
// ==  TU Dresden                                                            ==
8
// ==                                                                        ==
9
10
11
// ==  Institut fr Wissenschaftliches Rechnen                               ==
// ==  Zellescher Weg 12-14                                                  ==
// ==  01069 Dresden                                                         ==
12
13
14
15
// ==  germany                                                               ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
16
// ==  https://gforge.zih.tu-dresden.de/projects/amdis/                      ==
17
18
19
// ==                                                                        ==
// ============================================================================

20
/** \file ElementRegionED.h */
21

22
23
#ifndef AMDIS_ELEMENTREGIONED_H
#define AMDIS_ELEMENTREGIONED_H
24
25
26

#include "ElementData.h"
#include "FixVec.h"
Thomas Witkowski's avatar
Thomas Witkowski committed
27
#include "Serializer.h"
28
29
30
31
32
33

namespace AMDiS {

  class ElementRegion_ED : public ElementData
  {
  public:
34
35
36
    inline bool isOfType(int typeID) const 
    {
      if (typeID == ELEMENT_REGION) 
37
38
	return true;
      return false;
39
    }
40
41
42
43

    class Creator : public CreatorInterface<ElementData>
    {
    public:
Thomas Witkowski's avatar
Thomas Witkowski committed
44
45
      ElementData* create() 
      {
Thomas Witkowski's avatar
Thomas Witkowski committed
46
	return new ElementRegion_ED;
47
      }
48
49
50
51
    };

    ElementRegion_ED(ElementData *decorated = NULL)
      : ElementData(decorated),
52
	region(-1)
53
    {}
54
55
56
57
58
59
60
61
62
63

    bool refineElementData(Element* parent, 
			   Element* child1,
			   Element* child2,
			   int elType)
    {
      ElementData::refineElementData(parent, child1, child2, elType);

      ElementRegion_ED *ep;

Thomas Witkowski's avatar
Thomas Witkowski committed
64
      ep = new ElementRegion_ED(child1->getElementData());
65
      ep->region = region;
66
67
      child1->setElementData(ep);

Thomas Witkowski's avatar
Thomas Witkowski committed
68
      ep = new ElementRegion_ED(child2->getElementData());
69
      ep->region = region;
70
71
72
      child2->setElementData(ep);

      return false;
73
    }
74

Thomas Witkowski's avatar
Thomas Witkowski committed
75
76
    ElementData *clone() const 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
77
      ElementRegion_ED *newObj = new ElementRegion_ED;
78
79
      newObj->region = region;
      newObj->decorated = ElementData::clone();
80
      return newObj; 
81
    }
82

Thomas Witkowski's avatar
Thomas Witkowski committed
83
84
    inline std::string getTypeName() const 
    { 
85
      return "ElementRegion_ED"; 
Thomas Witkowski's avatar
Thomas Witkowski committed
86
    }
87

Thomas Witkowski's avatar
Thomas Witkowski committed
88
89
90
91
    inline const int getTypeID() const 
    { 
      return ELEMENT_REGION; 
    }
92

93
    void serialize(std::ostream& out) 
94
95
    {
      ElementData::serialize(out);
Thomas Witkowski's avatar
Thomas Witkowski committed
96
      SerUtil::serialize(out, region);
97
    }
98

99
    void deserialize(std::istream& in) 
100
101
    {
      ElementData::deserialize(in);
Thomas Witkowski's avatar
Thomas Witkowski committed
102
      SerUtil::deserialize(in, region);
103
    }
104

105
    inline void setRegion(int r) 
Thomas Witkowski's avatar
Thomas Witkowski committed
106
    { 
107
      region = r; 
Thomas Witkowski's avatar
Thomas Witkowski committed
108
    }
109

Thomas Witkowski's avatar
Thomas Witkowski committed
110
111
    inline int getRegion() const 
    { 
112
      return region; 
Thomas Witkowski's avatar
Thomas Witkowski committed
113
    }
114
115

  protected:
116
    int region;
117
118
119
120
121
  };

}

#endif