Streamer fluid modeling - An overview of ARCoS  1.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
tree.c
Go to the documentation of this file.
1 
5 #include <stdlib.h>
6 #include <stdio.h>
7 
8 #include "species.h"
9 
10 #include "tree.h"
11 
15 leaf_t*
16 leaf_new_a (leaf_t *parent, leaf_t *next, leaf_t *first_child, void *data)
17 {
18  leaf_t *leaf;
19 
20  debug (2, "leaf_new_a\n");
21 
22  leaf = (leaf_t*) xmalloc (sizeof(leaf_t));
23 
24  leaf->parent = parent;
25  leaf->next = next;
26  leaf->first_child = first_child;
27  leaf->data = data;
28 
29  return leaf;
30 }
31 
33 leaf_t*
34 leaf_new_child_a (leaf_t *parent, void *data)
35 {
36  leaf_t *leaf;
37 
38  debug (2, "leaf_new_child_a\n");
39 
40  leaf = leaf_new_a (parent, parent->first_child, NULL, data);
41 
42  parent->first_child = leaf;
43 
44  leaf->level = parent->level + 1;
45 
46  return leaf;
47 }