Skip to content
Snippets Groups Projects
ElementRegion_ED.h 3.27 KiB
Newer Older
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  crystal growth group                                                  ==
// ==                                                                        ==
// ==  Stiftung caesar                                                       ==
// ==  Ludwig-Erhard-Allee 2                                                 ==
// ==  53175 Bonn                                                            ==
// ==  germany                                                               ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  http://www.caesar.de/cg/AMDiS                                         ==
// ==                                                                        ==
// ============================================================================

/** \file ElementRegion_ED.h */

#ifndef AMDIS_ELEMENTREGION_ED_H
#define AMDIS_ELEMENTREGION_ED_H

#include "ElementData.h"
#include "FixVec.h"

namespace AMDiS {

  class ElementRegion_ED : public ElementData
  {
  public:
    inline bool isOfType(int typeID) const 
    {
      if (typeID == ELEMENT_REGION) 
	return true;
      return false;

    class Creator : public CreatorInterface<ElementData>
    {
    public:
      ElementData* create() {
	return NEW ElementRegion_ED;
    };

    ElementRegion_ED(ElementData *decorated = NULL)
      : ElementData(decorated),
	region_(-1)

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

      ElementRegion_ED *ep;

      ep = NEW ElementRegion_ED(child1->getElementData());
      ep->region_ = region_;
      child1->setElementData(ep);

      ep = NEW ElementRegion_ED(child2->getElementData());
      ep->region_ = region_;
      child2->setElementData(ep);

      return false;

    ElementData *clone() const { 
      ElementRegion_ED *newObj = NEW ElementRegion_ED;
      newObj->region_ = region_;
      newObj->decorated_ = ElementData::clone();
      return newObj; 
    inline std::string getTypeName() const { return "ElementRegion_ED"; }
    inline const int getTypeID() const { return ELEMENT_REGION; }
    void serialize(std::ostream& out) 
    {
      ElementData::serialize(out);
      out.write(reinterpret_cast<const char*>(&region_), sizeof(int));
    void deserialize(std::istream& in) 
    {
      ElementData::deserialize(in);
      in.read(reinterpret_cast<char*>(&region_), sizeof(int));
    inline void setRegion(int region) { region_ = region; }
    inline int getRegion() const { return region_; }