View on GitHub

Vistle

Distributed Data-parallel Scientific Visualization in VR

celltreenode.h
Go to the documentation of this file.
1#ifndef CELLTREENODE_H
2#define CELLTREENODE_H
3
4#include "export.h"
5#include "scalar.h"
6#include "index.h"
7//#include "shm.h"
8
9namespace vistle {
10
11template<size_t IndexSize, int NumDimensions>
12struct CelltreeNode;
13
14template<int NumDimensions>
15struct CelltreeNode<8, NumDimensions> {
16 union {
17 Scalar Lmax; //< for inner nodes: max of left subvolume
18 Index start; //< for leaf nodes: index into cell array
19 };
20 union {
21 Scalar Rmin; //< for inner nodes: min of right subvolume
22 Index size; //< for leaf nodes: index into cell array
23 };
24
25 Index dim: NumDimensions == 1 ? 1 : 2; //< split dimension, or NumDimensions for leaf nodes
26 Index child: sizeof(Index) * 8 - (NumDimensions == 1 ? 1 : 2); //< index of first child for inner nodes
27
28 CelltreeNode(Index start = 0, Index size = 0) // leaf node
29 : start(start), size(size), dim(NumDimensions), child(0)
30 {}
31
32 CelltreeNode(int dim, Scalar Lmax, Scalar Rmin, Index children) // inner node
33 : Lmax(Lmax), Rmin(Rmin), dim(dim), child(children)
34 {}
35
36 bool isLeaf() const { return dim == NumDimensions; }
37 Index left() const { return child; }
38 Index right() const { return child + 1; }
39
41 template<class Archive>
42 void serialize(Archive &ar)
43 {}
44};
45
46template<int NumDimensions>
47struct CelltreeNode<4, NumDimensions> {
48 union {
49 Scalar Lmax; //< for inner nodes: max of left subvolume
50 Index start; //< for leaf nodes: index into cell array
51 };
52 union {
53 Scalar Rmin; //< for inner nodes: min of right subvolume
54 Index size; //< for leaf nodes: index into cell array
55 };
56
57 Index dim; //< split dimension, or NumDimensions for leaf nodes
58 Index child; //< index of first child for inner nodes
59
60 CelltreeNode(Index start = 0, Index size = 0) // leaf node
61 : start(start), size(size), dim(NumDimensions), child(0)
62 {}
63
64 CelltreeNode(int dim, Scalar Lmax, Scalar Rmin, Index children) // inner node
65 : Lmax(Lmax), Rmin(Rmin), dim(dim), child(children)
66 {}
67
68 bool isLeaf() const { return dim == NumDimensions; }
69 Index left() const { return child; }
70 Index right() const { return child + 1; }
71
73 template<class Archive>
74 void serialize(Archive &ar)
75 {}
76};
77
78} // namespace vistle
79
80#endif
#define ARCHIVE_ACCESS
Definition: archives_config.h:465
Definition: allobjects.cpp:30
float Scalar
Definition: scalar.h:14
uint32_t Index
Definition: index.h:13
Definition: celltree.h:20
Index dim
Definition: celltreenode.h:57
Index left() const
Definition: celltreenode.h:69
Index child
Definition: celltreenode.h:58
CelltreeNode(Index start=0, Index size=0)
Definition: celltreenode.h:60
bool isLeaf() const
Definition: celltreenode.h:68
Index right() const
Definition: celltreenode.h:70
ARCHIVE_ACCESS void serialize(Archive &ar)
Definition: celltreenode.h:74
CelltreeNode(int dim, Scalar Lmax, Scalar Rmin, Index children)
Definition: celltreenode.h:64
CelltreeNode(int dim, Scalar Lmax, Scalar Rmin, Index children)
Definition: celltreenode.h:32
ARCHIVE_ACCESS void serialize(Archive &ar)
Definition: celltreenode.h:42
Index dim
Definition: celltreenode.h:25
Index left() const
Definition: celltreenode.h:37
Index child
Definition: celltreenode.h:26
CelltreeNode(Index start=0, Index size=0)
Definition: celltreenode.h:28
Index right() const
Definition: celltreenode.h:38
bool isLeaf() const
Definition: celltreenode.h:36