File: tree.h

package info (click to toggle)
massivethreads 1.02-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 13,924 kB
  • sloc: ansic: 27,814; sh: 4,559; cpp: 3,334; javascript: 1,799; makefile: 1,745; python: 523; asm: 373; perl: 118; lisp: 9
file content (51 lines) | stat: -rw-r--r-- 640 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
/* tree.h */

#ifndef TREE_H
#define TREE_H

#include "vector.h"
#include "mol.h"

#define NSUBS 8
#define BODY  0
#define CELL  1

struct node {
  // tree structure
  node *parent;
  node **subs;

  // data
  int type;
  real mass;
  vector r;

  node(void);
  void split(int nsubs = NSUBS);
};

struct body : node {
  vector rv;
  vector ra;
  body(void);
};

struct cell : node {
  cell(void);
};


struct tree {
  node *root;
  int nnode;  // number of node
  int depth;  // tree levels
  
  void print(void);
  void print_tree(node *);
};

// Memory allocation wrappers
body * newbody(void);
cell * newcell(void);

#endif /* TREE_H */