Skip to content
Snippets Groups Projects
ElementRegion_ED.h 2.69 KiB
Newer Older
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ==                                                                        ==
// ============================================================================
//
// 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.


/** \file ElementRegionED.h */
#ifndef AMDIS_ELEMENTREGIONED_H
#define AMDIS_ELEMENTREGIONED_H

#include "ElementData.h"
#include "FixVec.h"
Thomas Witkowski's avatar
Thomas Witkowski committed
#include "Serializer.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:
Thomas Witkowski's avatar
Thomas Witkowski committed
      ElementData* create() 
      {
Thomas Witkowski's avatar
Thomas Witkowski committed
	return new ElementRegion_ED;
    };

    ElementRegion_ED(ElementData *decorated = NULL)
      : ElementData(decorated),

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

Thomas Witkowski's avatar
Thomas Witkowski committed
      ep = new ElementRegion_ED(child2->getElementData());
      ep->region = region;
      child2->setElementData(ep);

      return false;
Thomas Witkowski's avatar
Thomas Witkowski committed
    ElementData *clone() const 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
      ElementRegion_ED *newObj = new ElementRegion_ED;
      newObj->region = region;
      newObj->decorated = ElementData::clone();
Thomas Witkowski's avatar
Thomas Witkowski committed
    inline std::string getTypeName() const 
    { 
      return "ElementRegion_ED"; 
Thomas Witkowski's avatar
Thomas Witkowski committed
    }
Thomas Witkowski's avatar
Thomas Witkowski committed
    inline const int getTypeID() const 
    { 
      return ELEMENT_REGION; 
    }
    void serialize(std::ostream& out) 
    {
      ElementData::serialize(out);
Thomas Witkowski's avatar
Thomas Witkowski committed
      SerUtil::serialize(out, region);
    void deserialize(std::istream& in) 
    {
      ElementData::deserialize(in);
Thomas Witkowski's avatar
Thomas Witkowski committed
      SerUtil::deserialize(in, region);
    inline void setRegion(int r) 
Thomas Witkowski's avatar
Thomas Witkowski committed
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
    }
Thomas Witkowski's avatar
Thomas Witkowski committed
    inline int getRegion() const 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
    }