https://github.com/N-BodyShop/changa
Revision 3d4ed189327352c52cbd85da2bb5a0f512175629 authored by Tim Haines on 30 April 2017, 03:54:12 UTC, committed by Tom Quinn on 03 May 2017, 02:49:49 UTC
Change-Id: Id3ef5042f7ba59da69fa95a720d9a5a9c000b0c9
1 parent 5fefcda
Raw File
Tip revision: 3d4ed189327352c52cbd85da2bb5a0f512175629 authored by Tim Haines on 30 April 2017, 03:54:12 UTC
Use KeyType from keytype.h for NodeKey
Tip revision: 3d4ed18
GenericTreeNode.C
#include "config.h"
#include "GenericTreeNode.h"

namespace Tree {

GenericTreeNode *BinaryTreeNode::clone() const {
  //BinaryTreeNode *tmp = new BinaryTreeNode();
  //*tmp = *this;
  //return tmp;
  return new BinaryTreeNode(*this);
};

void BinaryTreeNode::pup(PUP::er &p, int depth) {
  //CkPrintf("Pupper of BinaryTreeNode(%d) called for %s (%d)\n",depth,p.isPacking()?"Packing":p.isUnpacking()?"Unpacking":"Sizing",p.isSizing()?((PUP::sizer*)&p)->size():((PUP::mem*)&p)->size());
  GenericTreeNode::pup(p);
  int isNull;
  for (int i=0; i<2; ++i) {
    isNull = (children[i]==NULL || depth==0) ? 0 : 1;
    p | isNull;
    CkAssert(isNull==0 || isNull==1);
    if (isNull != 0 && depth != 0) {
      if (p.isUnpacking()) children[i] = new BinaryTreeNode();
      children[i]->pup(p, depth-1);
      if (p.isUnpacking()) children[i]->parent = this;
    }
  }
};

}
back to top