Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

node.h File Reference

Defines base class for N-body systems. More...

#include "starlab_vector.h"
#include "story.h"
#include "hydrobase.h"
#include "starbase.h"

Go to the source code of this file.

Classes

class  node
 node: Base class for the nodes in a tree of dynamical particles. More...

Defines

#define __VALID_NODE__   123456789
#define __INVALID_NODE__   -1
#define for_all_daughters(dyntype, mother_node, daughter_name)
#define for_all_nodes(dyntype, base, node_name)
#define for_all_leaves(dyntype, base, node_name)

Typedefs

typedef node *(* npfp )(hbpfp, sbpfp, bool)
typedef nodenodeptr

Functions

nodenew_node (hbpfp the_hbpfp, sbpfp the_sbpfp, bool use_stories)
 Create a new node, with standard starbase and hydrobase pointers.
nodemk_flat_tree (int, npfp, hbpfp, sbpfp, bool use_stories=true)
 Make a flat tree containing the specified number of nodes.
nodemknode (int n, hbpfp the_hbpfp=new_hydrobase, sbpfp the_sbpfp=new_starbase, bool use_stories=true)
 Synonym for mk_flat_tree.
nodeget_node (istream &s=cin, npfp the_npfp=new_node, hbpfp the_hbpfp=new_hydrobase, sbpfp the_sbpfp=new_starbase, bool use_stories=true)
 Recursively read a node (or tree) from a stream.
void put_node (node *b, ostream &s=cout, bool print_xreal=true, int short_output=0)
 Recursively write a node to a stream.
void put_single_node (node *b, ostream &s=cout, bool print_xreal=true, int short_output=0)
 Write a single node to a stream.
bool forget_node (istream &s=cin)
bool node_contains (node *b, int i)
 True if index i corresponds to node b or a descendent.
bool clump_contains (node *b, int i)
 True if index i corresponds to b->get_top_level_node() or a descendent.
void pp (const node *, ostream &s=cerr)
 Recursively pretty-print a node.
void pp2 (const node *, ostream &s=cerr, int level=0)
 Recursively pretty-print a node, version 2.
nodemknode_mass (int n, real m=1.0)
real total_mass (node *n)
 Compute total mass of the daughters of node n (should equal n->get_mass().
void rmtree (node *b, bool delete_b=true)
 Recursively delete node b and its descendents.
void detach_node_from_general_tree (node *n)
void remove_node_with_one_daughter (node *n)
 Remove node from the tree and replace it by its daughter.
void detach_node_from_binary_tree (node *n)
void extend_tree (node *old, node *n)
 Insert new node n at location of old, which becomes the only child of n.
void add_node (node *n, node *parent)
 Insert n into the tree as the oldest_daughter of the parent.
void add_node_before (node *n, node *m)
 Insert node n into the tree before specified node m.
void insert_node_into_binary_tree (node *n, node *m, node *new_node)
 Insert node n into a tree as the sister of node m.
int is_descendent_of (node *a, node *b, int mode)
 Is a among the offspring of b?
nodecommon_ancestor (node *a, node *b)
 Return the common ancestor of a and b.
nodenode_with_index (int i, node *top=NULL)
 Return a pointer to the node with the specified index.
nodenode_with_name (char *s, node *top=NULL)
 Return a pointer to the node with the specified name.
int depth_of_node (node *n)
 Return the depth of node n in the tree.
char * construct_binary_label (node *ni, node *nj)
 Construct a label for a binary from the component names.
void label_binary_node (node *)
 Label a binary node based on the component names (a,b).
void label_merger_node (node *)
 Label a merger node based on the component names (a+b).
void print_normal_form (node *, ostream &)
char * get_normal_form (node *)
void renumber (node *b, int istart, bool mass_order, bool name_nodes=false, bool single_number=false)
void construct_node_name (node *b)


Detailed Description

Defines base class for N-body systems.

Definition in file node.h.


Define Documentation

#define for_all_daughters dyntype,
mother_node,
daughter_name   ) 
 

Value:

for (dyntype* daughter_name = mother_node->get_oldest_daughter();    \
              daughter_name != NULL;                                          \
              daughter_name = daughter_name->get_younger_sister())

Definition at line 582 of file node.h.

#define for_all_leaves dyntype,
base,
node_name   ) 
 

Value:

for (dyntype* node_name = base;                                      \
              node_name != NULL;                                              \
              node_name = (dyntype*) node_name->next_node(base))              \
              if (node_name->get_oldest_daughter() == NULL)

Definition at line 594 of file node.h.

#define for_all_nodes dyntype,
base,
node_name   ) 
 

Value:

for (dyntype* node_name = base;                                      \
              node_name != NULL;                                              \
              node_name = (dyntype*) node_name->next_node(base))

Definition at line 589 of file node.h.


Generated on Wed Jul 20 12:43:37 2005 for Starlab by  doxygen 1.4.3