/* $Id: family.cc,v 1.2 1996/11/20 09:57:23 roitzsch Exp $ (C)opyright 1996 by Konrad-Zuse-Center, Berlin All rights reserved. Part of the Kaskade distribution */ #include "family.h" #include "familyA.h" //------------------------------------------------------------------------- void FamilyTree:: notImplemented(const char* name) const { cout << "\n*** class FamilyTree: function " << name << " not implemented\n"; cout.flush(); abort(); } //------------------------------------------------------------------------- FamilyTree:: ~FamilyTree() { int i; FORALL(generation,i) delete generation[i]; } //------------------------------------------------------------------------- void FamilyTree:: setGeneration(Generation* gen) { generation.push(gen); } Generation* FamilyTree:: getGeneration(int level) { return generation[level]; } void FamilyTree:: extendGeneration(int level, int noOfNodes) { generation[level]->extend(noOfNodes); } //------------------------------------------------------------------------- void FamilyTree:: newPointSon(int node, int father, int depth) { PointSon* son = new PointSon; son->father = father; generation[depth]->insertSon(node, son); } //------------------------------------------------------------------------- void FamilyTree:: newEdgeSon(int node, int father1, int father2, int depth) { EdgeSon* son = new EdgeSon; son->father1 = father1; son->father2 = father2; generation[depth]->insertSon(node, son); } //------------------------------------------------------------------------- void FamilyTree:: prolong(const Vector& el, Vector& eh, int highLevel) const { generation[highLevel]->prolong(el, eh); } //------------------------------------------------------------------------- void FamilyTree:: restr(Vector& rh, Vector& rl, int highLevel) const { generation[highLevel]->restr(rh, rl); } //------------------------------------------------------------------------- void FamilyTree:: rhsToHB(Vector& r, int level) const { generation[level]->rhsToHB(r); } //------------------------------------------------------------------------- void FamilyTree:: solToNB(Vector& e, int level) const { generation[level]->solToNB(e); } //------------------------------------------------------------------------- void FamilyTree:: print() const { int i; FORALL(generation,i) { cout << "\nFamilyTree: Generation " << i << ":\n"; generation[i]->print(); } } //------------------------------------------------------------------------- //------------------------------------------------------------------------- Generation:: Generation(int noOfNodes) : son(1,noOfNodes) { int i; FORALL(son,i) son[i] = 0; } //------------------------------------------------------------------------- Generation:: ~Generation() { int i; FORALL(son,i) { delete son[i]; son[i] = 0; } } //------------------------------------------------------------------------- void Generation:: extend(int noOfNodes) { son.extendAndCopy(noOfNodes); } //------------------------------------------------------------------------- void Generation:: notImplemented(const char* name) const { cout << "\n*** class Generation: function " << name << " not implemented\n"; cout.flush(); abort(); }; //------------------------------------------------------------------------- void Generation:: prolong(const Vector& el, Vector& eh) const { int i; FORALL(son,i) son[i]->prolong(el, eh[i]); } //------------------------------------------------------------------------- void Generation:: restr(Vector& rh, Vector& rl) const { int i; FORALL(rl,i) rl[i] = 0.0; FORALL(son,i) son[i]->restr(rh[i], rl); // distributes his residual rh[i] } //------------------------------------------------------------------------- void Generation:: solToNB(Vector& e) const { int i; FORALL(son,i) son[i]->prolong(e, e[i]); } //------------------------------------------------------------------------- void Generation:: rhsToHB(Vector& r) const { int i; FORALL(son,i) son[i]->restr(r[i], r); // distributes his residual rh[i] } //------------------------------------------------------------------------- void Generation:: print() const { int i; cout << "\n"; FORALL(son,i) { cout << "Node " << i << ": "; son[i]->print(); } } //------------------------------------------------------------------------- //------------------------------------------------------------------------- void Son:: notImplemented(const char* name) const { cout << "\n*** class Son: function " << name << " not implemented\n"; cout.flush(); abort(); } //------------------------------------------------------------------------- void Son:: print() const { notImplemented("print"); } //-------------------------------------------------------------------------