SurfaceRegion_ED.cc 2.19 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
/******************************************************************************
 *
 * AMDiS - Adaptive multidimensional simulations
 *
 * Copyright (C) 2013 Dresden University of Technology. All Rights Reserved.
 * Web: https://fusionforge.zih.tu-dresden.de/projects/amdis
 *
 * Authors: 
 * Simon Vey, Thomas Witkowski, Andreas Naumann, Simon Praetorius, et al.
 *
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 *
 *
 * 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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82


#include "SurfaceRegion_ED.h"
#include "Serializer.h"

namespace AMDiS {
  
  bool SurfaceRegion_ED::refineElementData(Element* parent, 
					   Element* child1,
					   Element* child2,
					   int elType)
  {
    ElementData::refineElementData(parent, child1, child2, elType);
    
    int sideOfChild;
    SurfaceRegion_ED *surfaceRegion;
    
    sideOfChild = parent->getSideOfChild(0, side, elType);
    if (sideOfChild >= 0) {
      surfaceRegion = new SurfaceRegion_ED(child1->getElementData());
      surfaceRegion->setSide(sideOfChild);
      surfaceRegion->setRegion(region);
      child1->setElementData(surfaceRegion);
    }    
    
    sideOfChild = parent->getSideOfChild(1, side, elType);
    if (sideOfChild >= 0) {
      surfaceRegion = new SurfaceRegion_ED(child2->getElementData());
      surfaceRegion->side = sideOfChild;
      surfaceRegion->region = region;
      child2->setElementData(surfaceRegion);
    }
    
    return false;
  }
  
  
  ElementData *SurfaceRegion_ED::clone() const 
  { 
    SurfaceRegion_ED *newObj = new SurfaceRegion_ED;
    newObj->side = side;
    newObj->region = region;
    newObj->decorated = ElementData::clone();
    return newObj; 
  }


  void SurfaceRegion_ED::serialize(std::ostream& out)
  {
    ElementData::serialize(out);
    SerUtil::serialize(out, side);
    SerUtil::serialize(out, region);
  }
  

  void SurfaceRegion_ED::deserialize(std::istream& in) 
  {
    ElementData::deserialize(in);
    SerUtil::deserialize(in, side);
    SerUtil::deserialize(in, region);
  }
}