Newer
Older
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
/*
* $Log$
* Revision 1.1 2002/04/16 15:17:01 slevy
* Simple network server to cough up a list of particles at a given time.
*
*/
#ifdef NEWSTDIO
#include <ostream.h>
#include <istream.h>
#endif /*NEWSTDIO*/
#include <stdio.h>
#include <stdarg.h>
#include "worldline.h"
#include "shmem.h"
#include "findfile.h"
#include "specks.h"
#include "kira_parti.h"
#include "stardef.h"
#include <unistd.h>
#include <getopt.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <errno.h>
#include <ctype.h>
#undef isdigit /* irix 6.5 back-compat hack */
static char local_id[] = "$Id$";
extern struct specklist *kira_get_parti( struct stuff *st, double realtime );
void msg( CONST char *fmt, ... );
typedef worldbundle *worldbundleptr;
enum speckfields {
SPECK_ID = 0, // worldline index (= kira index for single stars,
// unique small negative int for others)
SPECK_MASS = 1, // mass/Msun
SPECK_NCLUMP = 2, // number of stars in clump
SPECK_TLOG = 3, // log10(Teff)
SPECK_LUM = 4, // L/Lsun?
SPECK_STYPE = 5, // star type: 1ms 2cd 3gs 4bh 5sg 6hb
SPECK_ISMEMBER = 6, // is member of cluster?
SPECK_ROOTID = 7, // worldline index of root of clump
SPECK_TREEADDR = 8, // bit-encoded tree address within our clump (0 for isolated stars)
SPECK_RINGSIZE = 9, // size of ring marker
SPECK_SQRTMASS = 10, // square root of mass, for handy brightness factor
SPECK_MU = 11, // mass ratio; = 0 for leaf nodes
SPECK_SEPVEC = 12, // separation vector[3]
SPECK_NDATAFIELDS = 15
};
static char *fieldnames[] = { // Must match ``enum speckfields'' !!
"id", // worldline index (=? kira index for singles), unique <0 for others
"mass", // log10(mass/Msun)
"nclump", // number of stars in clump, = 1 for singles
"Tlog", // log10( Teff )
"Lum", // L/Lsun?
"stype", // stellar type index
"ismember", // is member of cluster? (0/1)
"rootid", // id of root of clump, = our id for singles
"treeaddr", // binary-coded address in clump
"ringsize", // size of ring
"sqrtmass", // sqrt(mass/Msun)
"mu", // mass ratio for nonleaf nodes
NULL
};
struct vald {
float min, max, sum;
};
struct trailhead {
int maxtrail, ntrails;
int next; /* ring buffer next-slot-to-use */
real lasttime;
struct speck *specks;
};
struct worldstuff {
int nh, maxnh;
worldbundleptr *wh;
ifstream *ins;
int ih; // current worldbundle index
real tmin, tmax;
real tcur; // current time
real treq; // requested time
int readflags; // KIRA_VERBOSE | KIRA_READLATER
int treenodes; // KIRA_{OFF|ON|ROOTS}
int treerings; // KIRA_{OFF|ON|ROOTS}
int treearcs; // KIRA_{OFF|ON|CROSS|TICK}
float tickscale; // size of treearc cross mark (frac of sep)
int ringsizer; // KIRA_RINGSEP, KIRA_RINGA
float ringscale; // multiplier for above
float ringmin, ringmax; // range of pixel sizes for ring markers
int tracking, wastracking; // id of particle we're tracking, or zero
Point trackpos; // last known position of tracked particle
float massscale; // scale-factor for masses (conv to Msun)
int truemassscale; // Did massscale come from kira itself?
int maxstars, maxmarks; // room allocated for each
int maxleaves;
struct specklist *sl;
struct specklist *marksl;
int slvalid;
struct specklist *bufsl[2], *bufmarksl[2]; // double-buffers
int bufno;
vector center_pos;
vector center_vel;
int centered;
int which_center;
int myselseq; // sequence number of ww->sel
int nleafsel;
SelMask *bufleafsel[2];
// selection mapping
SelOp intsrc; // for all particles matching intsrc,
SelOp intdest; // then turn on intdest bit(s).
struct trailhead *trails; // per-star specklist of recent history
int maxtrail;
int maxtrailno;
SelOp trailsel;
float trailalpha;
float trailpsize;
int trailonly;
real maxtrailgap;
SelOp picksel; // what to do when a star is picked
struct speck *marksp; // current pointer, updated by add_speck
int leafcount; // temp, used in recursion only
int interactsel, unionsel; // ditto
int pickcount; // temp, used in kira_picked
SelMask *leafsel;
struct vald vd[SPECK_NDATAFIELDS];
double curtime;
worldstuff( struct stuff *st ) {
this->init( st );
}
void init( struct stuff *st ) {
nh = 0;
wh = NULL;
ih = 0;
tmin = 0, tmax = 1;
tcur = treq = 0;
treenodes = KIRA_ON;
treerings = KIRA_OFF;
treearcs = KIRA_ON;
ringsizer = KIRA_RINGA;
ringscale = 1.5;
massscale = 1.0;
truemassscale = 0;
ringmin = 2;
ringmax = 50;
tickscale = 0.25;
tracking = wastracking = 0;
centered = 0; /* NOT auto-centered by default! */
which_center = 0;
center_pos[0] = center_pos[1] = center_pos[2] = 0;
center_vel[0] = center_vel[1] = center_vel[2] = 0;
sl = marksl = NULL;
bufsl[0] = bufsl[1] = NULL;
bufmarksl[0] = bufmarksl[1] = NULL;
bufno = 0;
maxstars = maxmarks = 0;
slvalid = 0;
trails = NULL;
maxtrail = 50;
maxtrailno = 0;
trailonly = 0;
trailalpha = 0.6;
trailpsize = 1.0;
maxtrailgap = 0.1;
marksp = NULL;
leafcount = 0;
myselseq = 0;
leafsel = NULL;
Loading
Loading full blame...