changa 3.5
Loading...
Searching...
No Matches
MapStructures.h
Go to the documentation of this file.
1#ifndef _MAP_STRUCTURES_H_
2#define _MAP_STRUCTURES_H_
7#include <iostream>
8
9#include "Vector3D.h"
10#include "TaggedVector3D.h"
11#include "OrientedBox.h"
12using namespace std;
13
14#define XDIM 0
15#define YDIM 1
16#define ZDIM 2
17#define NDIMS 3
18
19#define LEFT_PARTITION 0
20#define RIGHT_PARTITION 1
21#define INVALID_PARTITION -1
22
23#define NDIMS 3
24
25// Each tpobject has three events, one for
26// each component of its centroid. This helps
27// us avoid sorting after each recursive partitioning
28// step.
29
30class TPObject;
31
36struct Event {
38 int owner;
40 float load;
42 float position;
43
44 Event(float pos, float ld, int o) :
45 position(pos),
46 load(ld),
47 owner(o)
48 {
49 }
50
51 Event() :
52 owner(-1),
53 load(0.0),
54 position(0.0)
55 {
56 }
57
58 bool operator<(const Event &e) const {
59 return position < e.position;
60 }
61
62 bool operator<=(const Event &e) const {
63 return position <= e.position;
64 }
65
66 bool operator>=(const Event &e) const {
67 return position >= e.position;
68 }
69
70 void pup(PUP::er &p){
71 p|owner;
72 p|load;
73 p|position;
74 }
75};
76
80struct OrbObject {
81 int partition;
85 Vector3D<float> centroid;
88
89 OrbObject(int tag) :
90 partition(-1),
91 lbindex(tag),
93 {
94 }
95
96 OrbObject() :
97 partition(-1),
98 lbindex(-1),
100 {
101 }
102
103 OrbObject(int tag, int np) :
104 partition(-1),
105 lbindex(tag),
106 numParticles(np)
107 {
108 }
109
110 void pup(PUP::er &p){
111 p|partition;
112 p|lbindex;
113 p|centroid;
114 p|numParticles;
115 }
116};
117
121class TPObject{
122 public:
123
124 Vector3D<float> centroid;
125 float load;
126 //int index;
127 int lbindex;
128 bool migratable;
129 //int nparticles;
130
131 int whichPartition;
132
133 bool operator<(const TPObject &t) const{
134 return load < t.load;
135 }
136
137 TPObject() :
138 load(0.0),
139 lbindex(-1),
140 whichPartition(-1)
141 {
142 }
143
144};
145
149class Processor{
150 public:
151
152 float load;
153 int t;
154
155 bool operator<(const Processor &p) const{
156 return load > p.load;
157 }
158 Processor(){
159 load = 0.0;
160 t = -1;
161 }
162
163 Processor(int pe){
164 load = 0.0;
165 t = pe;
166 }
167
168};
169
170class Node {
171 public:
172 int x, y, z;
173 CkVec<int> procRanks;
174#ifdef PRINT_BOUNDING_BOXES
175 OrientedBox<float> box;
176#endif
177};
178
179typedef int (*ComparatorFn) (const void *, const void *);
180#endif // _MAP_STRUCTURES_H_
Definition MapStructures.h:170
hold information needed by the load balancer for each TreePiece.
Definition MapStructures.h:121
structure for sorting TreePieces in one dimension for load balancing.
Definition MapStructures.h:36
float load
load of this TreePiece
Definition MapStructures.h:40
int owner
Index within TreePiece array or stats->objData array of this TreePiece.
Definition MapStructures.h:38
float position
Centroid of this TreePiece in a particular dimension.
Definition MapStructures.h:42
data for Orb3D load balancing.
Definition MapStructures.h:80
Vector3D< float > centroid
Spacial location of TreePiece.
Definition MapStructures.h:85
int lbindex
index into LB stats->objData
Definition MapStructures.h:83
int numParticles
Particles in the TreePiece.
Definition MapStructures.h:87