ElementRegion_ED.h 2.69 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
/** \file ElementRegionED.h */
22

23
24
#ifndef AMDIS_ELEMENTREGIONED_H
#define AMDIS_ELEMENTREGIONED_H
25
26
27

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

namespace AMDiS {

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

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

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

    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
65
      ep = new ElementRegion_ED(child1->getElementData());
66
      ep->region = region;
67
68
      child1->setElementData(ep);

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

      return false;
74
    }
75

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

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

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

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

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

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

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

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

}

#endif